Skip to content

Conversation

@ncipollina
Copy link
Contributor

Summary

This PR establishes the initial project setup for LayeredCraft Lambda ASP.NET Core Hosting Extensions, implementing a comprehensive Lambda timeout middleware with full documentation and CI/CD pipeline.

Changes

Core Implementation

  • LambdaTimeoutLinkMiddleware: Intelligent timeout handling that links Lambda execution limits with HTTP request cancellation
  • ApplicationBuilderExtensions: Clean extension method UseLambdaTimeoutLinkedCancellation() for easy integration

Documentation

  • Comprehensive README: Installation, usage examples, feature overview following LayeredCraft standards
  • Complete docs/ structure: Detailed middleware documentation, real-world examples, and best practices
  • GitHub Pages ready: Jekyll-compatible documentation with custom styling

Project Setup

  • Solution organization: Proper .NET solution structure with organized folders
  • CI/CD pipeline: GitHub Actions for build, test, PR validation, and docs deployment
  • Development aids: CLAUDE.md for AI assistance, dependabot configuration

Key Features

  • ⏱️ Dual cancellation: Responds to both client disconnect and Lambda timeout
  • 🔄 Graceful shutdown: Configurable safety buffer for cleanup operations
  • 🛠️ Developer-friendly: Standard CancellationToken patterns work seamlessly
  • 🧪 Local development: Pass-through behavior outside Lambda environments
  • 📊 Observable: Structured logging with detailed telemetry

Test plan

  • Project builds successfully with dotnet build
  • Solution loads correctly in IDE with organized structure
  • Documentation structure is complete and properly linked
  • GitHub Actions workflows are configured
  • Extension method is properly implemented with XML documentation

🤖 Generated with Claude Code

ncipollina and others added 5 commits September 12, 2025 08:43
…hensive documentation

- Add LambdaTimeoutLinkMiddleware for Lambda timeout-aware request cancellation
- Add ApplicationBuilder extension method UseLambdaTimeoutLinkedCancellation()
- Create comprehensive documentation structure with examples and best practices
- Set up GitHub Actions for CI/CD (build, test, docs deployment)
- Configure solution structure with proper organization
- Add CLAUDE.md for future AI assistance context

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Create test project LayeredCraft.Lambda.AspNetCore.HostingExtensions.Tests
- Add project reference to main library
- Configure xUnit test runner settings
- Add to solution structure in test folder

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add mkdocs.yml with Material theme configuration
- Add requirements.txt for Python documentation dependencies
- Add custom CSS styling for LayeredCraft branding
- Configure navigation, search, and code highlighting
- Enable dark/light theme toggle and responsive design

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove docs/assets/css/extra.css (not needed, follows CDK constructs pattern)
- Remove extra_css reference from mkdocs.yml
- Keep only Jekyll style.scss to match existing LayeredCraft documentation pattern
- Align with CDK constructs repo structure using Material theme defaults

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Update requirements.txt to match CDK constructs versions exactly
- Replace git-revision-date-localized plugin with minify plugin
- Remove pymdown-extensions dependency (included with mkdocs-material)
- Fix GitHub Actions build error with missing plugin

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ncipollina ncipollina requested a review from Copilot September 12, 2025 13:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR establishes the foundational structure for LayeredCraft Lambda ASP.NET Core Hosting Extensions, implementing a comprehensive Lambda timeout middleware with full documentation and CI/CD infrastructure.

  • Core implementation of LambdaTimeoutLinkMiddleware for intelligent timeout handling
  • Complete project setup with solution structure, documentation, and CI/CD pipelines
  • Comprehensive documentation site with middleware guides and real-world examples

Reviewed Changes

Copilot reviewed 19 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/LayeredCraft.Lambda.AspNetCore.HostingExtensions/Middleware/LambdaTimeoutLinkMiddleware.cs Core middleware implementation for linking Lambda timeout with HTTP request cancellation
src/LayeredCraft.Lambda.AspNetCore.HostingExtensions/Extensions/ApplicationBuilderExtensions.cs Extension method for easy middleware integration
src/LayeredCraft.Lambda.AspNetCore.HostingExtensions/LayeredCraft.Lambda.AspNetCore.HostingExtensions.csproj Main library project file with dependencies
test/LayeredCraft.Lambda.AspNetCore.HostingExtensions.Tests/ Test project setup with placeholder tests
docs/ Complete documentation structure with middleware guides and examples
Solution and build files Project organization, CI/CD workflows, and package configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

- Add 12 complete unit tests covering all middleware functionality
- Fix critical middleware bug in timeout vs client disconnect detection
- Implement robust cancellation token registration with timestamps
- Add short-circuit optimization for expired Lambda timeouts
- Create comprehensive test infrastructure with AutoFixture specimen builders
- Add convention-based parameter naming for different test scenarios
- Enhance HttpContextSpecimenBuilder for Lambda context simulation
- Add RequestDelegateSpecimenBuilder for delegate behavior testing
- Verify proper token linking, restoration, and response handling
- Test constructor validation, null checks, and edge cases

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ncipollina ncipollina requested a review from Copilot September 12, 2025 19:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 27 out of 29 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

};
}

private static HttpContext CreateDefaultHttpContext(ISpecimenContext context, bool hasLambdaContext = true, bool responseStarted = false, bool preCancelled = false)
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method has too many boolean parameters which makes it difficult to understand the intended behavior from call sites. Consider using an options pattern or separate factory methods for different scenarios.

Copilot uses AI. Check for mistakes.
Comment on lines +22 to +38
return parameterName switch
{
// For tests that need to capture the token during execution
"capturingnext" or "capturingdelegate" => CreateCapturingRequestDelegate(),

// For tests that just need to verify it was called
"trackingnext" or "trackingdelegate" => CreateTrackingRequestDelegate(),

// For timeout cancellation testing
"timeoutdelegate" or "timeoutcancelling" => CreateTimeoutCancellingDelegate(),

// For client disconnect cancellation testing
"disconnectdelegate" or "disconnectcancelling" => CreateClientDisconnectDelegate(),

// Default: simple delegate that just completes
_ => CreateSimpleRequestDelegate()
};
Copy link

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using parameter names with string matching creates brittle test dependencies. Consider using an enum or attribute-based approach to specify the desired delegate behavior more explicitly.

Copilot uses AI. Check for mistakes.
… coverage

- Add Microsoft.Testing.Extensions.CodeCoverage v17.14.2 for code coverage reporting
- Enables coverage analysis with Microsoft Testing Platform (MTP)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@ncipollina ncipollina merged commit 05367f4 into main Sep 12, 2025
3 checks passed
@ncipollina ncipollina deleted the feature/initial-setup-and-documentation branch September 12, 2025 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants