Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f5e0497
chore(beads): record 3.0.0 planning beads (cdkc-2lh)
ncipollina Nov 24, 2026
ab2a58b
fix: pass the option structs CDK expects for function URLs and behaviors
ncipollina Nov 24, 2026
ab2483b
build!: target net10.0/net11.0, pin SDK 11.0.100 and update dependencies
ncipollina Nov 24, 2026
dd63def
ci: move workflows to devops-templates v11.2
ncipollina Nov 24, 2026
8fd2dd0
docs: document .NET 10/11 targets and the Amazon.CDK.Lib 2.278.0 floor
ncipollina Nov 24, 2026
bb7c44d
ci: align publish-release .NET version comment with publish-preview
ncipollina Nov 24, 2026
4164270
docs: correct Web Function L1/L2 and SDK-pin statements
ncipollina Nov 24, 2026
fe0d184
Merge W1: workflows on devops-templates v11.2 and framework docs (cdk…
ncipollina Nov 24, 2026
f6f6ce2
test: add Compono composition profiles for construct props
ncipollina Nov 24, 2026
b052749
test: compose Lambda construct props with Compono
ncipollina Nov 24, 2026
934e8c2
test: compose static site construct props with Compono
ncipollina Nov 24, 2026
4b08361
test: compose Cognito user pool construct props with Compono
ncipollina Nov 24, 2026
4851746
test: compose DynamoDB table construct props with Compono
ncipollina Nov 24, 2026
a2cb272
test: compose web function construct props with Compono
ncipollina Nov 24, 2026
0ab6d0b
test: remove AutoFixture and NSubstitute
ncipollina Nov 24, 2026
32cef89
docs: add the 3.0.0 design and complete the CDK type-collision note
ncipollina Nov 24, 2026
d90be14
test: generate incidental construct props values in Compono profiles
ncipollina Nov 24, 2026
3e12fcc
test: drop stale framework name from profile docs
ncipollina Nov 24, 2026
2526588
Merge W2: Compono test-stack migration (cdkc-2lh.2.3)
ncipollina Nov 24, 2026
77ac802
build: remove VSTest packages and the AutoFixture/NSubstitute version…
ncipollina Nov 24, 2026
d8e7608
chore(beads): record #109 execution beads (cdkc-2lh.2.x, cdkc-2lh.7)
ncipollina Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .beads/issues.jsonl

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Generate app token
id: app-token
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
with:
app-id: ${{ secrets.DEPENDABOT_AUTOMERGE_APP_ID }}
private-key: ${{ secrets.DEPENDABOT_AUTOMERGE_PRIVATE_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ jobs:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v7.0.0
uses: actions/setup-python@v7.1.0
with:
python-version-file: pyproject.toml

- name: Install uv
uses: astral-sh/setup-uv@v10.2.0
uses: astral-sh/setup-uv@v10.4.0
with:
enable-cache: true

Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ on:
pull_request:
branches:
- main
permissions: write-all
permissions:
contents: read
jobs:
build:
uses: LayeredCraft/devops-templates/.github/workflows/pr-build.yaml@v10.8
uses: LayeredCraft/devops-templates/.github/workflows/pr-build.yaml@v11.2
with:
solution: LayeredCraft.Cdk.Constructs.slnx
hasTests: true
useMtpRunner: true
enableCodeCoverage: true
coverageThreshold: 80
dotnetVersion: |
8.0.x
9.0.x
10.0.x
11.0.x
runCdk: false
secrets: inherit
globalJsonFile: global.json
2 changes: 1 addition & 1 deletion .github/workflows/pr-title-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ permissions:

jobs:
validate:
uses: LayeredCraft/devops-templates/.github/workflows/pr-title-check.yml@v10.8
uses: LayeredCraft/devops-templates/.github/workflows/pr-title-check.yml@v11.2
10 changes: 4 additions & 6 deletions .github/workflows/publish-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ permissions:
pull-requests: write

jobs:
# To add support for additional .NET versions (e.g. net9, net11), add release branches
# (e.g. release/net9) and wire up separate caller workflows targeting those branches.
# To add support for additional .NET versions (e.g. net11), add release branches
# (e.g. release/net11) and wire up separate caller workflows targeting those branches.

build:
uses: LayeredCraft/devops-templates/.github/workflows/publish-preview.yml@v10.8
uses: LayeredCraft/devops-templates/.github/workflows/publish-preview.yml@v11.2
with:
solution: LayeredCraft.Cdk.Constructs.slnx
dotnetVersion: |
8.0.x
9.0.x
10.0.x
11.0.x
hasTests: true
Expand All @@ -39,6 +37,6 @@ jobs:
id-token: write
contents: read
steps:
- uses: LayeredCraft/devops-templates/.github/actions/nuget-push@v10.8
- uses: LayeredCraft/devops-templates/.github/actions/nuget-push@v11.2
with:
nuget_user: ${{ secrets.NUGET_USER }}
10 changes: 4 additions & 6 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ permissions:
contents: write

jobs:
# To add support for additional .NET versions (e.g. net9, net11), add release branches
# (e.g. release/net9) and wire up separate caller workflows targeting those branches.
# To add support for additional .NET versions (e.g. net11), add release branches
# (e.g. release/net11) and wire up separate caller workflows targeting those branches.

build:
uses: LayeredCraft/devops-templates/.github/workflows/publish-release.yml@v10.8
uses: LayeredCraft/devops-templates/.github/workflows/publish-release.yml@v11.2
with:
solution: LayeredCraft.Cdk.Constructs.slnx
dotnetVersion: |
8.0.x
9.0.x
10.0.x
11.0.x
hasTests: true
Expand All @@ -30,6 +28,6 @@ jobs:
id-token: write
contents: read
steps:
- uses: LayeredCraft/devops-templates/.github/actions/nuget-push@v10.8
- uses: LayeredCraft/devops-templates/.github/actions/nuget-push@v11.2
with:
nuget_user: ${{ secrets.NUGET_USER }}
2 changes: 1 addition & 1 deletion .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ permissions:

jobs:
draft:
uses: LayeredCraft/devops-templates/.github/workflows/release-drafter.yml@v10.8
uses: LayeredCraft/devops-templates/.github/workflows/release-drafter.yml@v11.2
with:
event_name: ${{ github.event_name }}
pr_draft: ${{ github.event.pull_request.draft == true }}
41 changes: 22 additions & 19 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is a .NET library that provides reusable AWS CDK constructs for serverless
dotnet build

# Run all tests (preferred method for xUnit v3)
dotnet run --project test/LayeredCraft.Cdk.Constructs.Tests/ --framework net8.0
dotnet run --project test/LayeredCraft.Cdk.Constructs.Tests/ --framework net10.0

# Run tests for a specific project
dotnet test test/LayeredCraft.Cdk.Constructs.Tests/
Expand Down Expand Up @@ -58,7 +58,7 @@ dotnet add test/LayeredCraft.Cdk.Constructs.Tests/ package PackageName
- `WebFunctionEndpointConstruct` (`IWebFunctionEndpoint`) represents each endpoint; `AddEndpoint` adds more; `GrantInvoke` (identity- or resource-policy based) and `GrantCloudFrontInvoke` are endpoint-scoped
- `WebFunctionOrigin` returns a CloudFront `IOrigin` that configures origin access control (OAC) and the required resource-policy statement for `IamAuth` endpoints
- Workload-neutral: Next.js, ASP.NET Core, and Blazor Static SSR deploy through the same public API; the differences live in the artifacts and configuration only
- Requires `Amazon.CDK.Lib` 2.274.0+ (Lambda Web Functions have L1-only support in CDK)
- Requires `Amazon.CDK.Lib` 2.278.0+; built directly on the CloudFormation L1 resources (`CfnWebFunction`, `CfnWebFunctionRevision`, `CfnWebFunctionEndpoint`, `CfnResourcePolicy`). `Amazon.CDK.Lib` 2.278.0 also ships its own L2 Web Function constructs in `Amazon.CDK.AWS.Lambda`; how this construct relates to them is being evaluated in the 3.0.0 design

**StaticSiteConstruct** (`src/LayeredCraft.Cdk.Constructs/StaticSiteConstruct.cs`)
- Comprehensive CDK construct for static website hosting
Expand Down Expand Up @@ -98,8 +98,9 @@ dotnet add test/LayeredCraft.Cdk.Constructs.Tests/ package PackageName
5. **Versioning Strategy**: Creates new versions on every deployment with "live" alias

### Target Frameworks
- .NET 8.0 and .NET 9.0
- Uses AWS CDK v2 (Amazon.CDK.Lib 2.274.0 minimum; the Web Function constructs require the 2.274.0 enum values)
- .NET 10 and .NET 11
- Uses AWS CDK v2 (Amazon.CDK.Lib 2.278.0 minimum; the Web Function constructs require the OAC signing enum values)
- SDK pinned by `global.json` (11.0.100, `rollForward: latestFeature`)

### OpenTelemetry Configuration (v2.0.0+)
Starting with version 2.0.0, the OpenTelemetry layer configuration has been updated:
Expand All @@ -123,28 +124,30 @@ var props = new LambdaFunctionConstructProps
## Testing Framework

### Test Structure
- Uses xUnit v3 with AutoFixture for data generation
- xUnit v3 on Microsoft.Testing.Platform (`xunit.v3.mtp-v2`; `global.json` selects the MTP runner). There is no VSTest adapter (`Microsoft.NET.Test.Sdk` and `xunit.runner.visualstudio` were removed in 3.0.0).
- Compono (`Compono`, `Compono.XunitV3`) for test composition; no AutoFixture and no NSubstitute
- AwesomeAssertions for fluent assertions
- NSubstitute for mocking (though not heavily used in current tests)
- AWS CDK Template assertions for infrastructure testing

### Test Architecture
**Custom Attributes**:
- `LambdaFunctionConstructAutoDataAttribute`: AutoFixture attribute with customizable parameters
- `WebFunctionConstructAutoDataAttribute`: AutoFixture attribute supplying deterministic Web Function props (imported, externally managed artifact bucket)
- `BaseFixtureFactory`: Factory for creating configured AutoFixture instances
**Composition profiles** (`TestKit/Profiles/`), one `ICompositionProfile` per construct's props, used with `[Compose<TProfile>]` or `[Compose<TProfile, TConfig>]`:
- `LambdaFunctionConstructPropsProfile` + `LambdaFunctionConstructPropsConfig(LambdaFunctionConstructPropsOptions)` (`[Flags]`: `OtelLayer`, `Permissions`, `FunctionUrl`)
- `StaticSiteConstructPropsProfile` + `StaticSiteConstructPropsConfig(StaticSiteConstructPropsOptions)` (`ApiDomain`, `AlternateDomains`)
- `CognitoUserPoolConstructPropsProfile` + its config (branding on/off)
- `DynamoDbTableConstructPropsProfile`, `WebFunctionConstructPropsProfile` (no per-test configuration)

**Test Customizations**:
- `LambdaFunctionConstructCustomization`: Configures realistic test data for Lambda constructs
- `WebFunctionConstructCustomization`: Configures realistic test data for Web Function constructs
- `StaticSiteConstructCustomization`: Configures realistic test data for static site constructs
- Supports parameterized test scenarios for Lambda (OTEL layer on/off, permissions included/excluded) and static sites (API domain on/off, alternate domains included/excluded)
Example:
```csharp
[Theory]
[Compose<LambdaFunctionConstructPropsProfile, LambdaFunctionConstructPropsConfig>(LambdaFunctionConstructPropsOptions.Permissions)]
public void Construct_ShouldCreateLambdaFunction(LambdaFunctionConstructProps props) { ... }
```

### Test Data Strategy
- Uses AutoFixture with custom configurations for realistic AWS resource names
- Behavior-defining values (resource names, domains, asset paths) are visible literals in the profiles. Incidental values (for example Lambda memory and timeout, Web Function log levels) are generated deterministically from the composition context, within valid AWS ranges.
- The props members are optional (non-`required`), which Compono's generated plans do not populate, so each profile registers a factory; the reason is documented in each profile.
- Load the Compono consumer skill before changing these tests; never reintroduce AutoFixture or reflection-based workarounds.
- Test assets include `test-lambda.zip` for Lambda deployment packages and `static-site/` folder for static site assets
- Tests verify both resource creation and property configuration
- Supports parameterized scenarios for both Lambda (OTEL layer on/off, permissions included/excluded) and static sites (API domain on/off, alternate domains included/excluded)

### Testing Helpers (`src/LayeredCraft.Cdk.Constructs/Testing/`)
The library includes comprehensive testing helpers for consumers:
Expand Down Expand Up @@ -214,7 +217,7 @@ The library includes comprehensive testing helpers for consumers:
## Development Practices

### Code Style
- C# 12+ features enabled (records, required properties, collection expressions)
- `LangVersion` default: the C# version the SDK selects for each target framework (records, required properties, collection expressions)
- Nullable reference types enabled
- Implicit usings enabled
- Uses `required` properties for mandatory configuration
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>2.4.0</VersionPrefix>
<VersionPrefix>3.0.0</VersionPrefix>
<!-- SPDX license identifier for MIT -->
<PackageLicenseExpression>MIT</PackageLicenseExpression>

Expand Down
14 changes: 5 additions & 9 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup Label="Build">
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="10.0.402" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="11.0.100" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.12.0" />
</ItemGroup>
<ItemGroup Label="AWS">
<PackageVersion Include="Amazon.CDK.Lib" Version="2.274.0" />
<PackageVersion Include="Amazon.CDK.Lib" Version="2.278.0" />
</ItemGroup>
<ItemGroup Label="Testing">
<PackageVersion Include="AutoFixture" Version="4.18.1" />
<PackageVersion Include="AutoFixture.AutoNSubstitute" Version="4.18.1" />
<PackageVersion Include="AutoFixture.Xunit3" Version="4.19.0" />
<PackageVersion Include="Compono" Version="1.4.0" />
<PackageVersion Include="Compono.XunitV3" Version="1.4.0" />
<PackageVersion Include="AwesomeAssertions" Version="9.6.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.11.0" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="xunit.v3.mtp-v2" Version="3.2.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
<PackageVersion Include="xunit.v3.mtp-v2" Version="4.0.3" />
</ItemGroup>
</Project>
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public class MyStack : Stack
}
```

> **Compatibility:** Lambda Web Functions require **`Amazon.CDK.Lib` 2.274.0 or later** and a Region where the feature is available. `IamAuth` endpoints are invoked by signed (SigV4) callers; `ApplicationManaged` endpoints are publicly reachable, including behind CloudFront.
> **Compatibility:** Lambda Web Functions require **`Amazon.CDK.Lib` 2.278.0 or later** and a Region where the feature is available. `IamAuth` endpoints are invoked by signed (SigV4) callers; `ApplicationManaged` endpoints are publicly reachable, including behind CloudFront. `Amazon.CDK.Lib` 2.278.0 declares types with the same names as this library's `IWebFunctionEndpoint` (namespace `LayeredCraft.Cdk.Constructs`) and its `WebFunctionCode`, `WebFunctionRuntime`, `WebFunctionAuthType`, `WebFunctionEndpointType`, `WebFunctionEndpointOptions`, `IWebFunctionEndpointOptions` and `WebFunctionEndpointAttributes`; a file that imports `Amazon.CDK.AWS.Lambda` together with `LayeredCraft.Cdk.Constructs` or `LayeredCraft.Cdk.Constructs.Models` must disambiguate, for example `using WebFunctionCode = LayeredCraft.Cdk.Constructs.Models.WebFunctionCode;`.

## Documentation

Expand All @@ -139,8 +139,8 @@ public class MyStack : Stack

## Requirements

- **.NET 8.0** or **.NET 9.0**
- **AWS CDK v2** (Amazon.CDK.Lib 2.274.0+)
- **.NET 10** or **.NET 11**
- **AWS CDK v2** (Amazon.CDK.Lib 2.278.0+)
- **AWS CLI** configured with appropriate permissions
- **Node.js** (for CDK deployment)

Expand All @@ -162,9 +162,11 @@ dotnet restore
dotnet build

# Run tests
dotnet run --project test/LayeredCraft.Cdk.Constructs.Tests/ --framework net8.0
dotnet run --project test/LayeredCraft.Cdk.Constructs.Tests/ --framework net10.0
```

The repository pins the .NET SDK to `11.0.100` (with `rollForward: latestFeature`) in `global.json`.

### Code Style

- Follow C# coding conventions
Expand Down
9 changes: 6 additions & 3 deletions docs/constructs/web-function.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ It is intentionally workload-neutral: Next.js, ASP.NET Core, and Blazor Static S

!!! info "Lambda Web Functions are a new AWS feature"
CloudFormation exposes them as `AWS::Lambda::WebFunction`, `WebFunctionRevision`, `WebFunctionEndpoint`, and
`AWS::Lambda::ResourcePolicy`. AWS CDK 2.274.0 has only L1 support; this construct wraps the L1s with secure
wiring, synthesis-time validation of invalid combinations, and CDK-idiomatic grants.
`AWS::Lambda::ResourcePolicy`. This construct is built directly on those CloudFormation L1 resources, wrapping
them with secure wiring, synthesis-time validation of invalid combinations, and CDK-idiomatic grants.
`Amazon.CDK.Lib` 2.278.0 also ships its own L2 Web Function constructs in `Amazon.CDK.AWS.Lambda`; how this
construct relates to them is being evaluated in the 3.0.0 design.

## :rocket: Features

Expand Down Expand Up @@ -35,7 +37,8 @@ It is intentionally workload-neutral: Next.js, ASP.NET Core, and Blazor Static S

## Prerequisites

- **AWS CDK for .NET 2.274.0 or later** (`Amazon.CDK.Lib`). This release adds the enum values the construct needs for OAC signing.
- **AWS CDK for .NET 2.278.0 or later** (`Amazon.CDK.Lib`). This release provides the enum values the construct needs for OAC signing.
- **Name disambiguation.** `Amazon.CDK.Lib` 2.278.0 declares types with the same names as this library's `IWebFunctionEndpoint` (namespace `LayeredCraft.Cdk.Constructs`) and its `WebFunctionCode`, `WebFunctionRuntime`, `WebFunctionAuthType`, `WebFunctionEndpointType`, `WebFunctionEndpointOptions`, `IWebFunctionEndpointOptions` and `WebFunctionEndpointAttributes`. A file that imports `Amazon.CDK.AWS.Lambda` together with `LayeredCraft.Cdk.Constructs` or `LayeredCraft.Cdk.Constructs.Models` must disambiguate, for example `using WebFunctionCode = LayeredCraft.Cdk.Constructs.Models.WebFunctionCode;`.
- A region where Lambda Web Functions are available.
- A **versioned** S3 bucket that holds the application zip, and an artifact uploaded before you deploy.
- `aws-cdk` bootstrapped in the account/region if you use CDK assets elsewhere in the same app.
Expand Down
Loading