diff --git a/.beads/.gitignore b/.beads/.gitignore index d9b3882..763e3e5 100644 --- a/.beads/.gitignore +++ b/.beads/.gitignore @@ -83,3 +83,8 @@ bd.db # They would override fork protection in .git/info/exclude. # Config files (metadata.json, config.yaml) are tracked by git by default # since no pattern above ignores them. + +# Beads records live in the Dolt database, synchronized through refs/dolt/data +# (bd dolt push / bd dolt pull). JSONL exports are local interchange files only. +issues.jsonl +events.jsonl diff --git a/.beads/config.yaml b/.beads/config.yaml index 049b3dc..966f805 100644 --- a/.beads/config.yaml +++ b/.beads/config.yaml @@ -75,7 +75,3 @@ sync: remote: "git+ssh://git@github.com/LayeredCraft/cdk-constructs.git" dolt: auto-push: false -export: - auto: true - git-add: false -no-git-ops: true diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl deleted file mode 100644 index 6365b52..0000000 --- a/.beads/issues.jsonl +++ /dev/null @@ -1,39 +0,0 @@ -{"_type":"issue","id":"cdkc-18e.18.5","title":"#104 P: PR review, merge, and verified 2.6.0-preview.N publication for Sharedale #162","description":"Objective: land LayeredCraft/cdk-constructs#104 on main through the established review process and make it available\nto sharedale/sharedale#162 as a verified, published `2.6.0-preview.N` NuGet package. Each step needs maintainer\nauthorization (commit/push/PR/merge are not implied by earlier beads).\n\nSteps:\n1. PR from a feature branch (conventional title, e.g. `feat(web-function): manage .local companion log group`;\n pr-title-check.yaml). Body: summary, closes #104, design revision 5 link, golden diff summary, sandbox evidence\n (cdkc-18e.18.4), the binary-compat note (D2), and the Sharedale #162 handoff.\n2. CI green on the final head (pr-build.yaml: build + tests net8.0-net11.0 + 80% coverage).\n3. Codex PR review, then targeted follow-up reviews after each fix round, until no actionable findings remain (same\n process as #103). Record each round and disposition in notes. Re-run CI after fixes.\n4. Merge to main (maintainer). Merge includes src/ changes, so Publish Preview triggers (publish-preview.yaml:\n push to main, paths-ignore docs/**, README.md, ROADMAP.md, mkdocs.yml, requirements.txt; reusable\n LayeredCraft/devops-templates publish-preview.yml@v10.8 + nuget-push). Use workflow_dispatch only if the push run\n did not trigger.\n5. Verify the actual published version from the run (gh run view \u003cid\u003e --log | grep version / nuget push output). Do\n NOT assume `.28`: the suffix comes from the automation and any other main push (e.g. Dependabot) also publishes.\n6. Verify on nuget.org: https://api.nuget.org/v3-flatcontainer/layeredcraft.cdk.constructs/index.json lists the\n version; download the .nupkg and confirm the new API is present (e.g. inspect the assembly/XML doc for the\n companion-retention parameter on WebFunctionLogs.Create and the new assertions), and the nuspec still requires\n Amazon.CDK.Lib \u003e= 2.274.0.\n7. Confirm availability from the feed Sharedale consumes (nuget.org; `dotnet package search\n LayeredCraft.Cdk.Constructs --prerelease --exact-match` or a scratch restore outside both repos).\n8. Record the exact version in this bead, cdkc-18e.18, and cdkc-18e.17 notes. Comment on LayeredCraft#104 with the\n version if the maintainer approves (do NOT edit Sharedale issues; the Sharedale maintainer picks it up in #162).\n\nHandoff: sharedale/sharedale#162 cannot begin its construct migration until step 7 passes. Stable 2.6.0 is NOT\npublished here; it stays gated by cdkc-18e.17 (Sharedale Milestone 12 validation + explicit maintainer approval).\n","acceptance_criteria":"- PR merged to main; CI green on the merged head; Codex review rounds recorded with no open actionable findings.\n- Publish Preview run succeeded; exact `2.6.0-preview.N` version recorded with the run ID.\n- Package on nuget.org verified to contain the #104 API; CDK floor unchanged.\n- Version resolvable from nuget.org (feed used by Sharedale); recorded on cdkc-18e.18 and cdkc-18e.17.\n- GitHub issue #104 closed (by PR or maintainer). No stable release, tag, or publish-release run performed.","notes":"RESOLVED 2026-10-27. PR #105 (feat(web-function): manage .local companion log group) merged to main via squash; Closes #104 (GitHub issue auto-closed, stateReason COMPLETED, 2026-10-27T11:59:09Z).\n- Merge commit: 63db9b16a213f7c7ac46a3d97cee3ccbd8c7dc1e (single parent d647ad8, linear history preserved; merged by ncipollina 2026-10-27T11:59:07Z).\n- CI green on merged head 63db9b1: build / build, build, Analyze (csharp), Analyze (javascript-typescript), validate / validate.\n- Codex review rounds (recorded): (1) automatic initial review on 586486d = 1 P2 finding (sandbox README delivery step did not drive Use-mode traffic, so --expect-delivery could not pass on a fresh sandbox); (2) targeted follow-up on c93c42a = new P2 (the added signed-request step omitted the required x-amz-content-sha256: UNSIGNED-PAYLOAD header), the original finding no longer inline; (3) targeted follow-up on 1154205 = has_any_findings:false (receipt \"Codex Review: Didn't find any major issues. Hooray!\"). Fixes: c93c42a (AppStack.cs Use-mode URL outputs + README 5c/5d invocation step), 1154205 (README signed requests add UNSIGNED-PAYLOAD header and surface HTTP status). No open actionable findings remain. The github-code-quality \"missed opportunity to use Where\" nit was reviewed and deemed a non-actionable style preference.\n- Publish Preview run 40500237868 (event push on 63db9b1) = completed/success (jobs build/publish and push succeeded). Exact published version: 2.6.0-preview.28.\n- nuget.org: flatcontainer index lists 2.6.0-preview.28; nupkg 390064 bytes; nuspec \u003cversion\u003e2.6.0-preview.28\u003c/version\u003e with Amazon.CDK.Lib dependency 2.274.0 for net8.0/net9.0/net10.0/net11.0 (CDK floor unchanged).\n- Shipped net8.0 assembly contains the companion logging APIs: WebFunctionLogs, WebFunctionLogsCreate, WebFunctionLogsUse, WebFunctionLogsServiceDefault, CompanionRetention, LocalLogGroup, ShouldHaveCompanionLogGroup, ShouldHaveWebFunctionLogGroup, ShouldHaveRevisionDependingOnLogGroups.\n- Feed resolvability (feed Sharedale consumes): scratch net8.0 class library outside both repos restored LayeredCraft.Cdk.Constructs 2.6.0-preview.28 from nuget.org and built with 0 warnings/0 errors.\n- No stable release, tag, or publish-release run was performed. cdkc-18e.17 and cdkc-18e.18 remain OPEN. Published version recorded on cdkc-18e.18 and cdkc-18e.17.","status":"closed","priority":1,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-26T15:33:15Z","created_by":"Nick Cipollina","updated_at":"2026-10-27T12:08:49Z","started_at":"2026-10-27T11:26:21Z","closed_at":"2026-10-27T12:08:49Z","close_reason":"All acceptance criteria met. PR #105 merged to main (squash commit 63db9b1, linear history); required CI green on merged head (build / build, build, Analyze (csharp), Analyze (javascript-typescript), validate / validate). Codex review loop clean: automatic initial review + two targeted follow-ups on c93c42a and 1154205; final review on 1154205 reported no actionable findings. Publish Preview run 40500237868 succeeded and published exact version 2.6.0-preview.28 to nuget.org, verified to contain the #104 companion log-group APIs (WebFunctionLogsCreate.Use companionRetention, WebFunctionLogs.Use companion, LocalLogGroup, new assertions) with CDK floor unchanged (Amazon.CDK.Lib 2.274.0) and resolvable from nuget.org. GitHub issue #104 closed (COMPLETED). No stable release, tag, or publish-release run performed; cdkc-18e.17 and cdkc-18e.18 kept OPEN.","external_ref":"gh-104","labels":["gh-104","lambda-web-functions","logging","release"],"dependencies":[{"issue_id":"cdkc-18e.18.5","depends_on_id":"cdkc-18e.18","type":"parent-child","created_at":"2026-10-26T15:33:15Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.18.5","depends_on_id":"cdkc-18e.18.2","type":"blocks","created_at":"2026-10-26T15:33:15Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.18.5","depends_on_id":"cdkc-18e.18.3","type":"blocks","created_at":"2026-10-26T15:33:15Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.18.5","depends_on_id":"cdkc-18e.18.4","type":"blocks","created_at":"2026-10-26T15:33:15Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":3,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.18.4","title":"#104 S: AWS sandbox validation of companion log-group retention (requires maintainer authorization)","description":"Objective: deployed validation of LayeredCraft/cdk-constructs#104 in the existing Web Functions sandbox\n(samples/web-functions/sandbox; design §19.1 style). REQUIRES explicit maintainer authorization and maintainer-provided\nNON-PRODUCTION credentials. Do not start without both. Reuse the existing deploy.sh/smoke.sh/destroy.sh flow; do not\nbuild a new sandbox framework.\n\nPreparation (no deploy): add a small log-group check to the sandbox scripts (e.g. smoke.sh/destroy.sh or a helper in\ncommon.sh) using `aws logs describe-log-groups --log-group-name-prefix /aws/lambda/web/` that prints name,\nretentionInDays, and storedBytes for each sandbox function. Configure at least one function with non-default\nretention for both groups. Pre-check that no `{name}` / `{name}.local` groups exist from earlier runs.\n\nVerify and record (date, Region, CDK/CLI version, library commit, function names, revision IDs, command output):\n1. Immediately after deploy and BEFORE traffic: both groups exist, created by CloudFormation, with configured retention.\n2. After real requests: both groups still have the configured retention (companion NOT unlimited); events reach the\n centralized group; `.local` holds the same events.\n3. No other `.local` group appears for the sandbox functions (e.g. none without retention, none under another name).\n4. Use-mode path if the sandbox exercises it (otherwise record \"not verified\").\n5. Teardown: destroy.sh removes both groups (DESTROY); confirm Lambda does not recreate `.local` after stack deletion\n (re-check after a few minutes); record any leftover and clean it by exact name.\nRecord results in notes and in the implementation PR description (#104 acceptance criterion).\nIf any check fails: record it, file a bug bead linked to cdkc-18e.18.2, leave this bead open.\nExclusions: production accounts, Sharedale resources, publishing, multi-Region deployment.\n","acceptance_criteria":"- Checks 1-3 and 5 PASS on live AWS with evidence in notes; check 4 PASS or explicitly \"not verified\".\n- Sandbox fully torn down and verified (no stacks, buckets, roles, distributions, log groups left).\n- Results summary pasted into the #104 implementation PR description.","notes":"2026-10-26 (rev-5 design): in addition to the existing checks, if a supplied-role + Use(custom group) scenario is exercised, confirm the construct's '.local' statement (logs:CreateLogGroup/CreateLogStream/PutLogEvents on arn:*:logs:*:{acct}:log-group:{name}.local:*) is sufficient for delivery; otherwise record 'not verified'. Existing requirements unchanged.\n2026-10-26 (rev 5 written): SUPERSEDES the earlier note's single-statement IAM wording. Design §19.1 item 3.9 is now the authoritative companion checklist. Required: before traffic both groups exist with configured retention; after traffic retention unchanged (companion not unlimited) and events in centralized group; no other .local group; a supplied-role Use(custom) function WITHOUT companion delivers logs (exercises G1 + documented-format G2 CreateLogGroup ARN; else record 'not verified' = G2 ARN form unverified); teardown removes managed groups, no recreation, service-created groups from the Use scenario deleted by exact name. All earlier requirements preserved.\n2026-10-27 (live AWS validation COMPLETE - authorized sandbox wft7d): STS identity arn:aws:iam::403542860824:user/terraform-user; region us-east-1; namespace lccdk-wf-sandbox. Stacks lccdk-wf-sandbox-wft7d-{artifacts,external,app} CREATE_COMPLETE. Functions nextjs/aspnetcore/blazor/uselogs/usecompanion Active; revisions rev-ejzpw/rev-gy57c/rev-j19du (smoke) and manual traffic to uselogs/usecompanion 2x HTTP 200 each.\n\nVALIDATION MATRIX (A-G):\nA Managed groups/retention PASS: 10/10 groups present pre- and post-traffic with configured retentions 14/3, 14/3, 30/1, 7/none, 14/3; CFN-owned groups match app stack; managed companions created by CFN and present in DependsOn of each revision. Pre-traffic verify exit 0 (phase pre-traffic).\nB Log delivery PASS: every one of the 10 groups held recent events via logs filter-log-events (4h lookback); no extra sandbox group; centralized and .local both delivered. Live ./verify-log-groups.sh --expect-delivery =\u003e PASS=31 FAIL=0 SKIP=0 BLOCKED=0. Note: storedBytes reported 0 for all groups despite events; storedBytes is NOT a valid delivery signal (harness bug fixed).\nC Use-mode G1/G2 PASS: UseLogs runs with caller-supplied role UseLogsRoleD18EB0C3-uQdw2Y8zm5IN; inline policy statements confirmed in real IAM: logs:CreateLogStream/PutLogEvents on arn:aws:logs:us-east-1:403542860824:log-group:/lccdk-wf-sandbox/wft7d-uselogs:* ; same actions on arn:aws:logs:us-east-1:403542860824:log-group:/lccdk-wf-sandbox/wft7d-uselogs.local:log-stream:* ; logs:CreateLogGroup on arn:aws:logs:us-east-1:403542860824:log-group:/lccdk-wf-sandbox/wft7d-uselogs.local (G2 ARN form CONFIRMED, no :* suffix). AWS accepted the narrowly scoped CreateLogGroup during actual Lambda creation; the group is NOT in the app stack's 9 AWS::Logs::LogGroup resources. G1 delivery confirmed by events in both groups.\nD Supplied companion PASS: UseCompanion supplies both groups; role UseCompanionRole462AA494-vlHdMSBgaCuT with G1-only statements (no CreateLogGroup); no duplicate group; supplied retentions preserved; delivery confirmed. Imported/supplied resources correctly not asserted CFN-owned.\nE Warnings PASS/SKIP: W1 @layeredcraft/cdk-constructs:webFunctionUnmanagedCompanionLogGroup emitted for UseLogs and captured from cdk.out metadata (build/synth-warnings-wft7d.json). W2 remote-Region warning SKIPPED: no PerRegion/MultiRegion endpoint deployed; extra regions intentionally not deployed per authorization.\nF AlreadyExists collision OPTIONAL/SKIP: not run; scope not expanded.\nG Teardown PASS: SANDBOX_CONFIRM_DESTROY=wft7d ./destroy.sh --yes =\u003e exit 0; app/external/artifacts stacks destroyed and confirmed absent; buckets emptied and deleted; service-created /lccdk-wf-sandbox/wft7d-uselogs.local removed by exact name and confirmed gone. Independent post-destroy verification (build/post-destroy-verification.json): all 3 stacks absent, both buckets 404, zero wft7d Lambda functions/web functions, zero wft7d IAM roles/policies, no CloudFront distribution/OAC references, all 10 log groups absent, prefix scan empty. Delayed recheck after 180s (build/post-destroy-recheck.json): no wft7d log groups/.local groups/layers recreated.\n\nIAM/CFN EVIDENCE: G2 identity statement exactly as documented; UseLogs revision depends only on central group; managed revisions depend on both groups. W1 warning ack ID captured. Evidence paths: build/log-delivery-evidence.json, build/verify-delivery-events-fix.log, build/log-group-summary.json, build/synth-warnings-wft7d.json, build/destroy-wft7d.log, build/post-destroy-verification.json, build/post-destroy-recheck.json; offline suites build/run-scenarios-events-fix.log (110 pass) and build/run-smoke-events-fix.log (44 pass).\n\nACCEPTANCE: checks 1-3 and 5 PASS with live evidence; check 4 (Use-mode path) PASS; sandbox fully torn down and independently verified. The \"results summary in #104 implementation PR description\" bullet is deferred to cdkc-18e.18.5 because this authorization forbids creating/pushing a PR; the summary above is ready to paste there. No production-code defect found; the only defect was the sandbox verification script's storedBytes delivery check, now fixed and revalidated offline + live.\nHarness state-isolation follow-up (offline suites; no production-construct code touched).\n\nROOT CAUSE: both offline suites shared sandbox state with the real deployment under samples/web-functions/sandbox/build/ — artifacts.json (manifest), smoke-summary.json, revision-state.json, .smoke/, .verify-log-groups/, log-group-summary.json. The smoke suite's fresh_state deletes the shared manifest/summary, so running the suites concurrently (or after a torn-down deployment whose manifest was removed) corrupted each other's prerequisites and produced non-deterministic failures (post-teardown: run-scenarios 106/110, smoke 42/44; parallel: 108/110, 41/44). No production-construct defect.\n\nCORRECTION: added an overridable SANDBOX_STATE_DIR to common.sh (default ${SANDBOX_DIR}/build, so real-deployment behavior is unchanged) and routed all sandbox-local state through it: MANIFEST_FILE (common.sh), SMOKE_TMP + smoke-summary.json (smoke.sh), VG_TMP + log-group-summary.json (verify-log-groups.sh), revision-state.json + smoke-summary.json (run-workflow.sh). Both offline suites now allocate a private mktemp -d state dir and remove it on exit, isolating fixtures from deployment state and from each other.\n\nVERIFICATION (offline, stubbed aws/cdk; no AWS credentials or mutations): run-scenarios.sh = 110 passed/0 failed and run-smoke-scenarios.sh = 44 passed/0 failed in EVERY configuration tested — concurrent, scenarios-then-smoke, smoke-then-scenarios, and with build/artifacts.json removed beforehand. Real build/ state is untouched after runs (manifest stayed absent, proving isolation). Guarded teardown unchanged (destroy.sh not modified).","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-26T15:32:55Z","created_by":"Nick Cipollina","updated_at":"2026-10-27T11:22:38Z","closed_at":"2026-10-27T01:57:36Z","close_reason":"Live AWS validation in authorized sandbox wft7d passed all mandatory checks (A-E, G) with real AWS evidence; sandbox fully torn down and independently verified absent including the service-created .local group. PR-description summary deferred to cdkc-18e.18.5 because PR creation/push is not authorized.","external_ref":"gh-104","labels":["gh-104","lambda-web-functions","logging","sandbox"],"dependencies":[{"issue_id":"cdkc-18e.18.4","depends_on_id":"cdkc-18e.18","type":"parent-child","created_at":"2026-10-26T15:32:55Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.18.4","depends_on_id":"cdkc-18e.18.2","type":"blocks","created_at":"2026-10-26T15:32:55Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.18.2","title":"#104 I: Implement companion log group, dependencies, IAM, warnings, assertions, tests and goldens","description":"Objective: implement design revision 5 (spec: docs/designs/lambda-web-functions-integration.md rev 5, §8.3 #revision-5-companion-local-log-groups-104; summary in cdkc-18e.18.1 DESIGN) for\nLayeredCraft/cdk-constructs#104, test-first (RED -\u003e GREEN), including XML docs, public Testing assertions, and golden\ntemplates. Do not start until revision 5 is written and approved (cdkc-18e.18.1 notes).\n\nScope (file : change):\n- Models/WebFunctionLogs.cs : Create(retention, removalPolicy, companionRetention = null -\u003e THREE_DAYS);\n Use(logGroup, companion = null) with literal-name validation (ArgumentException \"companion\"); internal\n CompanionRetention / Companion; XML docs for all three factories (two groups, duplication, short companion retention,\n ServiceDefault = both service-created, unlimited retention, outlive the stack).\n- WebFunctionConstruct.cs ResolveLogs (~L211) / ctor (~L55-97):\n * Create: child \"LocalLogGroup\" named $\"{group.LogGroupName}.local\", companionRetention, same RemovalPolicy.\n * Public ILogGroup? LocalLogGroup.\n * Ordering: revision Node.AddDependency on both managed groups; in Use mode on each supplied group only when owned\n (Node.DefaultChild is CfnResource) and in the same Stack. No cross-stack/imported dependencies.\n * IAM (design rev 5 §8.3 'Execution-role permissions'): trigger unchanged (ShouldGrantWrite). Keep\n logGroup.GrantWrite(Role). Add via Grant.AddToPrincipal: G1 CreateLogStream+PutLogEvents on\n arn:{p}:logs:{R}:{acct}:log-group:{name}.local:log-stream:*; G2 CreateLogGroup on\n arn:{p}:logs:{R}:{acct}:log-group:{name}.local only when no companion is supplied or any PerRegion/MultiRegion\n endpoint exists (G2 added at most once, guarded by a private flag: in the ctor, or by CreateEndpoint the first\n time a PerRegion/MultiRegion endpoint is created). R = one Lazy.String with a private DeputyBase-derived\n IStableStringProducer reading a private \"has non-home endpoint\" flag: '*' or Stack.Of(this).Region. Resolved\n at synthesis, so AddEndpoint after construction widens the already-added G1; never mutate a rendered policy or\n an added PolicyStatement (design rev 5 §8.3 'Mechanism'). Stack.FormatArn(COLON_RESOURCE_NAME). Never CreateLogGroup on the centralized\n group, logs:*, or log-group:*. Created-role managed policy unchanged; immutable roles not mutated; GrantInvoke\n classification untouched.\n * W1 AddWarningV2(\"@layeredcraft/cdk-constructs:webFunctionUnmanagedCompanionLogGroup\", ...) for Use w/o companion.\n- WebFunctionEndpointConstruct.cs (~L31) + WebFunctionConstruct.CreateEndpoint (~L156): W2\n AddWarningV2(\"@layeredcraft/cdk-constructs:webFunctionRemoteCompanionLogGroups\", ...) on PerRegion/MultiRegion\n endpoints (default + AddEndpoint) with the mode-specific suffix; logging mode passed internally. No diagnostics framework.\n- Models/WebFunctionValidation.cs (~L50): reserve \"LocalLogGroup\".\n- Testing/WebFunctionConstructAssertions.cs: ShouldHaveLogGroup(name, retentionDays),\n ShouldHaveCompanionLogGroup(centralizedName, retentionDays), ShouldHaveRevisionDependingOnLogGroups(functionName,\n params logGroupNames); match by name; XML docs; existing assertion signatures unchanged.\n- Tests: exactly design rev 5 §15 (T1–T11, P1–P15, Wa–Wg; P11–P15 are the configuration-order regression tests: HomeRegion default + later AddEndpoint(PerRegion) and AddEndpoint(MultiRegion) -\u003e Region '*', exactly one G1 and one G2; several non-home endpoints -\u003e no duplicates; AddEndpoint(HomeRegion) keeps stack Region; env-agnostic -\u003e Ref AWS::Region/AccountId; imported immutable role + non-home AddEndpoint -\u003e no IAM policy, no exception), plus positive/negative tests for each new\n assertion. Place in WebFunctionConstructTests / WebFunctionSecurityTests (permissions) / new tests as fits.\n- Goldens: regenerate with UPDATE_GOLDEN_TEMPLATES=1 and review every diff: Create goldens gain only the .local group\n + DependsOn; web-function-use-log-group gains revision DependsOn on its same-stack group + the companion statement\n in the supplied role's policy. Existing-construct goldens: zero diff (no regeneration).\n\nRisk to verify, not assume: G2 uses the documented log-group ARN format (no ':*'); sandbox check 3.9\n(cdkc-18e.18.4) confirms. If revision-5 review changes this, follow the doc.\n\nExclusions: user docs/CHANGELOG (cdkc-18e.18.3); sandbox (cdkc-18e.18.4); no cross-Region resources, custom\nresources, adoption/import of existing groups, new NuGet deps, reflection; centralized default name/retention unchanged.\n","acceptance_criteria":"- Default Create synthesizes exactly two AWS::Logs::LogGroup (`/aws/lambda/web/{fn}` 14 days, `.local` 3 days), both\n Delete by default; revision DependsOn both (T1, T3).\n- Companion retention independent; removal policy inherited; tokenized names produce Fn::Join (T2, T4).\n- Use contract: optional companion, name validation, W1 when absent, same-stack-only dependencies (T6–T9).\n- ServiceDefault unchanged in template; XML docs updated (T10).\n- IAM: P1–P15 pass, including the explicit configuration-order regressions P11–P15 (HomeRegion default then\n AddEndpoint(PerRegion|MultiRegion) yields Region '*' G1 and G2 in the final template, no duplicates; immutable\n imported roles never mutated); the only new statements are G1 (.local log-stream write) and G2 (.local CreateLogGroup, only when\n Lambda may create it), Region = stack Region or '*' with PerRegion/MultiRegion; CdkUpgradeGuard_* unchanged and passing.\n- W1/W2 per Wa–Wg: conditions, no HomeRegion warning, stable ids, warning-level (strict), acknowledgement.\n- \"LocalLogGroup\" reserved (T11). New assertions public, XML-documented, positive+negative tested.\n- Golden diffs reviewed, limited to the intended Web Function changes; existing-construct goldens zero diff.\n- Gates: dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release (0 warnings); dotnet test --solution\n LayeredCraft.Cdk.Constructs.slnx -c Release on net8.0-net11.0; coverage \u003e= 80%. Evidence in notes.","notes":"Implemented companion (.local) log groups per design rev5.\n\nProduction: Models/WebFunctionLogs.cs (Create(...,companionRetention=null-\u003eTHREE_DAYS); Use(logGroup,companion=null) literal-name validation ArgumentException param \"companion\"; internal CompanionRetention/Companion; XML docs). WebFunctionConstruct.cs (LocalLogGroup child + public ILogGroup? LocalLogGroup; revision DependsOn both managed groups / owned same-stack Use groups only; IAM G1 (CreateLogStream+PutLogEvents on {name}.local:log-stream:*) always, G2 (CreateLogGroup on {name}.local) when no companion or any PerRegion/MultiRegion endpoint; single Lazy region producer widening to \"*\" at synthesis; W1). WebFunctionEndpointConstruct.cs (W2 on PerRegion/MultiRegion). Models/WebFunctionValidation.cs (reserved child id LocalLogGroup). Testing/WebFunctionConstructAssertions.cs (ShouldHaveLogGroup, ShouldHaveCompanionLogGroup, ShouldHaveRevisionDependingOnLogGroups).\n\nTests: NEW WebFunctionCompanionLogGroupTests.cs (36 tests: T1-T11, P1-P15, Wa-Wg). Updated WebFunctionConstructTests.cs (Create now 2 log groups), WebFunctionSecurityTests.cs (reserved-id theory + LocalLogGroup), TestingHelpersTests.cs (disambiguated pre-existing Lambda ShouldHaveLogGroup).\n\nGoldens: regenerated 6 Create goldens (add .local LogGroup + revision DependsOn) and web-function-use-log-group.json (revision dep on same-stack group + G1/G2 in supplied role policy). application-managed + all 17 existing-construct goldens byte-identical.\n\nValidation: Release build 0 warnings/0 errors on net8.0/net9.0/net10.0/net11.0; full suite 574 passed / 0 failed / 0 skipped on each TFM; Web Function golden tests 8/8.\n\nCoverage: 80% gate enforced by CI (pr-build.yaml coverageThreshold 80). NOT locally measurable: MTP CodeCoverage 18.12.0 hook is registered (SelfRegisteredExtensions.cs) but its --coverage option is not exposed under Microsoft.Testing.Platform 2.5.0; dotnet-coverage 18.12.0 collects nothing on this osx-arm64 machine (even a trivial console app yields empty cobertura); VSTest-bridge route failed. Not claimed as PASS.\n\nNuances vs rev5: (1) companion name derived from the centralized group configured name string (literal for literal FunctionName, Fn::Join for token) instead of the L2 LogGroup.LogGroupName (always a CFN token) so T1/T4 hold; (2) new ShouldHaveLogGroup collides with pre-existing LambdaFunctionConstructAssertions.ShouldHaveLogGroup - both kept public, existing Lambda call site disambiguated.\nREVIEW CORRECTIONS (independent review of f411074; reopened and re-closed). Claude Code found deficiencies in public API compatibility, testing, token handling, IAM lazy resolution, and companion-name validation. Resolutions:\nD1 (API clash): renamed new assertion ShouldHaveLogGroup -\u003e ShouldHaveWebFunctionLogGroup in src/Testing/WebFunctionConstructAssertions.cs; kept published LambdaFunctionConstructAssertions.ShouldHaveLogGroup unchanged; restored extension-method syntax template.ShouldHaveLogGroup(...) in Testing/TestingHelpersTests.cs; added consumer/negative tests. No CS0121 ambiguity.\nD2 (assertion tests): added 8 meaningful positive+negative tests for ShouldHaveWebFunctionLogGroup / ShouldHaveCompanionLogGroup / ShouldHaveRevisionDependingOnLogGroups in Testing/WebFunctionConstructTestingHelpersTests.cs (correct passes; wrong retention, missing group, missing companion, missing dependency all fail).\nD3 (token handling): W2 is token-safe -\u003e Token.IsUnresolved(EndpointName) ? 'this endpoint' : \"'name'\" in WebFunctionEndpointConstruct.cs; id unchanged; added tokenized-endpoint regression test (Wh) asserting no raw ${Token[ marker.\nD4 (IAM lazy resolution): replaced caching Lazy.String/IStableStringProducer with uncached Lazy.UncachedString/IStringProducer (Produce(IResolveContext)) in WebFunctionConstruct.cs (lines 64/365/373). Proven meaningful: reverting to the cached form makes P11b fail (region stays us-east-1 instead of widening to *). Added P11b [Theory] resolving the role policy before AddEndpoint for PerRegion/MultiRegion -\u003e final Region *, exactly one G1 and one G2, no duplicates.\nD5 (companion-name validation): WebFunctionLogs.ValidateCompanion now reads the underlying CfnLogGroup via the construct default child (Node.DefaultChild) for owned groups, else the L2 property; literal mismatch throws ArgumentException(param companion); tokens skipped. Added same-stack owned valid/invalid, imported valid/invalid, and tokenized tests. No reflection.\nD6 (vacuous test): ServiceDefault test now asserts Properties.ServiceConfig.TelemetryConfig is absent (was reading Properties.TelemetryConfig).\nStrengthened: P2/P4b/P16 assert exact synthesized actions and full ARN structure (Partition/Region/Account/name/:log-stream:* for G1, none for G2, exactly one CreateLogGroup, no duplicates); T8 asserts real revision DependsOn; T8b cross-stack owned group (no invalid explicit dependency, Fn::ImportValue intact); Wf ack-on-endpoint and ack-on-stack; Wh tokenized name.\nDesign errata A/B/C applied in place to docs/designs/lambda-web-functions-integration.md (revision 5 status/history retained; no revision 6).\nVALIDATION: Release build 0 warnings/0 errors on net8.0/net9.0/net10.0/net11.0. Full suite 590 tests / 0 failed / 0 skipped on EACH of the four TFMs. Coverage via 'dotnet test --project ... -f net8.0 -c Release --coverage --coverage-output-format cobertura --coverage-output cov.cobertura.xml' -\u003e line 94.46% (2573/2724), branch 86.28% (855/991), both \u003e=80%; per-class: WebFunctionConstruct 99.0%/97.5%, WebFunctionEndpointConstruct 100%, WebFunctionLogs 96.3%/87.5%, CompanionRegionProducer 100%, WebFunctionValidation 95.9%/93.6%, WebFunctionConstructAssertions 91.3%/78.6%. Web Function golden tests 8/8 pass (goldens UNCHANGED by the corrections); existing-construct goldens 17/17 unchanged (byte-identical). CORRECTED PRIOR CLAIM: the previous closed note said local coverage was not measurable; this round the exact item-11 command succeeded through the VSTest bridge and yields the numbers above.\nF1-F5 FOLLOW-UP CORRECTIONS (second independent review; bead kept CLOSED). Claude accepted D1-D6 and raised five minor findings:\nF1 (companion-name validation tests): added explicit T9 owned-group cases in WebFunctionCompanionLogGroupTests.cs -\u003e T9_Use_ShouldRejectOwnedLiteralCompanionNameMismatch (/custom/a + /custom/WRONG -\u003e ArgumentException param 'companion'), T9_Use_ShouldAcceptOwnedLiteralCompanionMatch (/custom/a + /custom/a.local), T9_Use_ShouldRejectOwnedCentralizedImportedCompanionMismatch (owned /custom/a + imported /custom/WRONG -\u003e throws), T9_Use_ShouldAcceptOwnedTokenizedNames (owned tokenized names accepted), T9_Use_ShouldAcceptUnnamedOwnedCompanion (unnamed owned companion accepted). These exercise the real ValidateCompanion path (via ResolveConfiguredName reading the CfnLogGroup default child) and fail if literal-name validation is removed or broken. Existing valid owned/imported cases still pass.\nF2 (assertion test specificity): WebFunctionConstructTestingHelpersTests.cs negative companion-helper tests now use specific FluentAssertions contracts (Throw\u003cInvalidOperationException\u003e().WithMessage(...)) instead of Throw\u003cException\u003e(): wrong retention expects '*RetentionInDays = 30*'; missing centralized expects '*No log group named ...'; wrong companion retention expects '*companion log group ...RetentionInDays = 14*'; missing companion expects '*No companion log group named ...local... was found*'; missing dependency expects '*revision for ... depend on the log group ...*'. Production exception behavior unchanged.\nF3 (vacuous T8b assertion): T8b cross-stack owned-group test now asserts the exact consumer-stack revision DependsOn set (BeEquivalentTo([functionId, roleId]), logical IDs resolved from synthesis) instead of NotContain; the Fn::ImportValue cross-stack reference check is retained. Fails if an unintended same-stack dependency is introduced.\nF4 (W2 wording): WebFunctionEndpointConstruct.cs endpointLabel is now token-safe and complete -\u003e Token.IsUnresolved(EndpointName) ? 'This endpoint' : \"Endpoint '{name}'\"; message uses the label without an extra 'Endpoint ' prefix, so unresolved renders 'This endpoint (PerRegion) runs requests...' and literal renders \"Endpoint 'default' (PerRegion) runs requests...\". Warning id, severity, condition, and acknowledgement unchanged; no raw unresolved token text. Tests updated: Wh asserts the message starts with 'This endpoint (PerRegion) runs requests in Regions other than the stack Region.' and contains no ${Token[ and no 'Endpoint This endpoint'; Wb additionally asserts literal names read as \"Endpoint '...'\".\nF5 (design wording): corrected Erratum B in docs/designs/lambda-web-functions-integration.md (Name rule and the errata addendum) to describe mode-specific derivation: Create mode from the configured centralized name used for the CFN resource; Use mode from the supplied group's LogGroupName property (which can be a Ref for a same-stack owned group); validation compares only provably literal names via the underlying CfnLogGroup; unresolved expressions are accepted, not rejected speculatively. Revision 5 remains approved; no revision 6. (Also corrected the §14 cross-reference anchor to #14-validation-and-error-handling.)\nVALIDATION (this round): Release build 0 warnings/0 errors (all four TFMs). Full suite 595 tests / 0 failed / 0 skipped on EACH of net8.0/net9.0/net10.0/net11.0 (was 590; +5 F1 tests). Coverage on net8.0: line 94.46% (2575/2726), branch 86.28% (855/991), both \u003e=80%. Web Function golden tests 8/8 pass; existing-construct golden tests 17/17 pass; JV golden files unchanged (git status on GoldenTemplates empty) -\u003e IAM policy output and template synthesis unchanged. Docs build (uv run mkdocs build --strict --clean) succeeds with no warnings. Public API unchanged (F4 edits a private method only).","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-26T15:32:28Z","created_by":"Nick Cipollina","updated_at":"2026-10-26T20:40:33Z","started_at":"2026-10-26T16:50:31Z","closed_at":"2026-10-26T19:36:09Z","close_reason":"Review corrections D1-D6 applied; design errata A/B/C recorded in rev5 doc. Build 0/0 on net8-11; 590 tests/0 failed/0 skipped on each TFM; coverage line 94.46% branch 86.28% (\u003e=80%); Web Function and existing-construct goldens unchanged. Reopened from the earlier close to capture the independent-review deficiencies and resolutions.","external_ref":"gh-104","labels":["core","gh-104","lambda-web-functions","logging"],"dependencies":[{"issue_id":"cdkc-18e.18.2","depends_on_id":"cdkc-18e.18","type":"parent-child","created_at":"2026-10-26T15:32:28Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.18.2","depends_on_id":"cdkc-18e.18.1","type":"blocks","created_at":"2026-10-26T15:32:28Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":2,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.18.1","title":"#104 D: Write design revision 5 (approved decisions) — companion log groups, IAM, ordering, warnings","description":"Objective: write the maintainer-approved #104 decisions (DESIGN field of this bead — authoritative content) into\ndocs/designs/lambda-web-functions-integration.md as revision 5, and obtain maintainer sign-off on the written revision.\n\nPREREQUISITE (repository rule): the design doc is the authoritative spec for epic cdkc-18e and changes only through a\nnumbered revision recorded in §21 (as revisions 2–4 did). Decisions D1–D10 were approved 2026-10-26, but\ncdkc-18e.18.2 and cdkc-18e.18.3 must not be claimed until revision 5 is written AND its text is approved.\n\nSections to update: header (status/date: \"Approved (revision 5)\"); §8.3 (WebFunctionLogs signatures, Create/Use\nsemantics, LocalLogGroup property, child-ID table row LocalLogGroup, reserved IDs, notes on ordering, IAM, AlreadyExists);\n§8.6 (three new assertions); §14 (Use companion-name validation); §15 (tests T1–T11, P1–P8, W-a/W-b); §17 (risks:\nnon-home-Region companions unmanaged, AlreadyExists on adoption, preview binary break, imported immutable roles);\n§19.1 (sandbox checks from cdkc-18e.18.4); §21 revision 5 entry listing D1–D10.\n\nExclusions: no code, tests, or user docs; centralized default name/retention unchanged; no cross-Region resources,\nadoption, or custom resources.\n","design":"AUTHORITATIVE SPEC: docs/designs/lambda-web-functions-integration.md revision 5 (written 2026-10-26, AWAITING maintainer\nreview of the written text). Main section: §8.3 \"Revision 5: companion (.local) log groups (#104)\"\n(#revision-5-companion-local-log-groups-104); also header, §8.3 code/child-ID table/reserved IDs, §8.6, §12.1, §13,\n§14, §15 (T1–T11, P1–P10, Wa–Wg), §16, §17, §19.1 item 3.9, §21 revision 5. If this field and the doc ever disagree, the doc wins.\n\nAPPROVED PUBLIC API (maintainer, 2026-10-26):\n public static WebFunctionLogs Create(RetentionDays? retention = null, RemovalPolicy? removalPolicy = null, RetentionDays? companionRetention = null);\n public static WebFunctionLogs Use(ILogGroup logGroup, ILogGroup? companion = null);\n public static WebFunctionLogs ServiceDefault();\n WebFunctionConstruct: public ILogGroup? LocalLogGroup { get; }\n Testing: ShouldHaveLogGroup(name, retentionDays), ShouldHaveCompanionLogGroup(centralizedName, retentionDays),\n ShouldHaveRevisionDependingOnLogGroups(functionName, params logGroupNames)\n Source compatible; binary incompatible with 2.6.0-preview.27 (recompile) — accepted.\n\nAPPROVED DECISIONS D1–D10: unchanged from the previous approval (THREE_DAYS companion / TWO_WEEKS centralized; shared\nremoval policy; name from actual centralized group, token-safe, child+reserved id LocalLogGroup; Use optional companion,\nnever auto-created, literal-name mismatch -\u003e ArgumentException; W1; explicit deps on managed groups, owned same-stack\nsupplied groups only; IAM per below; W2 all modes; no cross-Region/adoption; ServiceDefault unchanged + docs;\nAlreadyExists documented).\n\nVERIFIED IAM RESOURCE SCOPES (AWS Service Authorization Reference, machine-readable\nhttps://servicereference.us-east-1.amazonaws.com/v1/logs/logs.json, read 2026-10-26):\n logs:CreateLogGroup -\u003e log-group arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}\n logs:CreateLogStream -\u003e log-stream arn:${Partition}:logs:${Region}:${Account}:log-group:${LogGroupName}:log-stream:${LogStreamName}\n logs:PutLogEvents -\u003e log-stream (same)\n AWS's Web Functions example puts all three on '...:log-group:{name}[.local]:*'. That matches log-stream ARNs; whether\n CreateLogGroup is authorized against the ':*' form is undocumented -\u003e design uses documented formats, sandbox 3.9 verifies.\nFINAL STRATEGY (trigger unchanged = existing ShouldGrantWrite: Use mode, name outside /aws/lambda/* or token; via\nGrant.AddToPrincipal like ILogGroup.GrantWrite; immutable roles no-op/not mutated):\n unchanged: logGroup.GrantWrite(Role) (CreateLogStream/PutLogEvents on LogGroupArn ...:{name}:*).\n G1 always: CreateLogStream, PutLogEvents on arn:{p}:logs:{R}:{acct}:log-group:{name}.local:log-stream:*\n G2 only when Lambda may create the companion (no supplied companion, or any PerRegion/MultiRegion endpoint):\n CreateLogGroup on arn:{p}:logs:{R}:{acct}:log-group:{name}.local\n R = stack Region while all endpoints are HomeRegion; '*' once any PerRegion/MultiRegion endpoint exists (Lazy,\n resolved at synthesis; no duplicate statements on AddEndpoint).\n Never: CreateLogGroup on a centralized group, logs:*, log-group:*, other accounts.\n Created role: AWSLambdaBasicExecutionRole unchanged. Supplied roles with Create/ServiceDefault/Use(/aws/lambda/*):\n caller-managed; exact caller permissions in §8.3 rev 5. CreateLogGroup is NOT needed for CloudFormation-created\n groups (Create, supplied Use groups) — only where Lambda creates a group.\n\nWARNINGS: AddWarningV2; W1 @layeredcraft/cdk-constructs:webFunctionUnmanagedCompanionLogGroup (construct, Use w/o\ncompanion); W2 @layeredcraft/cdk-constructs:webFunctionRemoteCompanionLogGroups (each PerRegion/MultiRegion endpoint,\nall modes, mode sentence). Ack via Annotations.Of(scope).AcknowledgeWarning(id, reason) on construct/endpoint/ancestor;\nunacknowledged warnings fail `cdk synth --strict`. Note: CDK 2.274 also offers Validations.Of(scope).AddWarning;\nAddWarningV2 kept as approved.\n","acceptance_criteria":"- Revision 5 in the design doc reproduces this bead's DESIGN field: exact signatures, D1–D10, IAM matrix, ordering\n rules, W1/W2 ids and messages, test list, assertion signatures.\n- §21 has a revision-5 entry; header status updated; out-of-scope items from #104 listed.\n- `uv run mkdocs build --clean` passes.\n- Maintainer approval of the WRITTEN revision recorded in notes (date) before cdkc-18e.18.2/.18.3 are claimed.","notes":"2026-10-26: Maintainer approved the six-bead structure and decisions D1–D10 (THREE_DAYS companion default; companion inherits removal policy; name derived from the actual centralized group; Use(logGroup, companion?) with no auto-create; W1 when Use has no companion; explicit deps on managed groups, same-stack-only for supplied; ServiceDefault unchanged + docs; W2 for PerRegion/MultiRegion in all modes with mode-accurate text; no cross-Region/adoption machinery; AlreadyExists documented). Exact API, IAM, ordering, warning and test spec now in the DESIGN field. Open item for revision-5 review: whether CreateLogGroup authorizes against the ':*' ARN form exactly as AWS's Web Functions example shows — mirror the AWS example and verify in cdkc-18e.18.4.\n2026-10-26: Maintainer approved the public API and D1–D10, subject to the IAM refinement. IAM refined and verified against the Service Authorization Reference: per-resource-type statements (G1 .local log-stream write; G2 CreateLogGroup on the .local log-group ARN only where Lambda may create it; Region = stack Region, or * with PerRegion/MultiRegion endpoints). Design REVISION 5 WRITTEN in docs/designs/lambda-web-functions-integration.md (uncommitted); 'uv run mkdocs build --clean' passes; anchor #revision-5-companion-local-log-groups-104 resolves. STILL REQUIRED: maintainer review and approval of the written revision 5 before closing this bead or claiming cdkc-18e.18.2/.18.3.\n2026-10-26 FINAL APPROVAL: maintainer approved revision 5 (architecture, public API, logging behavior, retention defaults, IAM resource scoping, ownership semantics, warnings). Pre-close verification of the IAM ordering requirement: companion permissions must be correct regardless of configuration order (HomeRegion default endpoint, then AddEndpoint(PerRegion|MultiRegion)). Mechanism: synthesis-time Lazy.String Region (private DeputyBase producer reading a has-non-home-endpoint flag) + G2 added at most once (ctor or first non-home CreateEndpoint); no mutation of rendered policies or added statements. Verified with a scratch probe on Amazon.CDK.Lib 2.274.0 (not repo code): early G1 widened to logs:*: after the flag flip; late G2 appended without duplicates; HomeRegion -\u003e stack Region / Ref AWS::Region (env-agnostic); immutable imported role -\u003e no policy in any case; imported mutable -\u003e AWS::IAM::Policy by role name. No architectural contradiction. Recorded in design §8.3 'Mechanism', tests P11–P15 (§15), §21; regression tests added to cdkc-18e.18.2. Immutable-role caller permissions documented in §8.3 rev 5 (role matrix + caller-provided permissions). Header status: Approved (revision 5, 2026-10-26). mkdocs build passes.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-26T15:32:08Z","created_by":"Nick Cipollina","updated_at":"2026-10-26T16:16:01Z","closed_at":"2026-10-26T16:16:01Z","close_reason":"Design revision 5 written and approved by the maintainer (2026-10-26): docs/designs/lambda-web-functions-integration.md header/§8.3/§8.6/§12.1/§13/§14/§15/§16/§17/§19.1/§21. IAM configuration-order requirement verified on CDK 2.274.0 (Lazy Region, single G1/G2); regression tests P11–P15 recorded in design §15 and cdkc-18e.18.2.","external_ref":"gh-104","labels":["design","gh-104","lambda-web-functions","logging"],"dependencies":[{"issue_id":"cdkc-18e.18.1","depends_on_id":"cdkc-18e.18","type":"parent-child","created_at":"2026-10-26T15:32:08Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":0,"dependent_count":2,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.18","title":"#104: Manage Web Function .local companion log group with finite retention","description":"LayeredCraft/cdk-constructs#104: manage the Lambda Web Function `.local` companion log group with finite retention, so no\nlibrary consumer is left with an unowned, never-expiring log group. Must ship in a `2.6.0-preview.N` package before stable\n2.6.0 (gate cdkc-18e.17). Downstream consumer: sharedale/sharedale#162 (Milestone 12) cannot start its construct migration\nuntil a preview containing this work is published and verified.\n\nVerified AWS behavior (https://docs.aws.amazon.com/lambda/latest/dg/web-functions-logging.html, -permissions.html):\n- Companion name = centralized name + \".local\", for default (/aws/lambda/web/{fn}) AND custom groups.\n- `.local` is written in every Region where requests run, including the home Region; centralized group is home Region only.\n- Lambda creates either missing group on first use with default settings (never expire). It never removes events from\n `.local` after centralization; retention is per group. Docs: \"create the log group and its `.local` companion yourself\n before you route traffic to the revision.\" No documented way to disable the companion.\n- Execution role needs logs:CreateLogStream/PutLogEvents on BOTH `arn:aws:logs:{home}:{acct}:log-group:{name}:*` and\n `arn:aws:logs:*:{acct}:log-group:{name}.local:*` (Region wildcard). \"If the role cannot write to the `.local` log group in\n a Region, Lambda does not deliver logs from that Region.\"\n- Live Tail with least delay runs on `.local` in the serving Region; centralization typically within minutes.\n\nCurrent library (src/LayeredCraft.Cdk.Constructs/WebFunctionConstruct.cs ResolveLogs ~L211, Models/WebFunctionLogs.cs):\n- Create(retention=TWO_WEEKS, removal=DESTROY) creates only `/aws/lambda/web/{FunctionName}` (child id `LogGroup`);\n revision DependsOn it. No companion.\n- Use(ILogGroup) passes the name; ShouldGrantWrite grants write on the centralized group only when name is outside\n /aws/lambda/* (GAP: no `.local` grant -\u003e with a supplied mutable role and a custom group, logs are not delivered at all).\n No revision dependency on a same-stack supplied group with a literal name.\n- ServiceDefault(): nothing created; XML/docs mention only the default group.\n- No non-HomeRegion logging annotation; no log-group assertions in Testing/.\n\nChildren: design addendum -\u003e implementation (+tests/goldens/helpers) and docs -\u003e AWS sandbox validation -\u003e PR/review/\nmerge/preview publication. Stable release is NOT part of this feature (stays in cdkc-18e.17).\n\nOut of scope (issue #104): non-home-Region log-group creation, changing centralized default name/retention, log-level/\nmetric/subscription helpers, adoption/import machinery for existing service-created groups, Sharedale changes.\n","acceptance_criteria":"- All five child beads closed with recorded evidence.\n- Every #104 acceptance-criteria checkbox is satisfied and evidenced (synthesis, Use-mode, ServiceDefault docs, warning,\n goldens/full suite/coverage, sandbox record in PR, published preview).\n- The exact published `2.6.0-preview.N` version is recorded here and on cdkc-18e.17.\n- Stable 2.6.0 NOT published by this feature.","notes":"Agent workflow: work the children via 'bd ready --parent cdkc-18e.18'; never claim this feature directly. Order: .18.1 (design rev 5 + maintainer approval) -\u003e .18.2 implementation and .18.3 docs in parallel -\u003e .18.4 sandbox (maintainer creds) -\u003e .18.5 PR/merge/preview. Epic-wide rules from cdkc-18e apply (no commit/push/PR/publish/deploy without maintainer authorization; no Sharedale changes). Close when all children are closed; record the published preview version here.\nPublished preview for #104: 2.6.0-preview.28 (Publish Preview run 40500237868, merged PR #105 / merge commit 63db9b1). Verified on nuget.org: companion (.local) log-group APIs present (WebFunctionLogsCreate companionRetention, WebFunctionLogs.Use optional companion, LocalLogGroup, new assertions), Amazon.CDK.Lib floor 2.274.0 unchanged, and resolvable from nuget.org. Consumer handoff: sharedale/sharedale#162 (do not edit; the Sharedale maintainer picks it up). Stable 2.6.0 remains gated on cdkc-18e.17 (Sharedale Milestone 12 validation + explicit maintainer approval).","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"feature","owner":"ncipollina@gmail.com","created_at":"2026-10-26T15:31:42Z","created_by":"Nick Cipollina","updated_at":"2026-10-27T12:13:23Z","closed_at":"2026-10-27T12:13:23Z","close_reason":"All five child beads closed with recorded evidence. Every #104 acceptance criterion satisfied and evidenced (two-group Create synthesis, Use-mode IAM grants, ServiceDefault docs, non-home-Region warning, goldens + full suite + coverage, sandbox validation record in PR #105, published preview). Exact published preview 2.6.0-preview.28 (Publish Preview run 40500237868) recorded here and on cdkc-18e.17. Stable 2.6.0 NOT published; remains gated on cdkc-18e.17 (Sharedale #162 validation + explicit maintainer approval).","external_ref":"gh-104","labels":["gh-104","lambda-web-functions","logging"],"dependencies":[{"issue_id":"cdkc-18e.18","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-26T15:31:42Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.17","title":"Sharedale consumer validation and stable release gate","description":"Gate before a stable v2.6.0 release. Tracks end-to-end consumer validation of the published Lambda Web Functions preview package. Stable v2.6.0 must NOT be published until every acceptance criterion here is satisfied.","acceptance_criteria":"1. Lambda Web Functions PR merged to main.\n2. v2.6.0 preview NuGet package published successfully.\n3. Sharedale milestone 6 completed.\n4. Sharedale consumes the actual published preview NuGet package.\n5. Web Function constructs successfully integrated and validated in Sharedale.\n6. Any integration-discovered library defects resolved.\n7. Maintainer explicitly authorizes stable v2.6.0.","notes":"External dependency: Sharedale milestone 6 (external repo — do not modify Sharedale from this repository). This bead and epic cdkc-18e remain OPEN until stable v2.6.0 release acceptance.\nUPDATE 2026-10-26 (planning for LayeredCraft#104): Sharedale Milestone 6 is complete; consumer validation now happens in Sharedale Milestone 12 (https://github.com/sharedale/sharedale/milestone/12): sharedale/sharedale#162 (migrate both Web Functions onto a published 2.6.0 preview with managed .local retention) and #163 (stable 2.6.0 validation/adoption). Read AC 3 as 'Sharedale Milestone 12 consumer validation (#162) completed'. New prerequisite: the preview Sharedale validates must contain #104 (feature cdkc-18e.18; this gate now depends on it). 2.6.0-preview.27 does NOT qualify. Sequence: #104 implemented + sandbox-validated -\u003e PR merged after Codex review -\u003e new 2.6.0-preview.N published and verified (cdkc-18e.18.5 records N) -\u003e Sharedale #162 consumes it -\u003e integration defects fixed in further previews -\u003e explicit maintainer approval -\u003e existing stable-release workflow. Closing cdkc-18e.18 does NOT authorize stable publication; this bead stays open until Sharedale validation and maintainer approval.\n2.6.0-preview.28 (Publish Preview run 40500237868, PR #105 / merge commit 63db9b1) published to nuget.org with the #104 Web Function companion (.local) log-group APIs. Stable 2.6.0 release remains blocked until Sharedale #162 validates this preview and the maintainer explicitly approves the release.\n2026-10-27 — Sharedale preview consumer-validation evidence available (AC 3–6 satisfied; AC 7 maintainer authorization still open).\n\nSharedale #162 (migrate both Web Functions to LayeredCraft.Cdk.Constructs 2.6.0-preview.28) closed, PR #168 merged to main at a1de5d118d6e98876f6ed8c55f867b04e0ab8824. Validated on dev (two destroy/recreate cycles) and staging (reset+recreate from the merge commit): both Web Functions on WebFunctionConstruct/WebFunctionOrigin, IAM/OAC 403 boundaries, 30d/.local 3d managed log retention surviving recreation, hosted smoke 54/0 fail, hosted e2e 25/0 fail, local Aspire green. NO construct defects found; LayeredCraft#104 (PR #105 / 63db9b16) included in preview.28.\n\nConsolidated evidence handoff (for cdkc-18e.17): https://github.com/sharedale/sharedale/issues/163#issuecomment-6451865400\nStaging proof: https://github.com/sharedale/sharedale/issues/162#issuecomment-6451732229\nMerge PR: https://github.com/sharedale/sharedale/pull/168\n\nRemaining LayeredCraft-side items before stable publish: reconcile stale \u003cVersionPrefix\u003e2.4.0 to produce exactly 2.6.0; release-drafter draft v2.6.0 notes already cover #103 + #104. Do not publish until maintainer authorizes (Sharedale D163 / sharedale-n47.4.2).\n2026-10-27 — Maintainer authorized stable v2.6.0 (AC 7 satisfied). No code change required: publish-release derives the package version from the release tag (/p:Version=${TAG#v}), so the stale VersionPrefix did not affect the artifact; Directory.Build.props left unchanged (no code edits). Published GitHub Release v2.6.0 (non-draft, Latest), tag points at main 63db9b16 (PR #105): https://github.com/LayeredCraft/cdk-constructs/releases/tag/v2.6.0 . Publish Release workflow run 40573038273 succeeded (tests passed; push step logged \"Pushing LayeredCraft.Cdk.Constructs.2.6.0.nupkg\" -\u003e \"Your package was pushed\"). Verified non-preview 2.6.0 on nuget.org via flatcontainer index and nuspec (version 2.6.0, Amazon.CDK.Lib \u003e= 2.274.0, repository commit 63db9b16). Draft notes updated with a Summary section in the v2.5.0 style. Release contains PRs #103 and #105 (incl. the #104 .local companion log-group fix).","status":"closed","priority":1,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-25T23:45:13Z","created_by":"Nick Cipollina","updated_at":"2026-10-27T20:08:10Z","closed_at":"2026-10-27T20:08:10Z","close_reason":"Stable v2.6.0 published and verified: GitHub Release v2.6.0 (Latest) tagged on main 63db9b16; Publish Release run 40573038273 success; LayeredCraft.Cdk.Constructs 2.6.0 (non-preview) live on nuget.org per nuspec. ACs 1-7 satisfied.","external_ref":"sharedale-milestone-6","labels":["lambda-web-functions"],"dependencies":[{"issue_id":"cdkc-18e.17","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-25T23:45:13Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.17","depends_on_id":"cdkc-18e.18","type":"blocks","created_at":"2026-10-26T15:33:26Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.15","title":"T3c: Correct IAM grant, resource-policy, and endpoint-import review findings","description":"Purpose: correct the confirmed findings of the independent T1–T3b implementation review before T4 builds on them. Design: docs/designs/lambda-web-functions-integration.md REVISION 4. Authoritative sections: §8 (namespace note), §8.3 (reserved child IDs, read-only Endpoints, execution-role ordering), §8.4 (AddToResourcePolicy restrictions, imported-endpoint validation and account rule), §10.2 (updated table + \"Revision 4 corrections\" items 1–6), §10.3 (statement integrity), §12.1, §14 (revision-4 rows), §15 (revision-4 additions), §21 revision 4.\n\nImplement revision 4 exactly. If any rule cannot be implemented as written (for example a CDK public API behaves differently from what the design states), STOP and record a blocker with bd update \u003cid\u003e --append-notes. Do not change the design yourself.\n\nDeliverables (files: WebFunctionGrants.cs, WebFunctionEndpointConstruct.cs, WebFunctionImportedEndpoint.cs, WebFunctionConstruct.cs, Models/WebFunctionEndpoint.cs → move, tests):\n\n1. F1 Service principals (§10.2 rev-4 item 1). GrantInvoke throws InvalidOperationException for any principal whose PolicyFragment.PrincipalJson is a \"Service\" principal (bare ServicePrincipal or PrincipalWithConditions wrapping one), under BOTH CallerPolicy values. The service name is a token in CDK 2.274, so resolve it (Stack.Of(endpoint).Resolve) to detect cloudfront.amazonaws.com. Remedy text: CloudFront → \"use GrantCloudFrontInvoke(distributionArn)\"; other services → \"add an explicit, condition-scoped statement with endpoint.AddToResourcePolicy(...)\". Do NOT add aws:SourceAccount automatically. Do NOT add a new public API for scoped service grants (deferred).\n2. Wildcards (§10.2 rev-4 item 2; §8.4).\n - GrantInvoke throws InvalidOperationException for EVERY wildcard principal (PrincipalJson AWS=\"*\" or LiteralString=\"*\"; AnyPrincipal, StarPrincipal, OrganizationPrincipal, conditioned or not) under both CallerPolicy values. Remedy text: use an explicit, conditioned AddToResourcePolicy statement.\n - AddToResourcePolicy rejects (ArgumentException) Allow statements that have no conditions and name a wildcard or service principal, and Allow statements using NotPrincipal.\n - Deny statements are unrestricted.\n - An explicit Allow with a wildcard AND conditions is accepted. Check only that conditions are present; do NOT build any IAM-condition analyzer. XML docs state the consumer is responsible for the conditions meaningfully restricting access.\n - GrantCloudFrontInvoke (conditioned) keeps working.\n3. F3 Account principals (§10.2 rev-4 item 3). AccountPrincipal and AccountRootPrincipal (by .NET type), and any principal whose LITERAL AWS principal is an account root ARN, are never established. Automatic throws, even for the same account. ExternallyManaged behavior unchanged.\n4. P1 Verified identity writes (§10.2 rev-4 item 4) for owned AND imported principals. The identity side counts as written only when (a) the grant principal is a concrete owned mutable CDK identity (.NET Amazon.CDK.AWS.IAM.Role, User, Group, or LazyRole with Resource.IsOwnedResource == true), or (b) AddToPrincipalPolicy returned StatementAdded == true with PolicyDependable is Amazon.CDK.AWS.IAM.Policy (replacing the current \"is IConstruct\" check). Everything else is not written: fallback to the resource statement on an owned endpoint, throw on an imported endpoint. Never infer a write from Grant.PrincipalStatements. Verified facts on 2.274.0: an owned Role returns an EMPTY DependencyGroup (so signal (b) alone would break owned roles); ImmutableRole returns an empty DependencyGroup; imported mutable role/user/group return Policy; a classic Function's role, LazyRole, and User surface as concrete .NET types; owned.WithoutPolicyUpdates() surfaces as an IPrincipal proxy (not Role).\n5. F2 Role dependency (§8.3 notes, §12.1). Replace _revision.Node.AddDependency(Role) with a dependency on the role's CfnRole only (Role.Node.DefaultChild when it is a CfnResource; nothing extra for imported roles; ExecutionRoleArn already references the role). Never depend on the DefaultPolicy subtree. Keep every other DependsOn edge (Function, created LogGroup, bucket PolicyDependable).\n6. F5 Imported endpoints (§8.4; public API addition approved by the maintainer).\n - Add `public string? Account { get; init; }` to WebFunctionEndpointAttributes, with XML docs.\n - Validation:\n - a literal EndpointArn must match arn:{p}:lambda:{r}:{12 digits}:web-function/{fn}/endpoint/{ep} (ArgumentException);\n - a literal DomainName must be non-empty (null → ArgumentNullException, empty → ArgumentException);\n - a literal Account must be 12 digits;\n - when Account and the ARN are both literal, they must be equal (ArgumentException);\n - tokens are not validated.\n - Environment: Env.Account = the literal ARN account, else Account; Env.Region from the ARN. Use ResourceProps.EnvironmentFromArn, or explicit Account/Region if CDK does not allow combining them. Assert the result in tests either way.\n - Endpoint account = the literal ARN account, else a literal Account; anything else is NOT established.\n - If the endpoint account is not established, GrantInvoke throws for EVERY grantee, owned included (this replaces the revision-3 owned-only rule and its annotation). The message names both remedies (supply a literal Account; configure caller access outside this app) and notes that the endpoint remains usable as a CloudFront origin with ExternallyManaged origin permissions.\n - If the endpoint account is established, a grantee is established only when its account is literally SAME (owned → its stack account; imported → PrincipalAccount). ONE_UNRESOLVED and BOTH_UNRESOLVED are not established.\n - Constructing an imported endpoint with a token ARN and no Account must succeed; it must not throw at FromEndpointAttributes.\n7. P6 Statement integrity (§10.3). AddToResourcePolicy validates, then stores statement.Copy() with Freeze() applied. WebFunctionConstruct registers a node validation that returns PolicyDocument.ValidateForResourcePolicy() errors for the resource policy (when one exists). Keep StatementAdded/PolicyDependable return semantics.\n8. P3 Reserved ids (§8.3). AddEndpoint throws ArgumentException for the ids Function, Revision, DefaultEndpoint, ExecutionRole, LogGroup, ResourcePolicy (ordinal).\n9. Endpoints read-only. Return a cached ReadOnlyCollection (or equivalent) that cannot be cast back to a mutable List; the public type stays IReadOnlyList\u003cWebFunctionEndpointConstruct\u003e.\n10. F4 Diagnostics (§10.2 rev-4 item 6). Errors and annotations identify the grantee by the IGrantable's construct path when it is an IConstruct (jsii IRole proxies are), else the principal's resolved policy-fragment JSON, else the type name. Identify the endpoint by construct path + EndpointName, never by an ARN token. No human-facing text contains \"${Token[\". The ExternallyManaged annotation describes caller-side identity policies only for IAM identities.\n11. Namespace (§8 rev-4 note). Move IWebFunctionEndpoint to namespace LayeredCraft.Cdk.Constructs, in file IWebFunctionEndpoint.cs at the project root. XML docs state it is not intended for consumer implementation. Also correct the stale WebFunctionConstruct XML summary (\"added by later releases\").\n\nRegression tests (WebFunctionInvokeGrantTests / WebFunctionResourcePolicyTests / WebFunctionConstructTests; [Collection(\"CDK Tests\")]; assert on templates and messages, not on internals):\n- Service principals: cloudfront (message names GrantCloudFrontInvoke), another service, and a conditioned one each throw under Automatic AND ExternallyManaged; no ResourcePolicy synthesized.\n- Wildcards:\n - GrantInvoke with AnyPrincipal, StarPrincipal, and a conditioned OrganizationPrincipal throws under BOTH policies; no ResourcePolicy is created.\n - AddToResourcePolicy: an unconditioned \"*\" Allow throws; Allow+NotPrincipal throws; a Deny with \"*\" is accepted; an explicit Allow with \"*\" plus an aws:PrincipalOrgID StringEquals condition writes exactly that statement (condition preserved).\n- Same-account AccountPrincipal and AccountRootPrincipal under Automatic throw.\n- No-op identity writes (real CDK types, no fakes): Role.FromRoleArn(Mutable=false); Mutable=false + AddGrantsToResources=true; owned.WithoutPolicyUpdates(). Each → resource statement with the role ARN principal, ZERO AWS::IAM::Policy, and returned Grant.PrincipalStatements empty; the same grantees on an imported endpoint throw.\n- Real identity policies: owned Role, classic Lambda Function, WebFunctionConstruct, mutable imported role, imported User, imported Group → exactly one AWS::IAM::Policy statement with Action lambda:InvokeWebFunctionEndpoint and Resource = that endpoint's ARN, attached to the right role/user/group; no ResourcePolicy.\n- Unresolved imported ARNs: token role ARN (Fn.ImportValue) and a literal role ARN in an env-agnostic stack under Automatic → throw, zero AWS::IAM::Policy.\n- Imported endpoints:\n - Throw at FromEndpointAttributes: an invalid literal ARN (a function ARN, a missing endpoint segment); null and empty DomainName; a non-12-digit Account; an Account that differs from a literal ARN's account.\n - A literal ARN with an equal Account is accepted.\n - Env.Account/Env.Region equal the endpoint's (literal ARN; token ARN + literal Account).\n - A literal foreign ARN with an owned caller in an env-agnostic stack throws.\n - A token ARN with no Account: construction succeeds, and GrantInvoke throws for an owned Role AND for an imported mutable role, with ZERO AWS::IAM::Policy.\n - A token ARN with a literal Account equal to the caller stack's account and an owned caller writes the identity policy.\n - A token ARN with a literal Account different from the caller's account throws.\n - An immutable same-account role on an imported endpoint throws.\n- CDK upgrade guard: group the real-CDK principal-behavior tests (no-op writes, real identity policies, service/wildcard/account classification) in a clearly named class or trait (e.g. CdkPrincipalBehaviorRegressionTests). Its class doc comment states that these pin CDK/jsii behavior observed in 2.274.0 and that a failure on an Amazon.CDK.Lib upgrade blocks the upgrade until the signals are re-verified (design §10.2 rev-4 item 4).\n- Diagnostics: error messages contain the grantee construct path (imported role id), EndpointName, and both remedies; annotations asserted via Annotations.FromStack (info level, expected text); no message or annotation contains \"${Token[\".\n- Cycles: mutual invocation (A↔B), self-invocation, and BFF/API (API env var = web.DefaultEndpoint.Url, api.DefaultEndpoint.GrantInvoke(web)) → Template.FromStack succeeds. Assert that the revision DependsOn contains the CfnRole logical id and does NOT contain any DefaultPolicy id.\n- Statement integrity: mutating the caller's statement after AddToResourcePolicy (AddResources(\"*\")) leaves the template unchanged; a principal-less statement fails synthesis validation; the GrantInvoke resource path renders exactly one statement (dedupe of the double add).\n- Reserved ids: each reserved id passed to AddEndpoint throws ArgumentException. Endpoints: casting to List\u003cT\u003e/ICollection\u003cT\u003e mutation fails.\n- Replace the existing StatementAdded=false regression so it exercises a GrantInvoke-level path where feasible; keep a direct test of the internal helper only as a supplement.\n\nGolden templates (§12.4): the revision-dependency change intentionally alters web-function-use-log-group.json (SuppliedRoleDefaultPolicy… drops from the Revision DependsOn) and possibly other goldens whose role has a DefaultPolicy. Regenerate ONLY affected files with UPDATE_GOLDEN_TEMPLATES=1, then review every diff line. Record in the bead notes each changed golden, the exact changed lines, and why. Any diff beyond DependsOn removal of DefaultPolicy ids is a defect. The 17 existing-construct goldens must remain byte-identical. Add one new golden: a mutual-invocation pair + an explicit conditioned-wildcard AddToResourcePolicy statement (aws:PrincipalOrgID).\n\nRequired synthesis validation (record commands and results in notes): from the repo root, run dotnet restore LayeredCraft.Cdk.Constructs.slnx; dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release (0 warnings); and dotnet test --solution LayeredCraft.Cdk.Constructs.slnx -c Release across net8.0–net11.0 (JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION=1). Then grep src/ for AddToPrincipalOrResource|\\.Success\\b|AssertSuccess (must be empty) and for PrincipalStatements.Length used as write evidence (must be absent).\n\nExclusions: WebFunctionOrigin/T4; Testing-namespace helpers; user docs (T6a/T6b); owned-bucket inspection and DSSE (separate follow-up bead); existing constructs; any AWS deployment. No commits or pushes unless separately authorized.\n\nSecurity: never synthesize an unconditioned service-principal or wildcard Allow statement; never report a grant as complete when no policy was verifiably written; never write an identity policy for a principal whose account is not literally established for an imported endpoint.\n","acceptance_criteria":"• Every design revision-4 rule in §8.3/§8.4/§10.2/§10.3/§14 for this task is implemented; any deviation is recorded as a blocker note rather than taken silently.\n• GrantInvoke rejects all service principals (CloudFront remedy → GrantCloudFrontInvoke) and ALL wildcard principals, conditioned or not, under both CallerPolicy values.\n• AddToResourcePolicy rejects unconditioned wildcard/service-principal Allow statements and Allow+NotPrincipal, and accepts explicit conditioned wildcard Allow statements. There is no condition analyzer, and the consumer-responsibility XML doc is present.\n• Same-account AccountPrincipal/AccountRootPrincipal under Automatic throw.\n• Identity writes are counted only by the two revision-4 signals, for owned and imported principals. ImmutableRole, AddGrantsToResources=true, and WithoutPolicyUpdates() never produce a silent no-op (real-CDK tests, zero AWS::IAM::Policy). Unestablished authorization fails closed.\n• The real-CDK principal-behavior regression tests are grouped as a named CDK-upgrade guard whose doc comment cites the 2.274.0 observations and the upgrade-blocking rule.\n• Mutual, self, and BFF/API invocation patterns synthesize; the revision depends on the CfnRole and never on a DefaultPolicy.\n• WebFunctionEndpointAttributes.Account (string?) exists.\n• Literal ARN, domain, and Account are validated, and Account must match a literal ARN.\n• Env is the endpoint's.\n• GrantInvoke throws for every grantee when the endpoint account is not established (token ARN without a literal Account), and constructing such an endpoint still succeeds.\n• For an established endpoint account, only literal SAME grantee accounts are established.\n• Stored resource-policy statements are frozen copies; ValidateForResourcePolicy runs at synthesis; reserved AddEndpoint ids are rejected; Endpoints is genuinely read-only; IWebFunctionEndpoint lives in LayeredCraft.Cdk.Constructs.\n• Errors and annotations name the grantee and endpoint meaningfully and never contain ${Token[; annotations are asserted in tests.\n• Golden changes are limited to the intentional DependsOn removals (each diff recorded and explained in notes) plus the one new golden; the 17 existing-construct goldens are unchanged.\n• Release build has 0 warnings; the full suite passes on net8.0–net11.0; grep checks are clean; evidence is recorded in notes.","notes":"T3c BLOCKED on one revision-4 requirement (section 10.3 synthesis-time resource-policy validation) — STOPPED per task rule, bead NOT closed.\n\nIMPLEMENTED (all source edits applied; src builds 0 warnings/0 errors on all 4 TFMs):\n- WebFunctionValidation.cs: added using Amazon.CDK.AWS.IAM; regex WebFunctionEndpointArnPattern (^arn:[a-z0-9-]+:lambda:[a-z0-9-]+:[0-9]{12}:web-function/[^/]+/endpoint/[^/]+$), AccountPattern (^[0-9]{12}$); ReservedEndpointChildIds {Function,Revision,DefaultEndpoint,ExecutionRole,LogGroup,ResourcePolicy}; validators ValidateEndpointArn, ValidateEndpointDomainName (null-\u003eArgumentNullException, empty-\u003eArgumentException, tokens skipped), ValidateAccount, ValidateImportedAccountConsistency, ValidateEndpointChildId (reserved-\u003eArgumentException), ValidateResourcePolicyStatement (Deny ok; NotPrincipal-\u003eArgumentException; Allow with conditions ok; Allow with unconditioned service/wildcard principal-\u003eArgumentException), IsServicePrincipal, IsWildcardPrincipal.\n- Models/WebFunctionEndpointAttributes.cs: added public string? Account { get; init; }.\n- IWebFunctionEndpoint moved to root namespace LayeredCraft.Cdk.Constructs (new src/.../IWebFunctionEndpoint.cs); deleted Models/WebFunctionEndpoint.cs.\n- WebFunctionConstruct.cs: revision now depends on the owned role CfnRole ONLY (if Role.Node.DefaultChild is CfnResource roleCfn then _revision.Node.AddDependency(roleCfn); replacing _revision.Node.AddDependency(Role)) so the DefaultPolicy subtree is never a dependency; Endpoints is a genuinely read-only view (_endpoints.AsReadOnly()); AddEndpoint rejects reserved child ids.\n- WebFunctionEndpointConstruct.cs: AddToResourcePolicy validates then stores a frozen copy (statement.Copy(null); Freeze()) before forwarding.\n- WebFunctionImportedEndpoint.cs: validates ARN/DomainName/Account + consistency; resource Env = the endpoint's (ResourceProps.EnvironmentFromArn for a literal ARN, else Account); _account = literal ARN account else literal Account (else null = not established).\n- WebFunctionGrants.cs: full rev-4 rewrite — reject every service principal (both CallerPolicy; CloudFront remedy = GrantCloudFrontInvoke(distributionArn), detected by resolving the service token; other services remedy = explicit conditioned AddToResourcePolicy) and every wildcard principal (both modes); AccountPrincipal/AccountRootPrincipal never established (Automatic throws even same account); verified identity write ONLY via signal (a) concrete owned mutable CDK identity (Role/User/Group/LazyRole with Resource.IsOwnedResource) or signal (b) AddToPrincipalPolicy StatementAdded AND PolicyDependable is Amazon.CDK.AWS.IAM.Policy; never Grant.PrincipalStatements/Grant.Success/AssertSuccess; not-written -\u003e owned endpoint resource fallback / imported endpoint throw; imported endpoint account unestablished -\u003e throw for every grantee; ExternallyManaged -\u003e resource statement only + annotation (IAM identities only).\n\nBLOCKER (exact incompatibility): revision-4 section 10.3 requires registering a synthesis-time node validation that returns PolicyDocument.ValidateForResourcePolicy() errors. Constructs.Node.AddValidation(Constructs.IValidation) cannot accept a C#-implemented IValidation from this (non-jsii) library: every WebFunctionConstruct construction threw System.ArgumentException : Could not convert argument 'LayeredCraft.Cdk.Constructs.WebFunctionResourcePolicyValidation' to Jsii (Parameter 'arguments') at Constructs.Node.AddValidation — reproduced for BOTH a private nested class and a public top-level class. Note Constructs 10.5.0 DOES generate Constructs.IValidation._Proxy and Node.AddValidation exists, so jsii nominally advertises .NET implementations of IValidation, yet the 2.274.0 runtime rejects one; no concrete Amazon.CDK type implements Constructs.IValidation either. Hence the requirement is not implementable as written with CDK 2.274.0 + Constructs 10.5.0.\nREVERT: removed the Node.AddValidation(...) registration and deleted WebFunctionResourcePolicyValidation.cs. The fail-closed intent is currently served only by the EAGER WebFunctionValidation.ValidateResourcePolicyStatement(...) call in WebFunctionEndpointConstruct.AddToResourcePolicy.\nRECOMMENDED MINIMAL CORRECTIONS (need authorization; do NOT change the design unilaterally): (a) accept eager-only statement validation as the rev-4 equivalent, or (b) additionally call PolicyDocument.ValidateForResourcePolicy(null) eagerly inside WebFunctionConstruct.AddResourcePolicyStatement and throw (covers pre-synthesis adds but not later ones), or (c) investigate a jsii-marshallable IValidation (concrete/base-type/attribute requirement) or an alternate hook.\n\nNOT DONE (because stopped): existing WebFunction* tests not yet updated to rev-4 semantics (service principals now throw; AccountPrincipal throws; env-agnostic owned endpoint now throws), section 15 rev-4 new tests + named CDK-upgrade guard not added, web-function goldens not yet regenerated for the role-dependency DependsOn change (the 17 existing-construct goldens remain byte-identical; the 7 web-function golden tests currently fail against the altered DependsOn), full suite not re-run. Bead remains in_progress.\nT3c COMPLETE (all revision-4 acceptance criteria met). Not committed per instruction.\n\nDESIGN-CORRECTION / DEVIATION (authorized): The design's literal wording required registering a synthesis-time node validation (Node.AddValidation with a custom Constructs.IValidation) returning PolicyDocument.ValidateForResourcePolicy() errors. That is NOT implementable from this non-jsii assembly on CDK 2.274.0: Node.AddValidation throws \"Could not convert argument '...' to Jsii\" for both private-nested and public-top-level C# IValidation implementations. The maintainer authorized Option B: eager PolicyDocument validation instead. Implemented in WebFunctionConstruct.AddResourcePolicyStatement (see below). No other deviation.\n\nHOW DOCUMENT VALIDATION WAS IMPLEMENTED (Option B, transactional): WebFunctionConstruct.AddResourcePolicyStatement(statement):\n1. WebFunctionValidation.ValidateResourcePolicyStatement(statement) (revision-4 security checks: Deny allowed; Allow+NotPrincipal rejected; Allow with conditions accepted; otherwise Allow naming a service or wildcard principal rejected).\n2. var stored = statement.Copy(null); stored.Freeze();\n3. Build a candidate: new PolicyDocument(new PolicyDocumentProps { Statements = [.. _resourcePolicyStatements, stored] }).\n4. var errors = candidate.ValidateForResourcePolicy(null); if errors.Length \u003e 0 throw InvalidOperationException($\"The resource policy for Web Function '{Node.Path}' is invalid: {string.Join(\"; \", errors)}\").\n5. Only after validation: append to a private List\u003cPolicyStatement\u003e _resourcePolicyStatements, lazily create the single real _resourcePolicy PolicyDocument + single AWS::Lambda::CfnResourcePolicy child id \"ResourcePolicy\" (ResourceArn = _function.AttrFunctionArn).\nEvery subsequent addition revalidates the COMPLETE candidate document (no invalid partial state is applied). Single-policy ownership, endpoint-scoped resources, wildcard/service checks, and Deny behavior are preserved.\n\nFILES CHANGED (uncommitted):\nsrc/LayeredCraft.Cdk.Constructs/\n- Models/WebFunctionValidation.cs (MOD): added using Amazon.CDK.AWS.IAM; regexes WebFunctionEndpointArnPattern (arn:{p}:lambda:{r}:{12 digits}:web-function/{fn}/endpoint/{ep}) + AccountPattern (12 digits); ReservedEndpointChildIds {Function,Revision,DefaultEndpoint,ExecutionRole,LogGroup,ResourcePolicy}; ValidateEndpointArn / ValidateEndpointDomainName (null-\u003eArgumentNullException, empty-\u003eArgumentException, tokens skipped) / ValidateAccount / ValidateImportedAccountConsistency / ValidateEndpointChildId / ValidateResourcePolicyStatement / IsServicePrincipal / IsWildcardPrincipal / IsWildcardValue (IEnumerable-aware, so array-valued PrincipalJson like {\"AWS\":[\"*\"]} is detected).\n- Models/WebFunctionEndpointAttributes.cs (MOD): added public string? Account { get; init; }.\n- WebFunctionConstruct.cs (MOD): role dependency corrected to the owned role's CfnRole only (if (Role.Node.DefaultChild is CfnResource roleCfn) _revision.Node.AddDependency(roleCfn); never the whole Role/DefaultPolicy subtree); Endpoints is a genuinely read-only view (_endpoints.AsReadOnly()); AddEndpoint rejects reserved child IDs (ArgumentException) before the per-function EndpointName uniqueness check (InvalidOperationException); _resourcePolicyStatements + Option-B eager AddResourcePolicyStatement.\n- WebFunctionEndpointConstruct.cs (MOD): AddToResourcePolicy validates the statement (endpoint-scoped resource must equal this endpoint's ARN) then stores a frozen copy (statement.Copy(null); Freeze()).\n- WebFunctionImportedEndpoint.cs (MOD): validates attribute ARN/DomainName/Account + account consistency BEFORE the base environment; imported resource Env is the ENDPOINT's (ResourceProps.EnvironmentFromArn for a literal ARN, else ResourceProps.Account); _account = literal ARN account else literal Account (else null = not established).\n- WebFunctionGrants.cs (MOD, rev-4 rewrite): rejects SERVICE principals and ALL WILDCARD principals under BOTH CallerPolicy values with InvalidOperationException + remedies (CloudFront -\u003e \"Use GrantCloudFrontInvoke(distributionArn)...\"; other services -\u003e explicit condition-scoped endpoint.AddToResourcePolicy); AccountPrincipal/AccountRootPrincipal + literal account-root ARN principals are never established (Automatic throws even same account); ExternallyManaged -\u003e resource statement only + Annotations.AddInfo (IAM identities only, never identity); Automatic with an unestablished ENDPOINT account -\u003e throw for EVERY grantee (names both remedies + notes the endpoint remains usable as a CloudFront origin with ExternallyManaged permissions); established grantee ONLY when accounts are literally SAME (TokenComparison.SAME; owned -\u003e its stack account, imported -\u003e PrincipalAccount); verified identity write = signal (a) concrete owned mutable CDK identity (Amazon.CDK.AWS.IAM.Role/User/Group/LazyRole with Resource.IsOwnedResource) OR signal (b) AddToPrincipalPolicy returned StatementAdded \u0026\u0026 PolicyDependable is Amazon.CDK.AWS.IAM.Policy; written -\u003e Grant.AddToPrincipal; not written -\u003e OWNED endpoint: resource statement, IMPORTED endpoint: throw. Grant.Success / AssertSuccess / AddToPrincipalOrResource / Grant.PrincipalStatements are NOT used anywhere.\n- IWebFunctionEndpoint.cs (NEW, root namespace LayeredCraft.Cdk.Constructs); Models/WebFunctionEndpoint.cs DELETED (moved).\n\ntests/LayeredCraft.Cdk.Constructs.Tests/\n- WebFunctionSecurityTests.cs (NEW, 36 tests) incl. the named CDK-UPGRADE GUARD group (CdkUpgradeGuard_*) — real-CDK no-op-writer behavior (Role.FromRoleArn(Mutable=false), Mutable=false + AddGrantsToResources=true, owned.WithoutPolicyUpdates()) asserting NO AWS::IAM::Policy and pass-to-resource (owned) behavior; doc comment cites the 2.274.0 observations and the upgrade-blocking rule.\n- WebFunctionInvokeGrantTests.cs (MOD): 4 rev-4 updates (service principal now throws; env-agnostic owned throws; scoped-endpoint test now uses non-service grantees).\n- WebFunctionResourcePolicyTests.cs (MOD): statement now names a principal (resource policies require one).\n- WebFunctionConstructGoldenTemplateTests.cs (MOD): rev-4 adjustments.\n- GoldenTemplates/web-function-use-log-group.json (MOD, regenerated).\n\nGOLDEN-TEMPLATE DIFF (recorded): exactly ONE golden changed — test/LayeredCraft.Cdk.Constructs.Tests/GoldenTemplates/web-function-use-log-group.json. CloudFormation difference: the revision's DependsOn no longer lists \"SuppliedRoleDefaultPolicy1B06B14F\"; it retains \"SuppliedRole699D3B4C\" (the CfnRole) and \"webfunctionFunction46F1F768\". REASON: the rev-4 execution-role dependency correction makes the revision depend on the owned role's CfnRole only, never on the whole Role/DefaultPolicy subtree; this is the only scenario whose supplied role carries an inline DefaultPolicy (from logGroup.GrantWrite(role) for the non-/aws/lambda/ group \"/custom/web/logs\"). The other 6 web-function goldens were byte-identical (created roles have no inline DefaultPolicy). ALL 17 existing-construct goldens remain BYTE-IDENTICAL (unchanged).\n\nVALIDATION EVIDENCE: full Release build 0 warnings / 0 errors (net8.0/net9.0/net10.0/net11.0). Full suite `JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION=1 dotnet test --solution LayeredCraft.Cdk.Constructs.slnx -c Release` -\u003e total 1700, failed 0, succeeded 1700, skipped 0 (425 x 4 TFMs; prior baseline 1556 = 389x4; +36/TFM). Golden tests: 24 total, all zero-diff. Focused runs: WebFunctionSecurityTests 36/36; -class \"*WebFunction*\" 203+ pass.\nT3c CORRECTIVE PASS (independent review R1-R3; bead reopened to in_progress).\n\nR1 (security, confirmed): GrantInvoke used an identity-policy WRITE as a capability probe (IdentityPolicyCanBeWritten called grantee.GrantPrincipal.AddToPrincipalPolicy(principal-less Allow statement)). This is not a dry run: for PrincipalWithConditions wrapping an owned role, the probe writes an UNCONDITIONAL Allow identity statement, bypassing the intended condition, then falls back to a conditioned resource statement. Correction required: never use an identity-policy write as a probe; explicitly reject PrincipalWithConditions and unsupported/unknown principal wrappers BEFORE any policy mutation; classify supported principals by concrete type (owned Role/User/Group/LazyRole; mutable imported; established immutable same-account resource fallback); fail closed otherwise; keep the endpoint-specific lambda:InvokeWebFunctionEndpoint action; no new public API. Tests must inspect synthesized policy documents.\n\nR2 (security, confirmed): AccountPrincipal.WithConditions bypasses the plain AccountPrincipal check (IsAccountPrincipal only matched AccountPrincipal/AccountRootPrincipal types or literal \":root\" ARNs; a PrincipalWithConditions wrapper and tokenized fragments slip through). Correction: account-root/account-wide principals must not be accepted through wrappers/tokenized fragments/alternate representations; do not rely on matching an unresolved raw JSON string; recognize known-unsupported categories; reject ambiguous wrappers rather than attempt a resource-policy fallback; never report an AccountPrincipal resource-policy statement as a complete automatic invocation grant. Tests: plain + conditioned AccountPrincipal, AccountRootPrincipal, literal root ArnPrincipal.\n\nR3 (test gaps in WebFunctionSecurityTests + related): (a) self-invocation and mutual-invocation cycle tests must call Template.FromStack; add a real BFF/API cross-reference scenario; assert synthesis succeeds + verify dependency edges. (b) AddToResourcePolicy must defensively copy statements: add a statement, mutate the original, synthesize, assert stored scope/conditions retained; a rejected statement must leave no partially created resource policy. (c) Assert ExternallyManaged annotations actually exist with accurate instructions; assert error messages identify endpoint + grantee; verify no raw ${Token[ leaks. (d) Authorization tests must verify actual identity-policy action/resource ARN/conditions; rejection paths leave no unexpected authorization statements; pin CDK 2.274.0 real principal behavior.\n\nAlso: review whether revision 4 implies unsupported principal wrappers should succeed (report inconsistency; do not edit the design). Validation: Release build; full suite net8.0/9.0/10.0/11.0; all golden tests; focused security/synthesis tests; the 17 existing-construct goldens must stay byte-identical. Keep cdkc-18e.15 open (in_progress) until independent review passes. Export .beads/issues.jsonl. Do not commit T3c. Do not start T4/cdkc-18e.16. No push/PR/deploy/publish.\nT3c CORRECTIVE PASS (R1-R3) COMPLETE. Bead deliberately LEFT OPEN (in_progress): per assignment, do not close until independent review passes.\n\nR1 - ELIMINATED MUTATION-BASED IDENTITY PROBING. WebFunctionGrants no longer calls AddToPrincipalPolicy as a capability probe. Deleted IdentityPolicyCanBeWritten (it wrote an unconditional identity Allow via PrincipalWithConditions and then fell back, bypassing conditions). Identity writes are now decided by pure type classification: IsOwnedMutableIdentity(principal) = principal is Amazon.CDK.AWS.IAM.Role/User/Group/LazyRole AND Resource.IsOwnedResource == true. Added RejectUnsupportedPrincipalWrapper(principal, endpointName): any PrincipalWithConditions is rejected with InvalidOperationException BEFORE any policy mutation. Grant.PrincipalStatements / Grant.Success / AssertSuccess / AddToPrincipalOrResource are not used anywhere.\n\nR2 - CONDITIONED AccountPrincipal BYPASS CLOSED. Replaced IsAccountRootArn with IsAccountRootOrId (recurse IEnumerable (PrincipalJson values are arrays); string: fail-literal when it is an account-root ARN (arn:...:root) OR a 12-digit account id; unresolved tokens not matched). IsAccountPrincipal still keys off the concrete .NET types AccountPrincipal/AccountRootPrincipal first. Account/account-root principals are never established: Automatic throws even same-account, ExternallyManaged writes only a resource statement.\n\nCONSEQUENCE / REQUIRED DESIGN CLARIFICATION (report; do NOT edit design): a mutable imported role and an immutable imported role are indistinguishable via jsii (both IRole._Proxy/IPrincipal._Proxy, is Role false, IsOwnedResource false). With probing forbidden, imported principals can no longer be credited an identity write, so they take the resource-policy fallback on an owned endpoint (0 AWS::IAM::Policy, 1 AWS::Lambda::ResourcePolicy statement) or throw on an imported endpoint. Rev-4 section 10.2 row 'E2 imported same-account role, mutable -\u003e identity policy' is therefore UNIMPLEMENTABLE without a probe; maintainer must reconcile the wording.\n\nFILES CHANGED (T3c, uncommitted): src - Models/WebFunctionValidation.cs (rev-4 validators incl ValidateResourcePolicyStatement/IsServicePrincipal/IsWildcardPrincipal, IEnumerable-aware wildcard detection), Models/WebFunctionEndpointAttributes.cs (added string? Account), WebFunctionConstruct.cs (revision depends on owned role CfnRole only; read-only Endpoints via _endpoints.AsReadOnly(); reserved AddEndpoint id validation; Option-B eager AddResourcePolicyStatement: ValidateResourcePolicyStatement -\u003e statement.Copy(null)+Freeze() -\u003e candidate PolicyDocument(ValidateForResourcePolicy) -\u003e throw on errors -\u003e append to single real PolicyDocument/CfnResourcePolicy), WebFunctionEndpointConstruct.cs (AddToResourcePolicy validates + stores frozen copy), WebFunctionImportedEndpoint.cs (ARN/Domain/Account validation before base Env; Env from endpoint ARN/account), WebFunctionGrants.cs (rev-4 rewrite + R1/R2); NEW IWebFunctionEndpoint.cs (root namespace); DELETED Models/WebFunctionEndpoint.cs. Tests - NEW WebFunctionSecurityTests.cs (43 tests; service/wildcard/account rejection, AddToResourcePolicy restrictions, imported-endpoint validation/Env, cycles incl. BFF/API + self + mutual, frozen-copy, reserved ids, read-only Endpoints, no ${Token[ leaks, annotations via endpoint.Node.Metadata, named CdkUpgradeGuard_* group); modified WebFunctionInvokeGrantTests.cs (service principal throws; env-agnostic owned throws; mutable imported role now resource fallback) + WebFunctionResourcePolicyTests.cs (principal added). GOLDEN: test/.../GoldenTemplates/web-function-use-log-group.json regenerated (only change: SuppliedRoleDefaultPolicy1B06B14F removed from the Revision DependsOn because the revision now depends on the owned role's CfnRole only). All 17 existing-construct goldens byte-identical.\n\nEVIDENCE: Release build 0 warnings / 0 errors. Focused WebFunctionSecurityTests 43/43 pass. Focused WebFunction 239/239 pass. Full suite --solution LayeredCraft.Cdk.Constructs.slnx -c Release: total 1728, failed 0, succeeded 1728, skipped 0 (432 x net8.0/net9.0/net10.0/net11.0; prior 1700 = 425x4). 24 golden tests pass with the 17 existing-construct goldens byte-identical.\nT3c corrective pass #2 (environment-agnostic E1 + R3 test completion) — COMPLETE; bead intentionally left in_progress for independent acceptance.\n\n1) ENVIRONMENT-AGNOSTIC E1 (maintainer-approved): src/WebFunctionGrants.cs GrantInvoke Automatic branch now:\n - owned mutable identity + ENDPOINT in the SAME stack =\u003e WriteIdentityPolicy even when the stack account is an unresolved token (ownership of both in one stack is sufficient).\n - different stacks with MATCHING LITERAL accounts =\u003e identity policy.\n - different stacks with unresolved or mismatched accounts =\u003e InvalidOperationException (matching literal accounts required).\n - imported principals: literal SAME account required; on an owned endpoint they use the resource-policy fallback (never identity).\n - imported endpoints: literal same-account required; GrantInvoke throws for every grantee when the endpoint account cannot be established.\n - cross-account callers fail closed. NO speculative AddToPrincipalPolicy probing anywhere; PrincipalWithConditions / service-principal / wildcard / AccountPrincipal protections unchanged.\n\n2) R1 preserved: no identity-policy mutation probes (type-based IsOwnedMutableIdentity only). R2 preserved: AccountPrincipal/AccountRootPrincipal and account-root/12-digit-id principals rejected (incl. wrapped/tokenized). Unsupported wrapper (PrincipalWithConditions) rejected.\n\n3) R3 test corrections/app additions (test/.../WebFunctionSecurityTests.cs + WebFunctionInvokeGrantTests.cs):\n - SelfInvocationGrant_Synthesizes and MutualInvocationGrant_Synthesizes now call Template.FromStack and assert ResourceCountIs IAM::Policy (1 / 2) and no ResourcePolicy; BFF/API cross-reference test retained.\n - Diagnostics test repurposed to a token-ARN imported endpoint (no Account): asserts InvalidOperationException naming the endpoint construct path + grantee + reason and containing no \"${Token[\" nor \"\u003cunresolved\u003e\"; endpoint construction from a token ARN without Account succeeds.\n - Env-agnostic E1 test now expects identity synthesis (1 AWS::IAM::Policy, 0 AWS::Lambda::ResourcePolicy).\n - New ownership tests: different stacks with matching literal accounts =\u003e identity; different stacks with unresolved accounts =\u003e throws (\"different stack\"); different stacks with mismatched literal accounts =\u003e throws (\"matching literal accounts\"); imported role on imported endpoint =\u003e throws with ZERO policy mutation (serialized template contains neither AWS::IAM::Policy nor AWS::Lambda::ResourcePolicy).\n\n4) VERIFICATION (JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION=1, -c Release): focused -class \"*WebFunction*\" net8.0 =\u003e 250/250 pass. Full suite =\u003e total 1744, failed 0, succeeded 1744, skipped 0 (436 x net8.0/net9.0/net10.0/net11.0; prior 1728=432x4; +4/TFM). Release build 0 warnings / 0 errors. 24 golden tests pass; the 17 existing-construct goldens are byte-identical; the ONLY modified golden is web-function-use-log-group.json (rev-4 execution-role dependency correction: removed SuppliedRoleDefaultPolicy1B06B14F from the Revision DependsOn; the revision now depends on the owned role's CfnRole only).\n\n5) DESIGN CONFLICT (reported, not changed): rev-4 section 10.2 row \"E2 imported same-account role, mutable =\u003e identity policy\" is not implementable without a write-probe because mutable and immutable imported roles are indistinguishable via jsii (.NET); per R1 probing is forbidden, so imported principals use the resource-policy fallback. Maintainer to reconcile wording.\n\nFiles (T3c, uncommitted): src models/constructs/grants as previously listed; tests WebFunctionSecurityTests.cs (new), WebFunctionInvokeGrantTests.cs, WebFunctionResourcePolicyTests.cs (modified); GoldenTemplates/web-function-use-log-group.json (regenerated). T3c NOT committed; no push/PR/deploy/publish; T4/cdkc-18e.16 not started.\nT3c FINAL-ACCEPTANCE CORRECTIONS (independent review: CHANGES REQUIRED — one missing mandatory CDK upgrade-guard regression test + minor diagnostic/doc corrections).\n\nNEW MANDATORY TEST: CdkUpgradeGuard_WithConditionsWrappers_RejectedWithoutPolicies (added to the existing CdkUpgradeGuard_* group in test/.../WebFunctionSecurityTests.cs). Uses real AWS CDK 2.274.0 principal types (NOT mocks):\n var conditions = new Dictionary\u003cstring, object\u003e { [\"Bool\"] = new Dictionary\u003cstring, object\u003e { [\"aws:SecureTransport\"] = \"true\" } };\n var accountWrapped = new AccountPrincipal(\"123456789012\").WithConditions(conditions);\n var arnWrapped = new ArnPrincipal(role.RoleArn).WithConditions(conditions); // role = OwnedRole(stack)\nAssertions: (1) accountWrapped.GetType().FullName == \"Amazon.CDK.AWS.IAM.PrincipalWithConditions\" and same for arnWrapped (plus BeAssignableTo\u003cPrincipalWithConditions\u003e()) — this exercises the ACTUAL jsii-returned wrapper produced by WithConditions (not a manually constructed PrincipalWithConditions); (2) endpoint.GrantInvoke(accountWrapped) and endpoint.GrantInvoke(arnWrapped) each throw InvalidOperationException under CallerPolicy Automatic; (3) same two calls throw under CallerPolicy = ExternallyManaged; (4) after the rejected grants, Template.FromStack synthesis shows ZERO AWS::IAM::Policy and ZERO AWS::Lambda::ResourcePolicy (rejected before any authorization mutation; no partial policy).\nPurpose: detect future CDK upgrades that change principal-wrapper materialization and could reopen the AccountPrincipal authorization bypass.\n\nRUNTIME TYPES OBSERVED FROM JSII: AccountPrincipal(...).WithConditions(...) and ArnPrincipal(...).WithConditions(...) both return runtime type Amazon.CDK.AWS.IAM.PrincipalWithConditions (the CDK 2.274.0 wrapper), which the library rejects via RejectUnsupportedPrincipalWrapper before any policy mutation.\n\nMINOR CORRECTION 1 (diagnostic): src/.../WebFunctionGrants.cs — in the Automatic owned-principal branch, an owned role in an environment-agnostic stack invoking an IMPORTED endpoint no longer throws the misleading \"different stack\" message. It now throws a dedicated message describing the ACTUAL missing condition: the endpoint is imported (its resource policy is externally owned) and the caller's stack account cannot be established, so the library will not write an unverifiable identity policy; remedies = give the caller's stack an explicit environment account matching the endpoint's, import the caller with a literal ARN in the endpoint's account, or use CallerPolicy = ExternallyManaged. The distinct \"different stack ... matching literal accounts are required\" message is retained for the owned-endpoint different-stack case (so GrantInvoke_DifferentStacksUnresolvedAccount_Throws and GrantInvoke_DifferentStacksMismatchedLiteralAccount_ReportsMismatch still pass). No grant behavior changed.\n\nMINOR CORRECTION 2 (XML docs only, no API/behavior change):\n- src/.../IWebFunctionEndpoint.cs: interface docs now state owned endpoints own the function's single resource policy while imported endpoints stay externally owned, that invoke grants are endpoint-scoped to lambda:InvokeWebFunctionEndpoint on that endpoint's ARN, and that GrantInvoke writes the caller's identity policy only when the caller's account can be established (otherwise fail closed) with service/wildcard/account and condition-wrapped principals rejected; the options overload documents Automatic vs ExternallyManaged.\n- src/.../WebFunctionImportedEndpoint.cs: class docs now state it owns no AWS resources, configures a caller identity policy only when caller and endpoint accounts are established and literally equal, never touches the function's resource policy, and derives its account from a literal endpoint ARN else a literal WebFunctionEndpointAttributes.Account (otherwise not established, automatic grants rejected).\n\nTEST STRENGTHENING: SelfInvocationGrant_Synthesizes now inspects the actual emitted identity statement (Action == \"lambda:InvokeWebFunctionEndpoint\"; Resource.GetAtt[1] == \"EndpointArn\") in addition to ResourceCountIs(IAM::Policy,1)/(Lambda::ResourcePolicy,0).\n\nPRESERVED (unchanged, per instruction): pure principal-classification algorithm; same-stack environment-agnostic E1 support; cross-stack literal-account restrictions; imported-role resource-policy fallback; imported-endpoint ownership; service-principal/wildcard/AccountPrincipal rejection; PrincipalWithConditions rejection; eager transactional ValidateForResourcePolicy; revision dependency on the underlying CfnRole; approved rev-4 public API.\n\nVALIDATION: Release build 0 warnings / 0 errors. Focused `-class \"*WebFunctionSecurityTests*\"` (net8.0) 48/48. Full suite `JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION=1 dotnet test --solution LayeredCraft.Cdk.Constructs.slnx -c Release` -\u003e 1748 passed / 0 failed / 0 skipped (437 x net8.0/9.0/10.0/11.0; prior 1744 = 436x4; +1/TFM). All 24 golden tests pass; the 17 existing-construct goldens are byte-identical; the ONLY golden difference remains test/.../GoldenTemplates/web-function-use-log-group.json (intentional rev-4 execution-role dependency correction: removal of SuppliedRoleDefaultPolicy1B06B14F from the Revision DependsOn).\n\nBEADS/GIT: cdkc-18e.15 kept in_progress (open; awaiting maintainer acceptance). T3c remains UNCOMMITTED. Branch main, ahead of origin/main by 5; HEAD ceafce5 (T3b) -\u003e 12ae64b (T3a) -\u003e 705c515 (T2) -\u003e e184a7b (T1) -\u003e 4cf2cb0 (T0) -\u003e b05ca90; NOT pushed. No commit/push/PR/deploy/publish. T4 and cdkc-18e.16 not started.\nT3c ACCEPTED (2026-10-23) after independent security review and the final jsii upgrade-guard test.\n\nREVISION-4 DESIGN VERIFICATION (docs/designs/lambda-web-functions-integration.md)\n- Env-agnostic E1 clarification present: §10.2 E1 restatement (lines 1081-1091): same-stack ownership with an owned endpoint is sufficient even in an env-agnostic stack; cross-stack grants require both stack accounts literal and SAME; unresolved/different accounts rejected before any policy write. §21 third maintainer clarification (lines 1937-1939) records it.\n- Eager transactional resource-policy validation present: §10.3 (lines 1263-1284) and §14 rev-4 row (line 1509): Node.AddValidation is not used; each contribution validates statement-level rules, copies+frozen the statement, builds a candidate PolicyDocument and calls ValidateForResourcePolicy, and only then records it and creates the single CfnResourcePolicy. Implemented in WebFunctionConstruct.AddResourcePolicyStatement and WebFunctionEndpointConstruct.AddToResourcePolicy.\n- All other rev-4 corrections (service principals, wildcards, account principals, verified identity writes, CfnRole-only dependency, imported-endpoint account attribute) are present (§10.2 rev-4 items 1-6; §8.3, §8.4; §21 items 1-10).\n\nJSII UPGRADE-GUARD TEST\n- CdkUpgradeGuard_WithConditionsWrappers_RejectedWithoutPolicies (test/LayeredCraft.Cdk.Constructs.Tests/WebFunctionSecurityTests.cs:678) uses real jsii-returned wrappers: AccountPrincipal('123456789012').WithConditions(...) and ArnPrincipal(role.RoleArn).WithConditions(...); asserts both materialize as Amazon.CDK.AWS.IAM.PrincipalWithConditions; asserts rejection under BOTH CallerPolicy values (Automatic default and ExternallyManaged); and asserts the synthesized template has no AWS::IAM::Policy and no AWS::Lambda::ResourcePolicy.\n\nBUILD/TEST EVIDENCE\n- dotnet build -c Release: Build succeeded, 0 Warning(s), 0 Error(s).\n- Full suite (xUnit v3) on all four TFMs: net8.0 437/0 failed, net9.0 437/0 failed, net10.0 437/0 failed, net11.0 437/0 failed.\n\nGOLDEN TEMPLATES\n- The 17 original (non-Web-Function) golden templates are byte-identical (git reports none modified).\n- Exactly one Web Function golden changed intentionally: web-function-use-log-group.json drops 'SuppliedRoleDefaultPolicy1B06B14F' from the revision DependsOn, per rev-4 item 5 (revision depends on CfnRole only, not the role DefaultPolicy). All other 6 Web Function goldens unchanged; golden tests pass in compare mode.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","assignee":"Nick Cipollina","owner":"ncipollina@gmail.com","created_at":"2026-10-23T12:49:06Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T14:34:20Z","started_at":"2026-10-23T13:14:26Z","closed_at":"2026-10-23T14:34:20Z","close_reason":"T3c accepted after independent security review and the final jsii upgrade-guard test. Revision-4 design verified complete (env-agnostic E1 clarification §10.2; eager transactional resource-policy validation §10.3/§14). CdkUpgradeGuard_WithConditionsWrappers_RejectedWithoutPolicies uses real jsii wrappers and both CallerPolicy modes. Release build 0 warnings; 437 tests pass on net8.0-net11.0. 17 original goldens byte-identical; single intentional web-function-use-log-group.json change (CfnRole-only dependency).","external_ref":"gh-98","labels":["iam","lambda-web-functions","security","t3"],"dependencies":[{"issue_id":"cdkc-18e.15","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T12:49:06Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.15","depends_on_id":"cdkc-18e.5","type":"blocks","created_at":"2026-10-23T12:49:06Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.14","title":"T8: Verify release acceptance criteria and feature completion","description":"Purpose: final completion gate for the feature (closes before the epic). Design §19.1 (items 1–4), §13, §2 goals.\n\nChecklist to verify and record:\n1. Validation gates pass on a clean checkout of the working tree: restore, Release build, full tests on net8.0–net11.0, coverage ≥ 80%, mkdocs build.\n2. Golden templates: existing four constructs zero diff vs the T0 baseline; new construct goldens present.\n3. Workload compatibility: Next.js, ASP.NET Core shim, Blazor Static SSR synthesize via the same public API; no workload-specific construct/helper/packaging in src/.\n4. Sandbox gate bead closed with full evidence (incl. Blazor page + asset).\n5. Scope audit against the design: no EncryptionKey, no FromAsset, no upstream L2/alpha dependency, no changes to existing constructs' source, explicit AuthType everywhere,\n GrantInvoke matches §10.2 rev 3 (no AddToPrincipalOrResource/AssertSuccess), single resource policy, docs complete.\n6. Optional spike bead (T4a) status recorded but does not block.\nOutcome: notes summarizing readiness for the maintainer. Do NOT publish NuGet packages, bump versions, commit, push, open PRs, or close GitHub issue #98 — those require separate maintainer authorization.\n","acceptance_criteria":"- All six checklist items verified with evidence recorded in notes.\n- Any gap results in a linked bug bead and this bead stays open.\n- No publishing/commit/PR actions taken.","notes":"T6a REVIEW FINDING (documentation task; production code NOT changed): the KMS error text in src/LayeredCraft.Cdk.Constructs/Models/WebFunctionCode.cs may mislead about which principal reads the S3 artifact. KmsManagedMessage (L227-228) and DsseManagedMessage (L232) both end with \"...a customer-managed key the function role can read\". In reality Lambda reads and decrypts the code artifact with the Lambda service principal (lambda.amazonaws.com), so the KMS key policy must allow that principal kms:Decrypt; it is not (only) the function execution role. Evaluate rewording before publication (for example \"...a customer-managed key whose key policy allows the Lambda service principal to decrypt\"), and confirm the docs' SSE-KMS guidance (docs/constructs/web-function.md) matches. No production-code change was made during T6a.\nT8 Final release acceptance (2026-10-25). Branch main. Evidence commits: a3a284a (T7c evidence), 1bfe687 (KMS diagnostic wording + service-default log-group docs + tests).\n\nCLEAN CHECKOUT VALIDATION (isolated worktree at a3a284a): restore OK; Release build for 4 TFMs (net8.0/net9.0/net10.0/net11.0) 0 warnings 0 errors; tests 2140/2140 pass, 0 fail, 0 skip (535 x 4); coverage 94.30% line / 98.78% branch (gate 80%); mkdocs build --clean --strict EXIT 0; golden templates 17 existing with zero diff plus 8 new Web Function goldens present; dotnet pack produced nupkg + snupkg, 4 TFMs, MIT, icon/README, sourcelink commit, Amazon.CDK.Lib dependency pinned 2.274.0 (floor confirmed).\n\nPUBLIC API / ARCHITECTURE AUDIT vs design revision 4: conforms. Single resource policy; reserved child ids (Function, Revision, DefaultEndpoint, ExecutionRole, LogGroup, ResourcePolicy) rejected by AddEndpoint; no AddToPrincipalOrResource/AssertSuccess/Grant.Success; no reflection in src; explicit required AuthType; deferrals intact (FromAsset, customer-managed revision KmsKeyArn, upstream CDK L2 replacement). Documented deviation: WebFunctionEndpointConstruct implements IResourceWithPolicyV2 (T3a).\n\nKMS WORDING FIXED: owned-bucket SSE-KMS and DSSE messages now name lambda.amazonaws.com (verified against AWS docs: a customer-managed key policy must allow lambda.amazonaws.com kms:GenerateDataKey and kms:Decrypt because Lambda reads the artifact with its service principal, not the function execution role). Docs were already correct; construct tests strengthened to pin the wording.\n\nDOCS FOLLOW-UP: added service-created default log-group teardown guidance (the Lambda service creates /aws/lambda/web/{name} on first invocation; it is not stack-owned, has no expiry, and survives CloudFormation teardown; delete leftovers by exact name in disposable sandboxes only).\n\nAWS ACCEPTANCE MATRIX (from T7c sandbox; account \u003csandbox-account-id\u003e, us-east-1, library HEAD 47fa84d, AWS CLI 2.38.5): design 19.1 items 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.8 PASS; 3.7 cross-account SKIP (SANDBOX_CROSS_ACCOUNT_CALLER_ROLE_ARN unset; optional; documented as unverified, not unsupported); MultiRegion / PerRegion / SigV4A NOT TESTED. Verified end to end: v1 deploy (3 stacks CREATE_COMPLETE), v1 to v2 revision updates, active revision + endpoint routing, signed/unsigned invocation, imported-role authorization, CloudFront OAC + static assets, second-distribution add/remove, live resource-policy evidence, full teardown with no residual sandbox resources.\n\nT4a (cdkc-18e.7): Outcome B, closed as wont-implement (not feasible with public CDK APIs without template resolution).\n\nRELEASE READINESS: READY FOR RELEASE with documented limitations. Next version v2.6.0 (release-drafter minor via type:feat); CDK floor 2.274.0. Residual risks: cross-account path unverified; MultiRegion/SigV4A runtime-untested; F3006 warnings documented; docs CI runs mkdocs --clean (not --strict) though local strict passes; VersionPrefix in Directory.Build.props is 2.4.0 (local pack-local.sh only; release workflow derives the version from the tag).\n\nSTOPPED before publish: nothing pushed, no merge, no NuGet publish, issue #98 left OPEN. Changes committed locally only.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","assignee":"Nick Cipollina","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:59Z","created_by":"Nick Cipollina","updated_at":"2026-10-25T23:45:50Z","started_at":"2026-10-25T18:14:26Z","closed_at":"2026-10-25T18:19:50Z","close_reason":"T8 final release acceptance complete: clean-checkout validation, public API audit, KMS wording fix, docs follow-up, AWS acceptance matrix, release-readiness verdict READY FOR RELEASE. Stopped before publish.","external_ref":"gh-98","labels":["lambda-web-functions","release-gate","t8"],"dependencies":[{"issue_id":"cdkc-18e.14","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:59Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.14","depends_on_id":"cdkc-18e.10","type":"blocks","created_at":"2026-10-23T01:15:24Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.14","depends_on_id":"cdkc-18e.13","type":"blocks","created_at":"2026-10-23T01:15:22Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.14","depends_on_id":"cdkc-18e.8","type":"blocks","created_at":"2026-10-23T01:15:23Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.14","depends_on_id":"cdkc-18e.9","type":"blocks","created_at":"2026-10-23T01:15:23Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":4,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.13","title":"T7c: Run AWS sandbox deployment and smoke test (mandatory release gate)","description":"MANDATORY release gate before NuGet publication. Requires explicit maintainer authorization and maintainer-provided NON-PRODUCTION sandbox AWS credentials. Do not start without both.\nDesign §19.1 (AUTHORITATIVE), §15 \"Deployed validation\".\n\nSteps: using samples/web-functions (previous beads), build artifacts, deploy (artifacts stack → upload → app stack), run smoke.sh, then perform the update scenarios\n(v2 artifacts → new revision active and endpoints moved; add then remove second distribution → statement added then removed), and destroy everything.\n\nMust verify and record (status codes, revision IDs, policy JSON excerpts):\n3.1 artifact deployment from both bucket-policy modes (Automatic owned bucket, ExternallyManaged pre-provisioned bucket);\n3.2 function/revision/endpoints Active; redeploy with changed artifact activates a new revision and moves endpoints;\n3.3 SigV4-signed request by the granted caller role → 2xx;\n3.4 unsigned → 403; signed by an ungranted role → 403; signed for the second endpoint the role was not granted → 403;\n3.5 through CloudFront → 2xx; direct unsigned to the IamAuth endpoint → 403;\n3.6 get-resource-policy contains exactly the expected statements; second distribution adds a scoped statement; removing it removes the statement;\n3.7 cross-account (only if a second sandbox account is available): ExternallyManaged grant + caller-account identity policy → success; without identity policy → denied; otherwise record \"not verified\";\n3.8 Next.js page via CloudFront; ASP.NET Core endpoint (signed); Blazor Static SSR rendered page AND static asset served.\nAlso record: date, account alias (no account secrets), region, CDK version, library commit/working-tree state, and any criterion not verified.\n\nCleanup is required: run destroy.sh, verify no stacks, buckets (all versions), log groups, distributions, or roles remain; record verification.\nThis bead must NOT be closed on synthesis results alone. If any check fails, record it, file a bug bead linked to the responsible implementation bead, and leave this bead open.\nExclusions: production accounts, Sharedale resources, publishing, commits/PRs.\n","acceptance_criteria":"- Every §19.1 item 3.1–3.8 is recorded as passed with evidence (3.7 may be \"not verified\" only when no second sandbox account exists, stated explicitly).\n- Blazor Static SSR page and static asset verified in AWS.\n- All sandbox resources destroyed and verified.\n- Evidence stored in bead notes (and the release PR description when one is authorized).","notes":"REVIEW ROUTING (2026-10-23, design revision 4 §19.1 item 3.3): also verify and record:\n- first-deploy behavior while the caller's identity policy propagates (the revision no longer depends on the role DefaultPolicy; record any transient 403 window);\n- a same-account grant written only as a resource-policy statement (immutable imported role) returns 2xx;\n- an identity-only same-account grant returns 2xx;\n- the deployed ResourceArn (function ARN) and the code-bucket aws:SourceArn .../revision/* + aws:SourceAccount conditions are accepted and effective.\nThis bead now also waits for cdkc-18e.16 (owned-bucket inspection follow-up).\nFrom T4 independent review: during sandbox validation, verify OriginAccessControl naming across AWS Regions. CDK auto-generates the OAC Name; confirm there is no account-global OAC naming collision when the same Web Function origin is deployed in multiple Regions/stacks, and that the generated name is stable.\nT7c AWS deployment + smoke acceptance gate COMPLETE (observed 2026-10-24).\n\nTARGET: account \u003csandbox-account-id\u003e (IAM user \u003csandbox-iam-user\u003e), region us-east-1, sandbox id \u003csandbox-id\u003e, namespace lccdk-wf-sandbox-\u003csandbox-id\u003e. Library revision at test time: HEAD 47fa84d (T7b 0e9ecde; CLI-2.38.x smoke align 80a61a1; shared-account auth 90675e4; live-policy parser fix 47fa84d). AWS CLI 2.38.5.\n\nARTIFACTS (build id 90675e42785c; v2 = 90675e42785c-v2):\nnextjs.zip sha256 50931ee444d3c25e / nextjs-v2 50a7ec8bd967c804\naspnetcore.zip 710da153c1c6bcc2 / aspnetcore-v2 446e5151ca1abf12\nblazor.zip 3f4a861d7e2bfdc0 / blazor-v2 155af1b566ecf663\n\nV1 DEPLOY: 3 stacks CREATE_COMPLETE (artifacts/external/app), app deploy 238.22s. CloudFormation ACCEPTED the experimental AWS::Lambda::WebFunction / WebFunctionRevision / WebFunctionEndpoint resource types (only F3006 warnings). v1 revisions: nextjs rev-gkdoq, aspnetcore rev-23ls9, blazor rev-gsy99. v1 smoke PASS=44 FAIL=0 SKIP=1 BLOCKED=0; build ids 90675e42785c; cold 200 ~2.0s warm 200 ~0.16s; signed caller/imported-immutable/imported-mutable all 200 (resource-policy-only immutable+mutable = 200 =\u003e design 19.1 3.3 rev-4 satisfied); unsigned 403, no-grant role 403, endpoint-scoped 403; Next.js+Blazor via CloudFront OAC 200; Next.js/blazor policies 1 CloudFront statement each; aspnetcore policy 2 role principals; imported roles have no identity invoke policy; caller identity policy scoped to lambda:InvokeWebFunctionEndpoint; policy completeness 3/3. Cross-account SKIP.\n\nV2 UPDATE: update-to-v2.sh; revisions nextjs rev-bfcec, aspnetcore rev-sxp6k, blazor rev-rpzmu (all changed, Active, weight 100). v2 smoke PASS=48 FAIL=0 SKIP=1 BLOCKED=0; build ids 90675e42785c-v2; v1-\u003ev2 transition 'all functions advanced' PASS.\n\nSECOND DISTRIBUTION: add (deploy --revision 2 --second-distribution) -\u003e new distribution \u003ccf-dist-c\u003e (\u003ccf-dist-c-domain\u003e); Next.js resource policy 2 CloudFront statements; smoke PASS=49 FAIL=0 SKIP=1 BLOCKED=0. remove (deploy --revision 2) -\u003e policy back to 1 statement, second OAC removed, original distribution still 200; post-remove smoke PASS=48 FAIL=0 SKIP=1 BLOCKED=0. Each app deploy advances the revision (construct creates a revision per deploy); post-remove generation rev-bjzgq/rev-lx7eh/rev-bmist.\n\nTRANSIENT 403: authorization checks use retry/backoff; no persistent 403 observed - first-deploy propagation window recorded, all granted invocations succeeded.\n\nNOT VERIFIED: cross-account (19.1 3.7) - SANDBOX_CROSS_ACCOUNT_CALLER_ROLE_ARN unset (SKIP, optional). MultiRegion/PerRegion/SigV4A NOT tested (single HomeRegion endpoint). OAC cross-Region naming not exercised (single region).\n\nTEARDOWN: destroy.sh --yes with SANDBOX_CONFIRM_DESTROY=\u003csandbox-id\u003e + shared-account ack; all 3 stacks destroyed. Independent verification: no active stacks (all DELETE_COMPLETE), no \u003csandbox-id\u003e S3 buckets, no \u003csandbox-id\u003e IAM roles/policies, distributions \u003ccf-dist-a\u003e/\u003ccf-dist-b\u003e/\u003ccf-dist-c\u003e all NoSuchDistribution, no OACs, no /aws/lambda/web log groups, resourcegroupstaggingapi sandbox-id=\u003csandbox-id\u003e returns none, lambda-web functionCount=0. Note: 3 service-created orphaned log groups (/aws/lambda/web/\u003csandbox-id\u003e-*.local; AppStack used service-default logs so CFN never owned them; untagged, 0 bytes) survived the CFN destroy and were removed explicitly by exact name, then re-verified absent.\n\nRESULT: 19.1 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.8 PASS on live AWS; 3.7 SKIP (optional/unconfigured). All mandatory scenarios PASS; sandbox fully removed.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:58Z","created_by":"Nick Cipollina","updated_at":"2026-10-25T23:45:51Z","started_at":"2026-10-24T23:32:13Z","closed_at":"2026-10-25T03:10:54Z","close_reason":"T7c mandatory AWS deployment + smoke gate PASSED and sandbox torn down. Account \u003csandbox-account-id\u003e/us-east-1, sandbox \u003csandbox-id\u003e. 19.1: 3.1-3.6,3.8 PASS on live AWS; 3.7 cross-account SKIP (optional, unconfigured). v1 revisions rev-gkdoq/rev-23ls9/rev-gsy99; v2 rev-bfcec/rev-sxp6k/rev-rpzmu; build ids 90675e42785c[-v2]. Second-distribution add/remove verified (policy stmt added then removed). Teardown verified: no stacks/buckets/roles/policies/distributions/OACs/log groups/tagged resources; lambda-web functionCount 0. Full evidence in notes.","external_ref":"gh-98","labels":["lambda-web-functions","release-gate","requires-aws","requires-maintainer-authorization","sandbox","t7"],"dependencies":[{"issue_id":"cdkc-18e.13","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:58Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.13","depends_on_id":"cdkc-18e.12","type":"blocks","created_at":"2026-10-23T01:15:20Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.13","depends_on_id":"cdkc-18e.16","type":"blocks","created_at":"2026-10-23T12:49:20Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.13","depends_on_id":"cdkc-18e.8","type":"blocks","created_at":"2026-10-23T01:15:20Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.13","depends_on_id":"cdkc-18e.9","type":"blocks","created_at":"2026-10-23T01:15:21Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":4,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.8","title":"T5: Add Web Function testing helpers, consumer example and workload synthesis tests","description":"Purpose: consumer-facing Testing helpers plus consumer/workload compilation and synthesis tests. Design §8.6, §9 (all examples), §15 (Consumer helpers, Workloads), §19.1 item 2.\n\nDeliverables:\n- src/LayeredCraft.Cdk.Constructs/Testing/WebFunctionConstructAssertions.cs: extension methods on Template per §8.6 (ShouldHaveWebFunction, ShouldHaveRevision, ShouldHaveRevisionCode,\n ShouldHaveEndpoint, ShouldHaveEndpointScaling, ShouldHaveInvokeGrant, ShouldHaveSingleResourcePolicy, ShouldHaveNoResourcePolicy, ShouldAllowCloudFront,\n ShouldAllowResourcePolicyPrincipal, ShouldHaveWebFunctionOac, ShouldHaveCodeBucketReadStatement). Match by function/endpoint NAMES (resolve the endpoint's logical ID\n from its EndpointName), never by logical-ID prefixes; must distinguish multiple endpoints. Follow existing *ConstructAssertions style.\n- src/LayeredCraft.Cdk.Constructs/Testing/WebFunctionConstructPropsBuilder.cs per §8.6 (private fields; WithFunctionName, WithCode, WithTestArtifact(Construct scope, key),\n WithIamAuthEndpoint, WithApplicationManagedEndpoint, WithEndpoint(IWebFunctionEndpointOptions), WithEnvironmentVariable, WithEntryPoint, WithTimeout,\n WithMaxConcurrencyPerEnvironment, WithRole, WithLogs; Build() throws InvalidOperationException without Code or endpoint; no Action\u003c\u003e callbacks; never chooses an AuthType).\n- CdkTestHelper.CreateWebFunctionPropsBuilder() (additive change to CdkTestHelper only).\n- Internal test kit: WebFunctionConstructAutoData attribute + customization (deterministic names) following existing TestKit patterns.\n- Consumer example tests: compile and synthesize §9.1–§9.7 verbatim-equivalent code using only the public API.\n- Workload synthesis tests (acceptance criterion §19.1 item 2): Next.js, ASP.NET Core (execve shim), Blazor Static SSR — each via the same public API, differences only in\n Code, EntryPoint, EnvironmentVariables, and consumer CloudFront behaviors.\n\nTests: assertion helpers have positive and negative tests (failing assertions throw); builder tests (Build() throws without auth/code; WithTestArtifact synthesizes without credentials).\nExclusions: new production behavior in constructs (if a gap is found, record a blocker rather than changing construct semantics); docs.\n","acceptance_criteria":"- Assertions and builder exist with the §8.6 signatures; CdkTestHelper entry added without changing existing helper behavior.\n- §9 examples and three workload configurations compile and synthesize in tests.\n- Assertions distinguish multiple endpoints and verify exactly-one resource policy.\n- Coverage threshold (80%) maintained; existing goldens unchanged; validation gates pass.","notes":"T5 IMPLEMENTATION COMPLETE (not committed).\n\nDeliverables:\n- NEW src/LayeredCraft.Cdk.Constructs/Testing/WebFunctionConstructAssertions.cs: 12 Template extension methods per design 8.6 (ShouldHaveWebFunction, ShouldHaveRevision, ShouldHaveRevisionCode, ShouldHaveEndpoint, ShouldHaveEndpointScaling, ShouldHaveInvokeGrant, ShouldHaveSingleResourcePolicy, ShouldHaveNoResourcePolicy, ShouldAllowCloudFront, ShouldAllowResourcePolicyPrincipal, ShouldHaveWebFunctionOac, ShouldHaveCodeBucketReadStatement). Matches by function/endpoint NAMES, resolving the endpoint logical id from its EndpointName; discriminates multiple endpoints; verifies exactly-one resource policy.\n- NEW src/LayeredCraft.Cdk.Constructs/Testing/WebFunctionConstructPropsBuilder.cs per design 8.6: private fields; With* methods (WithFunctionName, WithCode, WithTestArtifact, WithIamAuthEndpoint, WithApplicationManagedEndpoint, WithEndpoint, WithEnvironmentVariable, WithEntryPoint, WithTimeout, WithMaxConcurrencyPerEnvironment, WithDescription, WithRole, WithLogs); Build() throws InvalidOperationException when Code or the endpoint (AuthType) was never chosen; never picks an auth mode.\n- MODIFIED src/LayeredCraft.Cdk.Constructs/Testing/CdkTestHelper.cs: additive CreateWebFunctionPropsBuilder() only; existing helpers unchanged.\n- NEW test/LayeredCraft.Cdk.Constructs.Tests/TestKit/Attributes/WebFunctionConstructAutoDataAttribute.cs and test/.../TestKit/Customizations/WebFunctionConstructCustomization.cs: deterministic props via a substitute IBucket (BucketName test-web-function-artifacts) with ExternallyManaged code so synthesis needs no AWS credentials.\n- NEW test/.../WebFunctionConsumerExamplesTests.cs: 7 tests compiling and synthesizing design 9.1-9.7 using only the public API.\n- NEW test/.../WebFunctionWorkloadTests.cs: 4 tests (Next.js, ASP.NET Core Node.js execve shim, Blazor Static SSR shim, AllWorkloads) using only the same public construct; differences only in Code, EntryPoint, EnvironmentVariables, and consumer CloudFront behaviors.\n- NEW test/.../Testing/WebFunctionConstructTestingHelpersTests.cs: about 34 tests covering the assertion helpers (positive and negative) and the props builder.\n\nEvidence:\n- dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release: 0 Warning(s), 0 Error(s).\n- JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION=1 dotnet test --solution LayeredCraft.Cdk.Constructs.slnx -c Release: Passed, total 2084, failed 0 (521 per TFM x net8.0/net9.0/net10.0/net11.0; +45 per TFM vs the 1904 baseline).\n- Golden templates: no file added or modified; the 17 original existing-construct goldens remain byte-identical.\n\nNotes: no production construct behavior changed and no gap requiring a construct change was found. Do not commit T5 automatically.\nT5 CORRECTIONS APPLIED (independent review D1-D10) — awaiting maintainer acceptance, NOT committed.\n\nReview verdict was CHANGES REQUIRED: public testing assertions could produce false positives/negatives. All findings addressed within T5 scope; no production construct changed.\n\nD1 (function-specific endpoint lookup): WebFunctionConstructAssertions.EndpointLogicalId now requires BOTH the literal FunctionName and EndpointName (calls FunctionLogicalId first, then filters endpoints on EndpointName==name \u0026\u0026 FunctionName==name); throws \"No Web Function endpoint named '\u003cname\u003e' was found on function '\u003cfn\u003e'.\" Tests: ShouldHaveInvokeGrant_ShouldNotBeSatisfiedByAnotherFunctionsEndpoint and ShouldAllowCloudFront_ShouldNotBeSatisfiedByAnotherFunctionsEndpoint (two functions, each with a \"default\" endpoint; grant only on function-b; function-a assertions throw).\n\nD2 (function-specific S3 assertion): ShouldHaveCodeBucketReadStatement(functionName) now requires the statement's ArnLike aws:SourceArn condition to contain \"web-function/{functionName}/revision/*\" (new StatementSourceArnContains + FlattenArn that flattens Fn::Join literal segments), plus Effect=Allow, s3:GetObject, lambda.amazonaws.com service principal, and StringEquals aws:SourceAccount. Test: ShouldHaveCodeBucketReadStatement_ShouldNotBeSatisfiedByAnotherFunctionsPolicy (only function-a owns an Automatic bucket policy).\n\nD3 (IAM policy minimization): assertion now accepts Resource as either a single endpoint ARN or an array (ResourceTargetsEndpoint handles IEnumerable). Real synthesis test ShouldHaveInvokeGrant_ShouldMatchMinimizedArrayResourceStatement enables @aws-cdk/aws-iam:minimizePolicies via AppProps.Context before construct creation, grants one role both endpoints, asserts both ShouldHaveInvokeGrant calls succeed AND asserts the merged AWS::IAM::Policy statement Resource is a 2-element array (proves the flag really merged; array path genuinely exercised). Deterministic array case also covered by ShouldHaveInvokeGrant_ShouldMatchArrayResourceStatement (explicit PolicyStatement with Resources=[arn1,arn2]).\n\nD4 (ambiguous scaling): public signature of ShouldHaveEndpointScaling unchanged; when multiple endpoints share the requested EndpointName it now throws InvalidOperationException containing \"ambiguous\" (actionable text) instead of selecting the first. Test: ShouldHaveEndpointScaling_ShouldThrowWhenEndpointNameIsAmbiguous.\n\nD5 (authorization semantics): ShouldHaveInvokeGrant, ShouldAllowCloudFront and ShouldAllowResourcePolicyPrincipal now all require Effect=Allow + Action=lambda:InvokeWebFunctionEndpoint + exact endpoint resource (and principal/condition as appropriate). Deny-only and wrong-action statements are rejected. Negative tests use real synthesized resource policies incl. valid Deny: ShouldHaveInvokeGrant_ShouldRejectDenyStatement, ShouldHaveInvokeGrant_ShouldRejectUnrelatedAction (lambda:InvokeFunction), ShouldAllowCloudFront_ShouldRejectDenyStatement, ShouldAllowCloudFront_ShouldRejectWrongActionStatement, ShouldAllowResourcePolicyPrincipal_ShouldRejectDenyStatement.\n\nD6 (jsii-safe AutoData): WebFunctionConstructCustomization no longer substitutes IBucket (jsii-unmarshalable). It now builds a real imported bucket via Bucket.FromBucketName on a stack-scoped fixture (new App + Stack \"WebFunctionFixtureStack\"). Test [Theory][WebFunctionConstructAutoData] WebFunctionConstructAutoData_ShouldSupplySynthesizableProps(WebFunctionConstructProps props) consumes the attribute and synthesizes (ShouldHaveWebFunction/ShouldHaveEndpoint; ResourceCountIs AWS::S3::Bucket 0), proving attribute+customization work end-to-end without AWS credentials.\n\nD7 (artifact construct-ID collisions): WithTestArtifact reuses an existing compatible bucket (scope.Node.TryFindChild(\"WebFunctionTestArtifacts\") as IBucket) before creating the imported bucket, so multiple Web Functions in one stack share it. Test: WithTestArtifact_ShouldSupportMultipleFunctionsInOneStack.\n\nD8 (builder state isolation): Build() now copies the environment dictionary (new Dictionary\u003cstring,string\u003e(_environmentVariables)) instead of exposing the live field. Test: Build_ShouldIsolateEnvironmentDictionary (mutating the builder after Build() does not change previously built props).\n\nD9 (workload examples): Next.js entry point aligned with the approved index.js shim (code key artifacts/web.zip, EntryPoint index.js, NODE_ENV=production, NEXT_TELEMETRY_DISABLED=1). Removed invented DOTNET_RUNNING_IN_CONTAINER and BLAZOR_STATIC_SSR env vars. ASP.NET Core and Blazor Static SSR now differ by artifact (api.zip vs blazor.zip) and are documented as the same shim contract. Class doc states these are synthesis-only; runtime behavior is covered by deployed smoke tests in T7c. Recipes cite design §16.\n\nD10 (consumer examples): §9.2 now asserts the revision S3Object Key=web.zip + VersionId=version-1 directly; §9.6 asserts the worker's invocation grant (ShouldHaveInvokeGrant(\"worker\",\"default\")); §9.1/§9.3/§9.7 comments document externally-managed permission ownership (caller policy, bucket policy, origin permissions). All examples use only the public API.\n\nVALIDATION EVIDENCE: dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release =\u003e 0 warnings / 0 errors. Full 4-TFM suite =\u003e total 2140, failed 0, skipped 0 (535 per TFM on net8.0/net9.0/net10.0/net11.0; +56 vs the pre-correction 2084). Focused WebFunctionConstructTestingHelpersTests =\u003e 48/48 pass. Consumer examples 7/7. GoldenTemplates dir: no files added or modified — all 17 existing-construct goldens byte-identical. No production construct behavior changed; no unresolved design issue.\nT5 ACCEPTED by maintainer after independent review and correction of D1-D8 (plus D9-D10). Final validation: Release build 0 warnings/0 errors; full 4-TFM suite total 2140, failed 0; all 17 existing-construct goldens byte-identical. Committed locally as 'test: add Web Function testing helpers and consumer examples'. Not pushed.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","assignee":"Nick Cipollina","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:53Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T16:32:04Z","started_at":"2026-10-23T15:49:15Z","closed_at":"2026-10-23T16:32:04Z","close_reason":"T5 accepted and complete: WebFunctionConstructAssertions + WebFunctionConstructPropsBuilder + CdkTestHelper entry, jsii-safe AutoData/customization, consumer examples 9.1-9.7, three workload synthesis tests, helper tests (48); review findings D1-D10 corrected; full suite 2140 pass on 4 TFMs; 17 goldens unchanged.","external_ref":"gh-98","labels":["lambda-web-functions","t5","testing"],"dependencies":[{"issue_id":"cdkc-18e.8","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:53Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.8","depends_on_id":"cdkc-18e.5","type":"blocks","created_at":"2026-10-23T01:15:16Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.8","depends_on_id":"cdkc-18e.6","type":"blocks","created_at":"2026-10-23T01:15:15Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":2,"dependent_count":3,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.6","title":"T4: Implement WebFunctionOrigin with OAC and automatic same-stack permissions","description":"Purpose: CloudFront origin factory with OAC and automatic, same-stack permission granting. Design §5.4, §8.5, §9.4, §9.7, §11.1 (AUTHORITATIVE steps), §11.2 (spike results), §12.3, §14, §15 (CloudFront/OAC).\n\nDeliverables (src/LayeredCraft.Cdk.Constructs/WebFunctionOrigin.cs + internal origin class):\n- public static class WebFunctionOrigin:\n * WithOriginAccessControl(IWebFunctionEndpoint, WebFunctionOriginWithOacProps? = null): throws immediately for ApplicationManaged endpoints.\n * WithoutOriginAccessControl(IWebFunctionEndpoint, WebFunctionOriginProps? = null): throws for IamAuth endpoints; returns an HTTPS HttpOrigin.\n- internal sealed class WebFunctionOacOrigin : DeputyBase, IOrigin (jsii interface implemented from .NET; proven by spike) whose Bind(scope, options):\n 1. Signing: HomeRegion/PerRegion → Signing.SIGV4_ALWAYS_AMZ_AUTH; MultiRegion → new Signing(SigningProtocol.SIGV4A, SigningBehavior.ALWAYS_AMZ_AUTH).\n 2. OAC: use supplied IOriginAccessControl unchanged (not inspected), else create one L2 FunctionUrlOriginAccessControl with child id \"WebFunctionOac\" in the bind scope. No CfnOriginAccessControl.\n 3. Permissions Automatic: imported endpoint → throw; Stack.Of(scope) != Stack.Of(endpoint) → throw with the same-stack/dependency-cycle message and ExternallyManaged remedy;\n else endpoint.GrantCloudFrontInvoke(Stack.Of(scope).FormatArn({Service=\"cloudfront\", Region=\"\", Resource=\"distribution\", ResourceName=options.DistributionId})).\n ExternallyManaged: no statement; Annotations info naming the distribution that must be allowed.\n 4. Return new HttpOrigin(endpoint.DomainName, {mapped WebFunctionOriginProps members, ProtocolPolicy=HTTPS_ONLY, OriginAccessControlId=oac id}).Bind(scope, options).\n- No opt-in Region list, no distribution behavior inspection, no IValidation (design §11.1 \"Removed in revision 2\").\n\nTests: OAC lambda/always-amz-auth/sigv4 for HomeRegion \u0026 PerRegion, sigv4a for MultiRegion; origin DomainName = endpoint DomainName, https-only, OriginAccessControlId set;\nevery WebFunctionOriginProps member passes through; auto statement aws:SourceArn = distribution ARN; same origin on two behaviors → one statement and one OAC;\ntwo distributions → two scoped statements; origin for a second endpoint → statement on that endpoint ARN; supplied OAC reused (none created); ExternallyManaged → no statement + annotation;\nexplicit GrantCloudFrontInvoke(literal ARN) without a Distribution; negatives: ApplicationManaged+OAC, IamAuth+WithoutOriginAccessControl, imported+Automatic, cross-stack+Automatic\n(assert the library's error message, not a CDK DependencyCycle). Golden template: Next.js-style distribution (§9.4) with default + /_next/static/* behaviors on one origin.\n\nExclusions: Distribution/certificate/DNS creation by the library; behavior helpers; Testing helpers; docs.\nSecurity: OAC only for IamAuth; never forward-compatible \"convenience\" that would let an ApplicationManaged endpoint appear protected.\n","acceptance_criteria":"- WebFunctionOrigin public API matches §8.5; Bind behavior matches §11.1 steps 1–5.\n- Uses L2 FunctionUrlOriginAccessControl with correct Signing; no L1 OAC, no custom resources.\n- Automatic permissions only for owned endpoints in the same stack; imported/cross-stack fail with library messages; ExternallyManaged annotated.\n- All listed tests pass; new golden template added; existing goldens unchanged; validation gates pass.","notes":"REVIEW ROUTING (2026-10-23, design revision 4): T4 is now blocked by T3c (cdkc-18e.15).\nConsume the post-T3c API:\n- IWebFunctionEndpoint moves to namespace LayeredCraft.Cdk.Constructs.\n- Treat any IWebFunctionEndpoint other than WebFunctionEndpointConstruct as imported (Automatic permissions throw).\n- Imported endpoints take Env from their ARN.\n- AddToResourcePolicy stores frozen copies and rejects unconditioned wildcard/service-principal Allow statements. GrantCloudFrontInvoke is unaffected because it is SourceArn-conditioned.\n- 'ResourcePolicy' and the other reserved ids are rejected by AddEndpoint, so the lazily created policy cannot collide during Bind.\nMaintainer clarification (2026-10-23):\n- WebFunctionEndpointAttributes gains an optional Account (T3c).\n- Imported endpoints whose account is not established (token ARN, no literal Account) cannot be GrantInvoke'd, but MUST be accepted by WebFunctionOrigin.WithOriginAccessControl with Permissions = WebFunctionOriginPermissions.ExternallyManaged. Add a T4 test for a token-ARN imported endpoint as an ExternallyManaged OAC origin.\n- IWebFunctionEndpoint is in namespace LayeredCraft.Cdk.Constructs.\nT4 IMPLEMENTED (not committed). Files: src/LayeredCraft.Cdk.Constructs/WebFunctionOrigin.cs (factory: WithOriginAccessControl requires IamAuth; WithoutOriginAccessControl requires ApplicationManaged; maps WebFunctionOriginProps -\u003e HttpOriginProps, forces HTTPS_ONLY), src/LayeredCraft.Cdk.Constructs/WebFunctionOacOrigin.cs (internal sealed : DeputyBase, IOrigin; binds at distribution time), test/LayeredCraft.Cdk.Constructs.Tests/WebFunctionOriginTests.cs (+20 tests), WebFunctionConstructGoldenTemplateTests.cs (+1), GoldenTemplates/web-function-cloudfront-oac.json (new). Architecture: one FunctionUrlOriginAccessControl child 'WebFunctionOac' created in the bind/origin scope unless supplied; signing = sigv4 (HomeRegion/PerRegion) or sigv4a (MultiRegion) via new Signing(SIGV4A, ALWAYS_AMZ_AUTH), always-amz-auth, origin type lambda; HttpOrigin uses endpoint DomainName, HTTPS_ONLY, OriginAccessControlId. Permissions: Automatic same-stack owned endpoint -\u003e single WebFunctionConstruct resource-policy statement via endpoint.GrantCloudFrontInvoke(Stack.FormatArn cloudfront distribution id), cloudfront.amazonaws.com + aws:SourceArn; imported endpoint and cross-stack distribution -\u003e actionable InvalidOperationException message; ExternallyManaged -\u003e no statement + info annotation naming distribution. Imported/token-ARN endpoints supported with ExternallyManaged. Test evidence: Release build 0 warnings/0 errors; full suite total 1884 (471 x net8/9/10/11), 0 failed, 0 skipped; 17 original goldens byte-identical (no diff); new OAC golden verified. CDK compat finding: validation exceptions thrown inside IOrigin.Bind cross the jsii boundary and surface to .NET callers as System.Exception embedding the InvalidOperationException text; factory-time validation (auth mismatch, nulls) still throws InvalidOperationException directly. Design requirement 'actionable message, not CDK cycle' is satisfied; tests assert the message. CDK 2.274.0 L2 extension points (HttpOrigin, FunctionUrlOriginAccessControl, IOrigin.Bind) are sufficient.\nT4 INDEPENDENT-REVIEW CORRECTIONS (F1-F5) APPLIED (round 2, not committed). Architecture unchanged: WebFunctionOrigin factory API, WebFunctionOacOrigin (DeputyBase/IOrigin), HttpOrigin delegation, FunctionUrlOriginAccessControl, IamAuth/ApplicationManaged restrictions, sigv4/sigv4a behavior, single-owner resource policy, and imported-endpoint permissions model all preserved.\n\nF1 - No partial mutation during binding:\n- WebFunctionOrigin gains private ValidateOriginConfiguration(domainName, props) =\u003e _ = new HttpOrigin(domainName, BuildHttpOriginProps(props, null)). It reuses CDK's own HttpOrigin constructor validation (no duplicated rules) and runs at factory time in WithOriginAccessControl before any OAC or policy statement exists. WithoutOriginAccessControl already validates because it returns a real HttpOrigin at factory.\n- WebFunctionOacOrigin.Bind reordered: (1) resolve/create OAC, (2) build HttpOrigin (validates), (3) ApplyPermissions, (4) origin.Bind.\n- New test WithOriginAccessControl_InvalidConnectionAttempts_ShouldFailBeforeCreatingResources: factory throws (\"*connectionAttempts*\") and the stack is left with zero AWS::CloudFront::OriginAccessControl and zero AWS::Lambda::ResourcePolicy.\n\nF2 - ExternallyManaged guidance corrected:\n- Owned endpoints: annotation keeps GrantCloudFrontInvoke guidance and names the distribution, the cloudfront.amazonaws.com service principal, and the aws:SourceArn condition.\n- Imported endpoints: annotation now tells the Web Function owner to add an endpoint-scoped resource-policy statement for cloudfront.amazonaws.com guarded by a StringEquals aws:SourceArn condition, names the distribution, and identifies the endpoint by literal ARN when available, otherwise by name+domain (never raw token placeholders).\n\nF3 - Origin property forwarding: new WithOriginAccessControl_ShouldForwardAllOriginProps and WithoutOriginAccessControl_ShouldForwardAllOriginProps cover every supported WebFunctionOriginProps member (OriginId, OriginPath, CustomHeaders, ConnectionAttempts, ConnectionTimeout, ReadTimeout, KeepaliveTimeout, ResponseCompletionTimeout, OriginShieldEnabled, OriginShieldRegion) in synthesized CloudFormation for both paths. No extra abstractions added.\n\nF4 - Annotation assertions: ExternallyManaged tests now assert the actual distribution path (test-stack/distribution), that owned vs imported guidance differ, and that each message is actionable (principal, condition, remedy). Generic single-word assertions removed.\n\nF5 - Same origin reused across distributions: new WithOriginAccessControl_SameOriginInstanceAcrossDistributions_ShouldScopeEachGrant reuses one IOrigin instance in two distributions and verifies two OACs, two endpoint-scoped aws:SourceArn statements (distinct distributions), one owning AWS::Lambda::ResourcePolicy, and no construct-id collision.\n\nValidation evidence:\n- dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release: 0 warnings, 0 errors.\n- Full suite: total 1904, failed 0, skipped 0 (476 x net8.0/9.0/10.0/11.0).\n- Focused: WebFunctionOriginTests 25/25; WebFunctionConstructGoldenTemplateTests 8/8; ExistingConstructsGoldenTemplateTests 17/17.\n- The 17 original existing-construct goldens are byte-identical. The new web-function-cloudfront-oac.json golden was NOT changed by these corrections (no intentional change; the corrections do not alter the synthesized OAC/IAM for the same-stack Automatic path).\n\nCDK compatibility fact (IOrigin.Bind exception behavior): new HttpOrigin(domainName, props) validates synchronously at construction and throws System.Exception (jsii-wrapped). Ranges: connectionAttempts 1-3; connectionTimeout 1-10 seconds; readTimeout/keepaliveTimeout 1-60 seconds. This is why F1 validation is possible at factory time.\n\nFollow-ups recorded on existing beads (no new bead created, T4 not reopened):\n- T6a (cdkc-18e.9) / T6b (cdkc-18e.10): document that errors thrown during IOrigin.Bind cross the jsii boundary and surface to .NET callers as System.Exception (with the original message), while factory-time validation throws InvalidOperationException directly.\n- T7c (cdkc-18e.13): validate OAC naming across AWS Regions and the potential account-global naming collision.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","assignee":"Nick Cipollina","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:51Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T15:33:34Z","started_at":"2026-10-23T14:51:32Z","closed_at":"2026-10-23T15:02:51Z","close_reason":"T4 complete: WebFunctionOrigin OAC/non-OAC factories, FunctionUrlOriginAccessControl (sigv4/sigv4a), automatic same-stack CloudFront invoke grants, ExternallyManaged/imported/cross-stack handling, 20 new synthesis tests + 1 golden; 1884 tests pass on 4 TFMs; 17 original goldens unchanged.","external_ref":"gh-98","labels":["cloudfront","lambda-web-functions","security","t4"],"dependencies":[{"issue_id":"cdkc-18e.6","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:51Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.6","depends_on_id":"cdkc-18e.15","type":"blocks","created_at":"2026-10-23T12:49:06Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.6","depends_on_id":"cdkc-18e.4","type":"blocks","created_at":"2026-10-23T01:15:12Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.6","depends_on_id":"cdkc-18e.5","type":"blocks","created_at":"2026-10-23T01:15:13Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":3,"dependent_count":4,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.5","title":"T3b: Implement GrantInvoke (revision-3 account rules) and endpoint imports","description":"Purpose: GrantInvoke with the revision-3 account-establishment rules, and limited endpoint imports. Design §8.4 (IWebFunctionEndpoint, FromEndpointAttributes, ownership semantics), §10.1, §10.2 (AUTHORITATIVE algorithm + table), §14, §15 (IAM matrix).\n\nCRITICAL: implement §10.2 revision 3 exactly. Do NOT use Grant.AddToPrincipalOrResource and do NOT rely on Grant.Success/AssertSuccess\n(verified CDK pitfall: success only checks that a statement object exists). Compose Grant.AddToPrincipal / Grant.AddStatementToResourcePolicy, check StatementAdded yourself,\nand return Grant.Combine of statements actually written.\n\nDeliverables:\n- IWebFunctionEndpoint : IResource with EndpointName, EndpointArn, DomainName, Url, AuthType, EndpointType, GrantInvoke(IGrantable), GrantInvoke(IGrantable, WebFunctionInvokeGrantOptions), GrantCloudFrontInvoke(string).\n WebFunctionEndpointConstruct implements it.\n- GrantInvoke algorithm (§10.2): throw for ApplicationManaged; identity side ONLY when the account is established:\n E1 = grant principal is an owned construct (Resource.IsOwnedResource) whose stack account is not literally different from the endpoint stack's;\n E2 = imported principal with literal PrincipalAccount equal (TokenComparison.SAME) to the literal endpoint stack account.\n Resource side when: identity side not written for an established same-account immutable role; service principal; or CallerPolicy = ExternallyManaged.\n Under Automatic, fail with InvalidOperationException (grantee, endpoint, reason, two remedies) for: imported principals with any unresolved account (ONE_ or BOTH_UNRESOLVED),\n different literal account, AccountPrincipal/ArnPrincipal. ExternallyManaged never writes identity policy and adds an Annotations info naming the required caller-side identity policy.\n- WebFunctionEndpointConstruct.FromEndpointAttributes(scope, id, WebFunctionEndpointAttributes) → IWebFunctionEndpoint that owns nothing: identity grants for established (E1/E2) grantees only;\n any grant requiring the resource policy, ExternallyManaged grants, and GrantCloudFrontInvoke throw (\"resource policy of an imported endpoint is externally owned\").\n Parse endpoint name/account/region from a literal ARN; token ARN ⇒ unresolved account (only E1 grantees can be granted).\n\nTests (one per §10.2 table row + §15 IAM bullets): E1 role/Function/WebFunctionConstruct (incl. env-agnostic stacks) → identity statement on the specific endpoint ARN only, no ResourcePolicy;\nE2 mutable → attached policy; E2 Mutable=false → resource statement only (imported endpoint throws); imported role with token ARN or env-agnostic stack under Automatic → throws AND no AWS::IAM::Policy synthesized;\nsame under ExternallyManaged → resource statement + annotation; different literal account Automatic throws / ExternallyManaged resource-only with no principal statements in returned Grant;\nservice principal → resource only; Account/ArnPrincipal Automatic throws / ExternallyManaged resource-only; ExternallyManaged with E1 → resource only; ApplicationManaged throws;\nimported endpoint ExternallyManaged throws; regression test with a fake IResourceWithPolicy returning StatementAdded=false → GrantInvoke throws.\nGolden template: cross-account ExternallyManaged grant + same-account grant.\n\nExclusions: WebFunctionOrigin, Testing helpers, docs. Do not change resource-policy ownership semantics from the previous bead.\nSecurity: never synthesize an identity policy for a principal whose account is not established; never report partial cross-account configuration as complete.\n","acceptance_criteria":"- GrantInvoke implements §10.2 revision 3 exactly; no use of AddToPrincipalOrResource, Grant.Success, or AssertSuccess in the implementation (code review check).\n- Every §10.2 table row has a passing test, including the \"no AWS::IAM::Policy synthesized\" check for unresolved imported roles and the StatementAdded=false regression.\n- FromEndpointAttributes returns an endpoint with the documented limited capabilities and clear exceptions.\n- ExternallyManaged emits the info annotation; Automatic failures name grantee, endpoint, reason, and remedies.\n- Golden templates unchanged except the new one; validation gates pass.","notes":"T3b IMPLEMENTED (GrantInvoke revision-3 account rules + endpoint imports). Not committed per task restriction.\n\nFILES: NEW src/LayeredCraft.Cdk.Constructs/Models/WebFunctionEndpoint.cs (public interface IWebFunctionEndpoint : IResource with EndpointName/EndpointArn/DomainName/Url/AuthType/EndpointType + GrantInvoke(IGrantable), GrantInvoke(IGrantable,WebFunctionInvokeGrantOptions), GrantCloudFrontInvoke(string)); NEW src/.../WebFunctionGrants.cs (internal static helper: InvokeAction const, GrantInvoke(...), internal AddResourceStatement(...), private IsEstablished/IdentityPolicyCanBeWritten/Describe); NEW src/.../WebFunctionImportedEndpoint.cs (internal sealed Resource, IWebFunctionEndpoint - owns nothing); MODIFIED src/.../WebFunctionEndpointConstruct.cs (now : Resource, IWebFunctionEndpoint, IResourceWithPolicyV2; added GrantInvoke overloads + static FromEndpointAttributes); NEW test/.../WebFunctionInvokeGrantTests.cs (22 tests); MODIFIED test/.../WebFunctionConstructGoldenTemplateTests.cs (+WebFunction_InvokeGrants_ShouldMatchGoldenTemplate); NEW GoldenTemplates/web-function-invoke-grants.json. No existing construct modified.\n\nGRANTINVOKE ACCOUNT CLASSIFICATION (design 10.2 rev 3): E1 owned principal (Resource.IsOwnedResource(grantPrincipal as IConstruct)) with compatible account -\u003e identity policy via Grant.AddToPrincipal (scoped to exact endpoint ARN); E2 imported principal with literal PrincipalAccount == literal endpoint account -\u003e identity if writable; service principal -\u003e resource-policy statement; any other not-established Automatic grantee -\u003e InvalidOperationException naming grantee/endpoint + two remedies; ExternallyManaged -\u003e resource-policy statement only + Annotations info, never identity. NEVER uses Grant.AddToPrincipalOrResource, Grant.Success, or AssertSuccess.\n\nKEY CORRECTNESS FINDING (fixed): Role.FromRoleArn(..., Mutable=false) returns an ImmutableRole whose AddToPrincipalPolicy returns StatementAdded=true while writing NOTHING (CDK pretendSuccess = !addGrantsToResources). Grant.AddToPrincipal therefore reports a non-empty PrincipalStatements for an immutable imported role, so trusting PrincipalStatements.Length caused a SILENT NO-OP (no identity, no resource statement). Detection now probes grantee.GrantPrincipal.AddToPrincipalPolicy(principal-less statement) and treats the identity as written only when result.StatementAdded \u0026\u0026 result.PolicyDependable is IConstruct (a real Policy for a mutable imported role; a bare DependencyGroup for an immutable one). Mutable vs immutable imported roles are otherwise indistinguishable from .NET (both surface as IRole+_Proxy / IPrincipal+_Proxy; IsOwnedResource false), so this PolicyDependable check is the reliable signal. The probe's extra statement is deduplicated by PolicyDocument at resolution.\n\nENDPOINT IMPORTS: WebFunctionEndpointConstruct.FromEndpointAttributes(scope,id,WebFunctionEndpointAttributes) returns an internal WebFunctionImportedEndpoint (owns no resources) exposing EndpointArn/DomainName/Url/AuthType/EndpointType and EndpointName/account parsed from a literal ARN (token ARN -\u003e unresolved account). It writes identity policies only for established E1/E2 grantees and throws InvalidOperationException for GrantCloudFrontInvoke and for any grant requiring the resource policy ('externally owned'). T3a single-resource-policy guarantees intact (exactly one lazily-created AWS::Lambda::ResourcePolicy per function).\n\nTESTS: 22 WebFunctionInvokeGrantTests cover every 10.2 matrix row (E1 owned Role/WebFunction + env-agnostic stacks; E2 mutable literal-equal -\u003e 1 AWS::IAM::Policy; E2 immutable -\u003e resource statement only; unresolved/different-account imported roles -\u003e throw with no AWS::IAM::Policy; ExternallyManaged -\u003e resource statement + no identity; service/account/arn principals; ApplicationManaged -\u003e throws; imported endpoint ExternallyManaged/GrantCloudFrontInvoke -\u003e throws; endpoint-scoped statements across multiple endpoints; StatementAdded=false regression via a fake IResourceWithPolicyV2; FromEndpointAttributes capabilities; IWebFunctionEndpoint assignability). New golden web-function-invoke-grants.json = same-account E1 identity grant + cross-account ExternallyManaged resource grant.\n\nRESULTS (JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION=1, -c Release): src build 0 warnings/0 errors. Full suite dotnet test --solution LayeredCraft.Cdk.Constructs.slnx -c Release -\u003e 1556 passed / 0 failed / 0 skipped (389 x net8.0/net9.0/net10.0/net11.0; prior 1464; +23/TFM). Golden tests: 24 total zero-diff (23 pre-existing UNCHANGED + 1 new). No existing golden modified.\n\nDEVIATIONS: none new. IWebFunctionEndpoint is a new public interface; IResourceWithPolicyV2 (T3a deviation) retained. Temporary probe files deleted (no Zz*.cs remain).","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","assignee":"Nick Cipollina","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:50Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T12:16:25Z","started_at":"2026-10-23T11:58:18Z","closed_at":"2026-10-23T12:16:25Z","close_reason":"T3b complete: GrantInvoke(IGrantable) + GrantInvoke(IGrantable, WebFunctionInvokeGrantOptions) with revision-3 account rules (E1 owned identity; E2 imported same-account identity when writable; service principal -\u003e resource policy; unestablished Automatic -\u003e clear synthesis failure; ExternallyManaged -\u003e resource statement + annotation, never identity), plus WebFunctionEndpointConstruct.FromEndpointAttributes importing endpoints that own nothing. Fixed the ImmutableRole pretendSuccess pitfall by detecting real identity writes via AddToPrincipalPolicyResult.PolicyDependable is IConstruct. Added public IWebFunctionEndpoint and internal WebFunctionGrants/WebFunctionImportedEndpoint. Never uses Grant.AddToPrincipalOrResource/Grant.Success/AssertSuccess. Build 0 warnings/0 errors; full suite 1556/1556 across net8.0/9.0/10.0/11.0 (+23/TFM); 24 golden tests zero-diff (23 existing unchanged + 1 new). No existing construct modified.","external_ref":"gh-98","labels":["iam","lambda-web-functions","security","t3"],"dependencies":[{"issue_id":"cdkc-18e.5","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:50Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.5","depends_on_id":"cdkc-18e.4","type":"blocks","created_at":"2026-10-23T01:15:12Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":3,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.4","title":"T3a: Add AddEndpoint, single-owner resource policy, and GrantCloudFrontInvoke","description":"Purpose: multiple endpoints and the single-owner resource policy. Design §8.3 (AddEndpoint), §8.4, §10.3, §12.2–§12.3, §14, §15 (Resource-policy ownership).\n\nDeliverables:\n- WebFunctionConstruct.AddEndpoint(string id, IWebFunctionEndpointOptions): validates unique EndpointName per function (a second \"default\" is a duplicate → InvalidOperationException);\n every endpoint routes 100% to the current revision; returns WebFunctionEndpointConstruct; Endpoints list includes default + added.\n- Single-owner resource policy (private to WebFunctionConstruct): lazily create one CfnResourcePolicy child \"ResourcePolicy\" (ResourceArn = function GetAtt FunctionArn,\n PolicyDocument = an iam.PolicyDocument) on first contribution; later contributions AddStatements to the same document. No resource when there are no statements.\n WebFunctionConstruct must NOT expose a public AddToResourcePolicy.\n- WebFunctionEndpointConstruct implements IResourceWithPolicy: AddToResourcePolicy(statement) requires statement Resources to be exactly this endpoint's ARN (else ArgumentException) and forwards to the function's policy.\n- GrantCloudFrontInvoke(string distributionArn): adds {Principal cloudfront.amazonaws.com, Action lambda:InvokeWebFunctionEndpoint, Resource endpoint ARN,\n Condition StringEquals aws:SourceArn = distributionArn}; accepts tokens or literals; throws for ApplicationManaged. Identical statements deduplicate (verify PolicyDocument behavior in a test).\n\nTests: no statements → no ResourcePolicy; many contributions → exactly one; multiple distributions/endpoints → all statements, each scoped to the correct endpoint ARN;\ndifferent contribution orders → equal statement sets; repeated grants → no duplicates; foreign Resource → throws; ApplicationManaged → throws;\nmultiple endpoints with different auth types synthesize correctly; duplicate endpoint names rejected; API-surface test that WebFunctionConstruct has no public AddToResourcePolicy.\nAdd a golden template: two endpoints (IamAuth + ApplicationManaged) with two explicit CloudFront grants.\n\nExclusions: GrantInvoke, imports (FromEndpointAttributes), WebFunctionOrigin, Testing helpers, docs.\nSecurity: never emit wildcard endpoint resources (endpoint/*) or unscoped CloudFront principals.\n","acceptance_criteria":"- AddEndpoint works with unique-name validation; all endpoints weight 100 to the current revision.\n- At most one AWS::Lambda::ResourcePolicy per function, created only when a statement exists; all contributions preserved; duplicates removed.\n- Endpoint-scoped AddToResourcePolicy and GrantCloudFrontInvoke behave per §8.4/§10.3, including negatives.\n- No public AddToResourcePolicy on WebFunctionConstruct.\n- New golden template added; all existing goldens unchanged; validation gates pass.","notes":"T3a IMPLEMENTED (AddEndpoint + single-owner resource policy + endpoint AddToResourcePolicy + GrantCloudFrontInvoke). Not committed per task restriction.\n\nDELIVERABLES:\n- WebFunctionConstruct.AddEndpoint(string id, IWebFunctionEndpointOptions options): ArgumentNullException on null id/options; per-function EndpointName uniqueness via HashSet(StringComparer.Ordinal) seeded with the default endpoint's name -\u003e duplicate (incl. a second 'default') throws InvalidOperationException; returns the endpoint created by the shared private CreateEndpoint (news WebFunctionEndpointConstruct, adds endpoint.CfnEndpoint.AddResourceDependency(revision), appends to the list). New public IReadOnlyList\u003cWebFunctionEndpointConstruct\u003e Endpoints reflects default + added endpoints, in creation order. Every endpoint routes RevisionWeights=[{current revision, 100}].\n- Single-owner resource policy (private to WebFunctionConstruct, NO public AddToResourcePolicy): AddResourcePolicyStatement(statement) lazily creates ONE iam.PolicyDocument and ONE Amazon.CDK.AWS.Lambda.CfnResourcePolicy child id 'ResourcePolicy' (ResourceArn = Function GetAtt FunctionArn, PolicyDocument = the shared document). No statements =\u003e no AWS::Lambda::ResourcePolicy resource. Later contributions AddStatements to the same document; all preserved; identical statements deduplicate at PolicyDocument resolution (verified: 2 identical grants -\u003e 1 statement).\n- WebFunctionEndpointConstruct now : Resource, IResourceWithPolicyV2 and implements AddToResourcePolicy(statement): requires statement.Resources length == 1 and string-equals this endpoint's EndpointArn (ArgumentNullException on null; ArgumentException for foreign resource, another endpoint, the whole function, or wildcard) and forwards to the function policy; returns AddToResourcePolicyResult{StatementAdded=true, PolicyDependable=the policy}.\n- GrantCloudFrontInvoke(string distributionArn): InvalidOperationException when AuthType != IamAuth (ApplicationManaged rejected); ArgumentNullException on null; literal ARNs validated (token-aware: unresolved tokens skipped); emits {Effect Allow, Principal Service cloudfront.amazonaws.com, Action lambda:InvokeWebFunctionEndpoint, Resource = endpoint ARN, Condition StringEquals aws:SourceArn = distributionArn} -\u003e endpoint AddToResourcePolicy. Repeated equivalent grants deduplicate. Never creates/modifies a Distribution.\n\nDEViation (mechanical, contract-identical; reported): the design named IResourceWithPolicy, but that interface is DEPRECATED in CDK 2.274 ('prefer IResourceWithPolicyV2'). Implemented the non-deprecated Amazon.CDK.AWS.IAM.IResourceWithPolicyV2 instead. Because its AddToResourcePolicy returns IAddToResourcePolicyResult (not the concrete AddToResourcePolicyResult), the public method keeps the concrete return type and the interface is satisfied by an explicit implementation that forwards to it. src build stays at 0 warnings.\n\nNEW TESTS/GOLDEN: test/.../WebFunctionResourcePolicyTests.cs (19 tests: no-statements -\u003e no policy; single grant -\u003e one policy with correct ResourceArn/Principal/Action/Condition/Resource; two distributions -\u003e 2 statements / 1 policy; repeated grant -\u003e dedup to 1; order-independence; two endpoints -\u003e 1 policy / 2 statements scoped to 2 distinct endpoint ARNs; ApplicationManaged -\u003e throws; invalid literal ARNs (non-ARN, lambda function ARN, truncated cloudfront) -\u003e ArgumentException; token ARN accepted; foreign/wildcard Resource -\u003e ArgumentException; endpoint.EndpointArn accepted; duplicate endpoint names -\u003e InvalidOperationException; Endpoints + per-endpoint weight-100 assertions; API-surface reflection proving WebFunctionConstruct has no public AddToResourcePolicy; IResourceWithPolicyV2 assignability). New golden web-function-multi-endpoint.json (two endpoints IamAuth + ApplicationManaged, two CloudFront grants -\u003e exactly ONE AWS::Lambda::ResourcePolicy with two SourceArn-scoped statements). Infrastructure: WebFunctionValidation.ValidateCloudFrontDistributionArn added; regex ^arn:[a-z0-9-]+:cloudfront::[0-9]{12}:distribution/[A-Za-z0-9]+$.\n\nRESULTS (JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION=1, -c Release): src build 0 warnings/0 errors on net8.0/9.0/10.0/11.0; full solution suite 1464 passed / 0 failed / 0 skipped (366 x 4 TFMs; prior baseline 1384, +20 tests/TFM = 19 resource-policy + 1 golden); all 22 pre-existing golden templates UNCHANGED (only the new web-function-multi-endpoint.json added; 23 total). No existing construct modified. No new dependencies. Coverage: no local script; CI gate 80% (external devops template); changes additive and covered.\n\nACCEPTANCE: AddEndpoint unique-name validation + every endpoint weight 100; exactly one AWS::Lambda::ResourcePolicy per function created only when a statement exists, all contributions preserved, duplicates removed; endpoint-scoped AddToResourcePolicy and GrantCloudFrontInvoke per section 8.4/10.3 including negatives; no public AddToResourcePolicy on WebFunctionConstruct; new golden added, existing goldens unchanged; validation gates pass. T3b items (GrantInvoke, endpoint imports) intentionally NOT implemented.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:49Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T11:47:39Z","closed_at":"2026-10-23T11:47:39Z","close_reason":"T3a complete: AddEndpoint with per-function endpoint-name uniqueness (duplicate incl. second default rejected); Endpoints collection; single lazily-created AWS::Lambda::ResourcePolicy per function (no resource when no statements, all contributions preserved, identical statements deduplicated via PolicyDocument); endpoint-scoped IResourceWithPolicyV2.AddToResourcePolicy (foreign/wildcard resource rejected); GrantCloudFrontInvoke (cloudfront.amazonaws.com, lambda:InvokeWebFunctionEndpoint, StringEquals aws:SourceArn, endpoint-only resource, token-aware ARN validation, ApplicationManaged rejected, dedup). One reported mechanical deviation: IResourceWithPolicy is deprecated in CDK 2.274 -\u003e implemented IResourceWithPolicyV2 with an explicit interface forwarder. Build 0 warnings/0 errors; full suite 1464/1464 passed across net8.0/9.0/10.0/11.0 (+20 tests/TFM); 22 existing goldens unchanged + 1 new multi-endpoint golden. No existing construct modified.","external_ref":"gh-98","labels":["iam","lambda-web-functions","t3"],"dependencies":[{"issue_id":"cdkc-18e.4","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:49Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.4","depends_on_id":"cdkc-18e.3","type":"blocks","created_at":"2026-10-23T01:15:11Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":2,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.3","title":"T2: Implement core WebFunctionConstruct (function, revision, default endpoint, role, logs, code bucket)","description":"Purpose: the core L3 construct that owns one Web Function lifecycle. Design §7, §8.2 (bucket statement), §8.3, §12.1, §12.2, §12.4, §14, §15 (Synthesis/template, Code bucket).\n\nDeliverables:\n- WebFunctionConstruct : Construct, IGrantable (src/LayeredCraft.Cdk.Constructs/WebFunctionConstruct.cs) creating, with these STABLE child IDs:\n \"Function\" (CfnWebFunction; set Node.DefaultChild), \"Revision\" (CfnWebFunctionRevision), \"DefaultEndpoint\" (WebFunctionEndpointConstruct whose L1 child is \"Resource\"),\n \"ExecutionRole\" (only when props.Role is null; AWSLambdaBasicExecutionRole), \"LogGroup\" (only for WebFunctionLogs.Create; name /aws/lambda/web/{FunctionName}).\n- Pass the LITERAL FunctionName (not Ref/ARN) to Revision.FunctionName and Endpoint.FunctionName; add explicit AddResourceDependency function←revision←endpoint (§8.3 notes, §12.4).\n- Revision: S3Object {Bucket, Key, VersionId?}; RuntimeConfig.Runtime; ServiceConfig {ExecutionRoleArn, EnvironmentVariables (+ AWS_LAMBDA_NODEJS_ENTRYPOINT from EntryPoint),\n TimeoutSeconds, MaxConcurrencyPerEnvironment, TelemetryConfig.LoggingConfig {LogGroup (Create/Use only), ApplicationLogLevel, SystemLogLevel}}; Description. No KmsKeyArn.\n- WebFunctionLogs.Use(group): pass name; logGroup.GrantWrite(role) only when the name is outside /aws/lambda/*.\n- WebFunctionEndpointConstruct (src/.../WebFunctionEndpointConstruct.cs): Amazon.CDK.Resource subclass, internal ctor, exposes EndpointName, EndpointArn, DomainName,\n Url (\"https://\"+DomainName), AuthType, EndpointType, Regions, WebFunction. Endpoint L1: AuthType, EndpointName, EndpointType, Regions, RevisionWeights=[{current revision, 100}],\n ScalingConfig/ThrottleConfig only when set, Description. (Grants/policy/AddEndpoint come in later beads; do not stub public members that later beads own unless needed to compile.)\n- Code binding: WebFunctionCode.FromBucket.Bind implementation:\n * Automatic: add the least-privilege statement from §8.2 (lambda.amazonaws.com, s3:GetObject+s3:GetObjectVersion on the object ARN, StringEquals aws:SourceAccount,\n ArnLike aws:SourceArn arn:{partition}:lambda:{region}:{account}:web-function/{FunctionName}/revision/* using the FUNCTION stack's account/region);\n fail (InvalidOperationException) if AddToResourcePolicy returns StatementAdded=false; add revision dependency on the policy dependable.\n * Owned Bucket L2 created in the app: fail if versioning is not enabled or encryption is KMS_MANAGED/DSSE_MANAGED (inspect the owned bucket's CfnBucket; imported buckets are not inspected).\n * Owned bucket in another stack while the function stack's account/region is unresolved → fail.\n * ExternallyManaged: add nothing.\n- Golden templates (using the T0 harness) for: single IamAuth function with defaults; ApplicationManaged with ServiceDefault logs; Use(logGroup) + supplied role; Automatic owned bucket; ExternallyManaged imported bucket.\n\nTests (§15): template assertions for every property above, defaults, DependsOn chain, literal FunctionName on all three, no KmsKeyArn, log group variants, role variants, code-bucket matrix, and §14 construct-level negatives.\nExclusions: AddEndpoint, resource policy, GrantInvoke, GrantCloudFrontInvoke, imports, CloudFront, Testing namespace helpers, docs. No changes to existing constructs.\nSecurity: never grant s3 read beyond the single object key and the /revision/* SourceArn pattern.\n","acceptance_criteria":"- Child IDs exactly Function, Revision, DefaultEndpoint(/Resource), ExecutionRole, LogGroup; Node.DefaultChild is the CfnWebFunction.\n- Revision and endpoint receive the literal FunctionName and explicit DependsOn edges (asserted).\n- Default log group /aws/lambda/web/{name}, 14 days, Delete; ServiceDefault creates none and omits LoggingConfig.LogGroup; Use() creates none.\n- Code-bucket Automatic/ExternallyManaged/owned-validation/cross-stack matrix implemented and tested, statement matches §8.2 exactly.\n- WebFunctionConstruct.GrantPrincipal is the execution role (e.g. table.GrantReadData(webFunction) works; tested).\n- New golden templates added; existing golden templates unchanged.\n- Validation gates pass.","notes":"T2 IMPLEMENTED (core WebFunctionConstruct). Not committed per task restriction.\n\nDELIVERABLES:\n- src/.../WebFunctionConstruct.cs (NEW): public sealed class WebFunctionConstruct : Construct, IGrantable. Validates FunctionName/Timeout/MaxConcurrencyPerEnvironment/EnvironmentVariables/EntryPoint via WebFunctionValidation; creates stable children Function (CfnWebFunction, Node.DefaultChild), Revision (CfnWebFunctionRevision), DefaultEndpoint (WebFunctionEndpointConstruct), ExecutionRole (only when props.Role is null; AWSLambdaBasicExecutionRole), LogGroup (only for WebFunctionLogs.Create). Public: FunctionName, FunctionArn, RevisionId, RevisionArn, Role, GrantPrincipal (=Role.GrantPrincipal), LogGroup (null for ServiceDefault), DefaultEndpoint. Revision ServiceConfig carries ExecutionRoleArn, EnvironmentVariables (+ AWS_LAMBDA_NODEJS_ENTRYPOINT from EntryPoint), TimeoutSeconds, MaxConcurrencyPerEnvironment, TelemetryConfig.LoggingConfig{LogGroup,ApplicationLogLevel,SystemLogLevel}; no KmsKeyArn. FunctionName passed LITERAL to Revision and Endpoint. Explicit deps: Revision.AddResourceDependency(Function); Revision.Node.AddDependency(Role/created LogGroup/bucket PolicyDependable); endpoint.AddResourceDependency(Revision).\n- src/.../WebFunctionEndpointConstruct.cs (NEW): public sealed class WebFunctionEndpointConstruct : Resource; internal ctor (scope,id,webFunction,options); validates EndpointName/Regions(homeRegion=Stack.Of(function).Region)/MaxEnvironments/RateLimit; creates the L1 child id 'Resource' (CfnWebFunctionEndpoint) and sets Node.DefaultChild; exposes WebFunction, EndpointName, AuthType, EndpointType, Regions, EndpointArn, DomainName, Url. ScalingConfig/ThrottleConfig emitted only when set; RevisionWeights=[{current RevisionId, 100}].\n- src/.../Models/WebFunctionCode.cs (MODIFIED, T2-owned completion): added internal abstract WebFunctionCodeConfig Bind(WebFunctionConstruct) on WebFunctionCode + override in WebFunctionCodeFromBucket; automatic bucket policy per design §8.2 EXACTLY (lambda.amazonaws.com; s3:GetObject,s3:GetObjectVersion; Resource arn:{partition}:s3:::{bucket}/{key}; StringEquals aws:SourceAccount; ArnLike aws:SourceArn arn:{partition}:lambda:{region}:{account}:web-function/{FunctionName}/revision/*; partition/account/region from the FUNCTION stack); StatementAdded=false -\u003e InvalidOperationException; ExternallyManaged -\u003e no statement; owned bucket validated (versioning required; AWS-managed KMS aws/s3 or DSSE rejected), imported buckets not inspected; owned bucket in another stack while function stack account/Region unresolved -\u003e InvalidOperationException; revision depends on result.PolicyDependable.\n- src/.../Models/WebFunctionCodeConfig.cs (NEW): internal sealed config {Bucket,Key,VersionId,PolicyDependable}.\n\nFILES: src: WebFunctionConstruct.cs, WebFunctionEndpointConstruct.cs, Models/WebFunctionCode.cs (mod), Models/WebFunctionCodeConfig.cs; tests: WebFunctionConstructTests.cs (45 cases), WebFunctionConstructGoldenTemplateTests.cs (5 goldens); GoldenTemplates: web-function-default / -application-managed / -use-log-group / -owned-bucket / -externally-managed .json. No existing construct changed. No new dependencies.\n\nIMPLEMENTATION FINDING (not a public API deviation): the S3 Bucket L2 sets VersioningConfiguration/BucketEncryption from JavaScript, so the CLR getters expose a JSII AnonymousObject and typed casts to CfnBucket.*Property return null. Owned-bucket inspection therefore reads the values via Stack.Of(bucket).Resolve(...) (plain camelCase dictionaries: 'status', 'serverSideEncryptionConfiguration'[].'serverSideEncryptionByDefault'.'sseAlgorithm'/'kmsMasterKeyId'). Verified empirically: Versioned=true -\u003e {'status':'Enabled'}; KMS_MANAGED -\u003e {'sseAlgorithm':'aws:kms'} (no key) -\u003e rejected; DSSE_MANAGED -\u003e {'sseAlgorithm':'aws:kms:dsse'} -\u003e rejected; default S3-managed bucket emits no BucketEncryption -\u003e allowed.\n\n§18 OPEN QUESTION 5 RESULT: ScalingConfig/ThrottleConfig are emitted only when MaxEnvironments/RateLimit are set (asserted by Construct_ShouldOmitScalingAndThrottleWhenUnset). CloudFormation update semantics are 'omit = keep existing value', so removing these values after a deployment would NOT clear them via omission; clearing would require explicitly sending an empty object. Whether CloudFormation accepts an empty ScalingConfig/ThrottleConfig sub-object is NOT verified (no deploy performed; deploy verification is deferred to T7 per design). Recommendation: document the clear-via-explicit-empty-object requirement and confirm in the T7 sandbox.\n\nTESTS/RESULTS (JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION=1, -c Release):\n- dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release -\u003e Build succeeded, 0 warnings, 0 errors.\n- New behavior suite: 45 tests pass (construct/revision/default endpoint, stable logical ids, literal FunctionName on all three, DependsOn chain, runtime nodejs24.x, S3Object with/without VersionId, env vars incl AWS_LAMBDA_NODEJS_ENTRYPOINT, timeout/concurrency/no KmsKeyArn, default+supplied role, three logging modes + GrantWrite only outside /aws/lambda/*, endpoint name/type/Regions/AuthType/scaling/throttle present-absent/revision-weight-100, GrantPrincipal=dynamodb:GetItem via table.GrantReadData, bucket matrix incl. imported+Automatic throw, ExternallyManaged no-policy, unversioned/KMS_MANAGED/cross-stack throws, token FunctionName allowed, all §14 construct negatives).\n- Golden suite: 22/22 pass with ZERO diff (17 pre-existing UNCHANGED + 5 new Web Function goldens).\n- Full solution: dotnet test --solution LayeredCraft.Cdk.Constructs.slnx -c Release -\u003e 1384 passed / 0 failed / 0 skipped (346 x net8.0/net9.0/net10.0/net11.0); prior baseline 1184; +50 tests/TFM.\n- Coverage: no local script; CI gate 80% (external devops template); src changes are additive and covered by the new tests.\n\nACCEPTANCE: all child IDs stable; DefaultChild=CfnWebFunction; literal FunctionName + DependsOn asserted; logging modes asserted; bucket-policy matrix implemented + tested; GrantPrincipal is the execution role; new goldens added, existing unchanged; no existing construct modified.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","assignee":"Nick Cipollina","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:48Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T02:40:48Z","started_at":"2026-10-23T01:55:28Z","closed_at":"2026-10-23T02:40:48Z","close_reason":"T2 complete: core WebFunctionConstruct (Function/Revision/DefaultEndpoint/ExecutionRole/LogGroup with stable ids), WebFunctionEndpointConstruct (L1 child 'Resource', Node.DefaultChild, revision weight 100, scaling/throttle only when set), and the WebFunctionCode.Bind artifact seam (automatic/external bucket policy per §8.2, versioning + AWS-managed-KMS rejection on owned buckets, cross-stack unresolved-env failure, revision depends on PolicyDependable). Literal FunctionName + explicit DependsOn chain; no revision KMS. Build 0 warnings/0 errors; full suite 1384/1384 passed across net8.0/9.0/10.0/11.0 (+50 tests/TFM); 22/22 golden tests zero-diff (17 existing unchanged + 5 new). GrantPrincipal is the execution role. No existing construct modified. §18 Q5: omit=keep confirmed by design of our output; clearing needs explicit empty objects, deploy verification deferred to T7.","external_ref":"gh-98","labels":["core","lambda-web-functions","t2"],"dependencies":[{"issue_id":"cdkc-18e.3","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:48Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.3","depends_on_id":"cdkc-18e.2","type":"blocks","created_at":"2026-10-23T01:15:10Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":2,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.2","title":"T1: Add Web Function public models, options, and value validation","description":"Purpose: introduce the public model/value types every later bead consumes, with value validation. Design §8.1, §8.2, §8.3 (props + WebFunctionLogs), §8.4 (options/attributes), §8.5 (origin props), §8.7, §10.2 (WebFunctionCallerPolicy, WebFunctionInvokeGrantOptions), §14.\n\nDeliverables (namespace LayeredCraft.Cdk.Constructs.Models unless noted; follow the newest Cognito style: get-only interfaces + init-only sealed records, XML docs):\n- Enums: WebFunctionAuthType {IamAuth, ApplicationManaged}; WebFunctionEndpointType {HomeRegion, MultiRegion, PerRegion};\n WebFunctionCodeBucketPolicy {Automatic, ExternallyManaged}; WebFunctionOriginPermissions {Automatic, ExternallyManaged};\n WebFunctionCallerPolicy {Automatic, ExternallyManaged}.\n- WebFunctionRuntime (sealed; NodeJs24X = \"nodejs24.x\"; Of(string)).\n- WebFunctionCode (abstract, private protected ctor, closed hierarchy) with static FromBucket(IBucket, string key, WebFunctionCodeFromBucketOptions?)\n and WebFunctionCodeFromBucketOptions {ObjectVersion, BucketPolicy = Automatic}. The internal Bind contract to the construct is\n declared but bucket-policy wiring is implemented in the core-construct bead; keep the binding surface internal so FromAsset can be added later.\n- WebFunctionLogs (abstract, closed): Create(RetentionDays? retention = null [→ TWO_WEEKS], RemovalPolicy? [→ DESTROY]), Use(ILogGroup), ServiceDefault().\n- IWebFunctionConstructProps / WebFunctionConstructProps exactly per §8.3 (FunctionName, Code, Endpoint required; Runtime, EntryPoint,\n EnvironmentVariables, Timeout=30s, MaxConcurrencyPerEnvironment, Description, Role, Logs=Create(), ApplicationLogLevel, SystemLogLevel\n reusing Amazon.CDK.AWS.Lambda enums). NO EncryptionKey property.\n- IWebFunctionEndpointOptions / WebFunctionEndpointOptions (EndpointName=\"default\", required AuthType, EndpointType=HomeRegion, Regions, MaxEnvironments, RateLimit, Description).\n- WebFunctionEndpointAttributes (EndpointArn, DomainName, AuthType required; EndpointType=HomeRegion).\n- WebFunctionInvokeGrantOptions {CallerPolicy = Automatic}.\n- WebFunctionOriginProps (explicit members only: OriginId, OriginPath, CustomHeaders, ConnectionAttempts, ConnectionTimeout, ReadTimeout,\n KeepaliveTimeout, ResponseCompletionTimeout, OriginShieldEnabled, OriginShieldRegion) and sealed WebFunctionOriginWithOacProps : WebFunctionOriginProps\n {OriginAccessControl, Permissions = Automatic}. Must NOT expose ProtocolPolicy or OriginAccessControlId.\n- Internal validation helpers (local to new types; do not refactor shared code or existing constructs) for §14 value rules: FunctionName\n regex 1–64; EndpointName 1–64 [A-Za-z0-9_-]; Timeout 3–900 whole seconds; MaxConcurrencyPerEnvironment 1–128; MaxEnvironments 2–10000;\n RateLimit grid {0} ∪ 100..1000 step 100 ∪ 2000..10000 step 1000; Regions rules; env var key regex; EntryPoint relative/no \"..\";\n reserved AWS_LAMBDA_HTTP_ENDPOINT; EntryPoint vs AWS_LAMBDA_NODEJS_ENTRYPOINT conflict. Unresolved tokens (Token.IsUnresolved) are skipped, never rejected.\n Exception types per §14 (ArgumentException / ArgumentOutOfRangeException / InvalidOperationException).\n\nExpected files: src/LayeredCraft.Cdk.Constructs/Models/WebFunction*.cs (one type per file or small cohesive groups); test/.../WebFunctionModelsTests.cs (+ validation tests).\nExclusions: no constructs, no CloudFormation resources, no IBucket policy mutation yet, no testing-namespace helpers, no docs.\nEdge cases: FunctionName must allow tokens; nullable reference types enabled; records must be init-only (no Action\u003c\u003e mutation APIs anywhere).\n","acceptance_criteria":"- All listed public types exist with the exact names, members, and defaults in design §8.1–§8.5, §8.7 (no EncryptionKey), §10.2.\n- WebFunctionConstructProps cannot be constructed without FunctionName, Code, and Endpoint; WebFunctionEndpointOptions cannot be constructed without AuthType (compile-time `required`).\n- Every §14 value rule has a positive and negative unit test; tokens bypass literal validation (tested).\n- WebFunctionLogs.Create() defaults are TWO_WEEKS and DESTROY (tested).\n- No existing source file outside new WebFunction* files changed; existing golden templates still pass.\n- Validation gates pass.","notes":"T1 IMPLEMENTED (public WebFunction model/value types + §14 value validation). Not committed per task restriction.\n\nDELIVERABLES (src/LayeredCraft.Cdk.Constructs/Models/):\n- Enums: WebFunctionAuthType (IamAuth, ApplicationManaged), WebFunctionEndpointType (HomeRegion, MultiRegion, PerRegion), WebFunctionCodeBucketPolicy (Automatic, ExternallyManaged), WebFunctionOriginPermissions (Automatic, ExternallyManaged), WebFunctionCallerPolicy (Automatic, ExternallyManaged).\n- WebFunctionRuntime: sealed; NodeJs24X='nodejs24.x'; Of(string) escape hatch.\n- WebFunctionCode: abstract closed hierarchy (private protected ctor); static FromBucket(IBucket,string,WebFunctionCodeFromBucketOptions?); internal sealed WebFunctionCodeFromBucket. Options: WebFunctionCodeFromBucketOptions { ObjectVersion; BucketPolicy=Automatic }.\n- WebFunctionLogs: abstract closed; Create(RetentionDays?=TWO_WEEKS, RemovalPolicy?=DESTROY) / Use(ILogGroup) / ServiceDefault(); internal concrete subtypes.\n- IWebFunctionConstructProps + WebFunctionConstructProps: FunctionName/Code/Endpoint required; Runtime=NodeJs24X; EntryPoint; EnvironmentVariables; Timeout=30s; MaxConcurrencyPerEnvironment; Description; Role; Logs=Create(); ApplicationLogLevel; SystemLogLevel. NO EncryptionKey (deferred KMS, §8.7).\n- IWebFunctionEndpointOptions + WebFunctionEndpointOptions: EndpointName='default'; required AuthType (explicit selection, no default); EndpointType=HomeRegion; Regions=[]; MaxEnvironments; RateLimit; Description.\n- WebFunctionEndpointAttributes: required EndpointArn/DomainName/AuthType; EndpointType=HomeRegion.\n- WebFunctionInvokeGrantOptions: CallerPolicy=Automatic (explicit ownership contract).\n- WebFunctionOriginProps + sealed WebFunctionOriginWithOacProps (no ProtocolPolicy/OriginAccessControlId).\n- WebFunctionValidation (internal static): §14 helpers (FunctionName, EndpointName, Timeout, MaxConcurrencyPerEnvironment, MaxEnvironments, RateLimit grid, Regions, env var keys, env var map, EntryPoint incl reserved AWS_LAMBDA_HTTP_ENDPOINT and AWS_LAMBDA_NODEJS_ENTRYPOINT conflict). Token-aware: unresolved tokens (Token.IsUnresolved / Fn.Ref) bypass literal validation. Exceptions per §14 (ArgumentException / ArgumentOutOfRangeException).\n- [assembly: InternalsVisibleTo(\"LayeredCraft.Cdk.Constructs.Tests\")] added (new file) so validation is unit-testable.\n\nTESTS (test/LayeredCraft.Cdk.Constructs.Tests/): WebFunctionModelsTests.cs (defaults, required values, immutability, factory arg validation, crypto/logs/endpoint/origin surface) + WebFunctionValidationTests.cs (positive+negative per §14 rule, boundary values, token bypass). +110 tests/TFM ([Collection(\"CDK Tests\")], xUnit v3, AwesomeAssertions).\n\nCOMMANDS/RESULTS (JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION=1):\n- dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release -\u003e 0 warnings, 0 errors.\n- dotnet test --solution LayeredCraft.Cdk.Constructs.slnx -c Release -\u003e 1184 passed / 0 failed / 0 skipped (296 x net8.0/net9.0/net10.0/net11.0). Baseline was 744 (186x4).\n- 17 golden templates UNCHANGED; ExistingConstructsGoldenTemplateTests passed (zero diff). Goldens NOT regenerated.\n\nSCOPE: no constructs, no CFN resources, no IBucket policy mutation, no Testing helpers, no docs. No existing (pre-T1) source file modified; only new WebFunction*.cs files added. No new dependencies.\n\nINTENTIONAL DEVIATION (must be reported): design §8.2 declares internal 'abstract WebFunctionCodeConfig Bind(WebFunctionConstruct function)'. WebFunctionConstruct is created in T2 (cdkc-18e.3), so this internal seam cannot be declared in T1 without the type. Deferred Bind to T2 (which already owns the construct + bucket-policy wiring). Public contract unchanged. Recommendation: T2 declares the abstract Bind on WebFunctionCode and overrides it in WebFunctionCodeFromBucket. No other deviation from the approved design.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","assignee":"Nick Cipollina","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:47Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T01:53:01Z","started_at":"2026-10-23T01:38:29Z","closed_at":"2026-10-23T01:53:01Z","close_reason":"Implemented T1: public WebFunction model/value types (auth/endpoint-type/bucket-policy/origin-permissions/caller-policy enums, WebFunctionRuntime, closed WebFunctionCode+FromBucket, closed WebFunctionLogs with Create/Use/ServiceDefault, IWebFunctionConstructProps+record, IWebFunctionEndpointOptions+record, EndpointAttributes, InvokeGrantOptions, OriginProps+WithOacProps) and internal token-aware WebFunctionValidation for all §14 value rules. Added 2 test files (WebFunctionModelsTests, WebFunctionValidationTests) = +110 tests/TFM. Build 0 warnings/0 errors; full suite 1184/1184 passed across net8.0/9.0/10.0/11.0; all 17 existing golden templates unchanged (goldens not regenerated). No existing source modified, no constructs/CFN resources/IBucket mutation/Testing helpers/docs added. Internal Bind(WebFunctionConstruct) seam intentionally deferred to T2 (cdkc-18e.3) because the construct type does not exist in T1; public contract unaffected.","external_ref":"gh-98","labels":["lambda-web-functions","models","t1"],"dependencies":[{"issue_id":"cdkc-18e.2","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:47Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.2","depends_on_id":"cdkc-18e.1","type":"blocks","created_at":"2026-10-23T01:15:09Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.1","title":"T0: Upgrade Amazon.CDK.Lib to 2.274.0 and add golden-template baseline for existing constructs","description":"Purpose: separate review checkpoint that raises the CDK floor and proves existing constructs are unchanged. Design §5.5, §12.4 (Enforcement), §13, §19 T0.\n\nREQUIRED ORDER (do not reorder):\n a. Confirm Directory.Packages.props still pins Amazon.CDK.Lib 2.273.0 (`dotnet list test/LayeredCraft.Cdk.Constructs.Tests package --include-transitive | grep Amazon.CDK.Lib`). If it is already 2.274.0, STOP and record a blocker: the baseline can no longer be produced from the original version.\n b. Generate the golden baseline ON 2.273.0, run the tests once to prove the baseline passes on 2.273.0, and record the 2.273.0 SHA-256 of every golden file in the bead notes.\n c. Only then change Amazon.CDK.Lib to 2.274.0, restore, and run the golden tests in COMPARE mode (regeneration env var unset) against the unchanged 2.273.0 baseline.\n d. If any template differs: do NOT regenerate, accept, or edit golden files; do NOT adjust normalization to hide the diff. Record the full diff (construct, resource, property, old → new) on this bead with `bd update \u003cid\u003e --append-notes`, set the bead to blocked (`bd update \u003cid\u003e --status blocked`), and report to the maintainer. Leave 2.274.0 in place only together with the failing tests and the recorded diff.\n\nScope:\n1. BEFORE changing the CDK version, add a test-only golden-template harness and capture golden templates on the current\n Amazon.CDK.Lib 2.273.0 for the four existing constructs (LambdaFunctionConstruct, StaticSiteConstruct, DynamoDbTableConstruct,\n CognitoUserPoolConstruct) in default and representative configurations (e.g. Lambda: OTEL on/off, URL on/off, permissions;\n StaticSite: with/without ApiDomain and alternate domains; DynamoDB: GSI/stream/TTL; Cognito: domain prefix vs custom domain with\n explicit IHostedZone/ICertificate, groups, resource servers). Avoid configurations that require HostedZone.FromLookup unless the\n test supplies context; prefer deterministic inputs (no random AutoFixture values in golden stacks).\n2. Bump Amazon.CDK.Lib to 2.274.0 in Directory.Packages.props (the only dependency change).\n3. Re-run: golden templates must be identical (zero diff).\n\nHarness requirements (reused by later beads):\n- Lives in the test project (e.g. test/LayeredCraft.Cdk.Constructs.Tests/TestKit/Golden/GoldenTemplate.cs) with golden files under\n test/LayeredCraft.Cdk.Constructs.Tests/GoldenTemplates/*.json (copied to output).\n- Compares the COMPLETE synthesized template (Template.FromStack(...).ToJSON()), normalized only for asset hashes / asset\n S3 keys and CDK metadata (aws:cdk:path, CDKMetadata resource, BootstrapVersion parameter/rule). Document normalization in code.\n- Regeneration only when an env var (e.g. UPDATE_GOLDEN_TEMPLATES=1) is set; default mode fails on any diff with a readable diff message.\n- Stable across all target frameworks (net8.0–net11.0).\n\nExpected files: Directory.Packages.props; test/.../TestKit/Golden/*; test/.../GoldenTemplates/*.json; test/.../ExistingConstructsGoldenTemplateTests.cs; test csproj (copy golden files).\n\nExclusions: no changes to src/ production code; no new constructs; no other package bumps.\nEdge cases: CDK 2.274 may change synthesized output of existing constructs (e.g. new defaults/feature flags). If any golden diff\nappears after the bump, STOP and record the diff on this bead as a blocker for maintainer review; do not \"fix\" by editing goldens.\nAlso record whether CDK default-rule validation still warns \"Unknown resource type AWS::Lambda::WebFunction\" on 2.274 (design §5.5).\n","acceptance_criteria":"- Golden templates for all four existing constructs were generated on Amazon.CDK.Lib 2.273.0 BEFORE the upgrade, passed on 2.273.0, and their SHA-256 hashes are recorded in notes.\n- After upgrading to 2.274.0 the comparison ran against that ORIGINAL baseline; golden-file hashes are unchanged (no regeneration or acceptance of snapshots).\n- If the upgrade changed any synthesized template, the bead is blocked with the recorded diff instead of closed.\n- Directory.Packages.props uses Amazon.CDK.Lib 2.274.0; no other dependency changed.\n- After the bump all golden tests pass with zero diff on every target framework.\n- Harness supports regeneration via env var and fails readably on diff by default.\n- Full validation gates (restore/build/test) pass; coverage threshold not reduced.\n- Notes record commands run, the golden file list, and the 2.274 CloudFormation-Validate warning observation.","notes":"T0 (cdkc-18e.1) implementation evidence\n\nFILES CHANGED / ADDED\n- Directory.Packages.props: Amazon.CDK.Lib 2.273.0 -\u003e 2.274.0 (ONLY dependency change; diff is a single line).\n- test/LayeredCraft.Cdk.Constructs.Tests/LayeredCraft.Cdk.Constructs.Tests.csproj: added \u003cNone Update=\"GoldenTemplates\\**\\*.json\"\u003e\u003cCopyToOutputDirectory\u003ePreserveNewest\u003c/CopyToOutputDirectory\u003e.\n- test/LayeredCraft.Cdk.Constructs.Tests/TestKit/Golden/GoldenTemplate.cs (new): golden harness.\n- test/LayeredCraft.Cdk.Constructs.Tests/ExistingConstructsGoldenTemplateTests.cs (new): 17 golden cases across the 4 existing constructs.\n- test/LayeredCraft.Cdk.Constructs.Tests/GoldenTemplates/*.json (new): 17 baseline golden templates.\nNo changes to src/ production code.\n\nGOLDEN COVERAGE ADDED (17 templates)\n- LambdaFunctionConstruct: lambda-default, lambda-otel-amd64, lambda-otel-arm64, lambda-permissions, lambda-url, lambda-otel-url-permissions.\n- StaticSiteConstruct: static-site-default, static-site-api, static-site-alternates, static-site-full.\n- DynamoDbTableConstruct: dynamodb-default, dynamodb-sort-key, dynamodb-gsi, dynamodb-stream-ttl.\n- CognitoUserPoolConstruct: cognito-prefix-domain, cognito-custom-domain, cognito-no-domain.\n\nNORMALIZATION (documented in GoldenTemplate.cs)\nCompares the COMPLETE Template.FromStack(...).ToJSON(). Only: BootstrapVersion parameter + CheckBootstrapVersion rule removed; AWS::CDK::Metadata resource removed; per-resource Metadata removed (aws:cdk:path / aws:asset:path); 64-hex asset content hashes / S3 keys replaced with \u003cASSET-HASH\u003e. No other keys altered. Regeneration only when UPDATE_GOLDEN_TEMPLATES is truthy; default mode fails with a readable -/+ line diff and never overwrites the golden. Golden files resolve from the source tree (walk-up to project dir) with an output-dir fallback.\n\nCOMMANDS + RESULTS\n- Baseline restore on 2.273.0: `dotnet restore LayeredCraft.Cdk.Constructs.slnx` OK.\n- Baseline test on 2.273.0: `dotnet test --solution LayeredCraft.Cdk.Constructs.slnx -c Release` -\u003e PASSED, 186 x net8.0/net9.0/net10.0/net11.0 (744 total), 0 failed, 0 skipped.\n- Golden files SHA-256 recorded, then upgrade to 2.274.0: `dotnet restore` OK; `dotnet list ... package` shows Amazon.CDK.Lib 2.274.0.\n- Post-upgrade test on 2.274.0 (against the ORIGINAL unchanged baseline): `dotnet test --solution LayeredCraft.Cdk.Constructs.slnx -c Release` -\u003e PASSED, 186 x4 TFMs (744 total), 0 failed, 0 skipped, ZERO golden diff on every TFM.\n- `shasum -a 256` before vs after: HASHES IDENTICAL (git tracked files unmodified by the run).\n\nBASELINE SHA-256 (identical before and after upgrade)\n66398f765a746fbe76268e666d0b492ddb8aadec9f2c4c76d17a25b6981cc769 cognito-custom-domain.json\n3396b3ceeedbd15de26119076158e3f1d0c8bc638f1a2be556e8d87fa8dce30b cognito-no-domain.json\nd18cc32d82a07f45534584a59f5431540883baf24d4bf7311a8ebe14c0ac5447 cognito-prefix-domain.json\n0d5397ab86db3dd0194fd4a6463ebd9461005c65f7964be0b617dfab9ade384e dynamodb-default.json\n07a9509cad0feb734c4c48eec96b4271a9e7c80acb7bdcf39a4bfb6de300e80d dynamodb-gsi.json\n1517371079a842ed38ac411b64e1c4093c80e6b896a77b0ca766762ef9e8412b dynamodb-sort-key.json\n5a500b2d5d2073d0747b355aa19aae5092d8754ad8e529776bebb91997679ab8 dynamodb-stream-ttl.json\nd1038f5889457882b0a50736446376b8a05d9430db99429b39bec989bcd3073b lambda-default.json\n796c2acdaca4bb90df681ddfcd05c5867ed3d0e8e05b0ec417d4cac067fed881 lambda-otel-amd64.json\n26f601e11cb042ed163cc595fb9131bbb1fddbaa0d6993ff6d3a1dfcf094c543 lambda-otel-arm64.json\n8aadb2159cc9febd6a73a7aa888ce470b3ef81eabc8c857174615166efd3b1ff lambda-otel-url-permissions.json\n648cd4745abb61979544466c171b72f7cc70b1e239ca43ec4a58c0e50151a9f6 lambda-permissions.json\nf9b86ad9c94ad499e373df8b97536e0525b4d0565c34539a75df0bd720308362 lambda-url.json\nb1bc13271470ae7136b8f085de3f584e51409acb69788764957079df1c3dd639 static-site-alternates.json\nb5e4a36010f31a7666cc0b9fb0ce94754ed046bb1a6cf3a993bf57d7b0970973 static-site-api.json\n1eb6acb8bd3579c9157ee82fe94e24727c35dafa91828dd7f5d9cc3359cc8f38 static-site-default.json\n63bfa34136f47b16bd7829efa91c8b66b1d000bb2096beeccf961e8ff5a09a04 static-site-full.json\n\n2.274 CLOUDFORMATION DEFAULT-RULE VALIDATION OBSERVATION\nStill warn-only (feature flag @aws-cdk/core:validateAgainstDefaultRules remains OFF by default). A temporary probe that synthesized a raw CfnResource of type AWS::Lambda::WebFunction emitted:\n WARNING Unknown resource type 'AWS::Lambda::WebFunction' (CloudFormation Validate) [CloudFormation-Validate::F3006]\n Set feature flag \"@aws-cdk/core:validateAgainstDefaultRules\" to true to turn these into errors.\nSo the unknown AWS::Lambda::WebFunction type is still only a warning (not an error) on 2.274. Note: the 2.274 assembly does now ship CfnWebFunction / CfnWebFunctionEndpoint / CfnWebFunctionRevision L1 types. The temporary probe file was removed and is not part of the deliverable.\n\nCOVERAGE\nsrc/ production code is unchanged, so the CI 80% coverage gate is unaffected.\n\nRESTRICTIONS HONORED\nNo src/ changes, no new constructs, no other dependency bumps, goldens not regenerated/adjusted, normalization not weakened, no commit/push/PR/deploy/publish.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"task","assignee":"Nick Cipollina","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:46Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T01:32:51Z","started_at":"2026-10-23T01:23:53Z","closed_at":"2026-10-23T01:32:51Z","close_reason":"T0 complete: golden baseline (17 templates, 4 constructs) captured and verified on 2.273.0; Amazon.CDK.Lib bumped to 2.274.0 (only dependency change); goldens re-verified against unchanged baseline with zero diff and identical SHA-256 on all 4 TFMs; 186x4 tests pass. 2.274 default-rule validation still warns (not errors) on unknown AWS::Lambda::WebFunction.","external_ref":"gh-98","labels":["baseline","lambda-web-functions","t0"],"dependencies":[{"issue_id":"cdkc-18e.1","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:46Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e","title":"AWS Lambda Web Functions support — LayeredCraft.Cdk.Constructs","description":"Implement AWS Lambda Web Functions support in LayeredCraft.Cdk.Constructs per the APPROVED design (revision 3):\ndocs/designs/lambda-web-functions-integration.md (authoritative; GitHub issue #98).\n\nScope: new additive constructs WebFunctionConstruct, WebFunctionEndpointConstruct/IWebFunctionEndpoint, WebFunctionOrigin,\nWebFunctionCode.FromBucket, WebFunctionLogs, supporting models, Testing helpers, docs, and a mandatory AWS sandbox release gate.\n\nNon-negotiable constraints (design §2, §6, §8, §10.2, §12.4):\n- Hybrid composition; L3 over CDK L1 (CfnWebFunction/Revision/Endpoint, CfnResourcePolicy); no upstream alpha/L2 dependency;\n upstream L2 types never appear in the public API.\n- Existing constructs (LambdaFunctionConstruct, StaticSiteConstruct, DynamoDbTableConstruct, CognitoUserPoolConstruct) are\n NOT modified; their synthesized templates must not change (golden templates from cdkc T0).\n- Explicit AuthType on every endpoint (no default). Single-owner resource policy per function. Same-stack automatic OAC\n permissions only. Limited endpoint imports (no whole-function import). Existing S3 artifacts only (no FromAsset).\n Default log retention TWO_WEEKS. No customer-managed revision KMS key. Workload-neutral (Next.js, ASP.NET Core shim,\n Blazor Static SSR) with no workload-specific constructs.\n- GrantInvoke follows the revision-3 algorithm in §10.2 (account establishment E1/E2, Automatic vs ExternallyManaged).\n Never use Grant.AddToPrincipalOrResource or trust Grant.Success/AssertSuccess.\n- Amazon.CDK.Lib floor 2.274.0.\n\nRules for every implementation agent:\n- Implement only the claimed bead's scope. If the design is ambiguous or seems wrong, stop and record a blocker note on\n the bead (bd update \u003cid\u003e --append-notes ...) instead of changing the design.\n- Do not commit, push, open PRs, publish NuGet packages, or close GitHub issue #98 unless separately authorized by the maintainer.\n- Do not deploy to AWS except in the sandbox bead, and only with maintainer-provided non-production credentials.\n- Do not modify the Sharedale repository.\n- Validation gates (run from repo root): `dotnet restore LayeredCraft.Cdk.Constructs.slnx`, `dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release`,\n `dotnet test --solution LayeredCraft.Cdk.Constructs.slnx -c Release` (Microsoft.Testing.Platform, see global.json); CI requires\n 80% coverage across net8.0–net11.0. Docs: `uv run mkdocs build --clean`. If Node \u003e24 prints jsii warnings, set\n JSII_SILENCE_WARNING_UNTESTED_NODE_VERSION=1.\n- Test conventions: xUnit v3, AwesomeAssertions, AutoFixture TestKit customizations, `[Collection(\"CDK Tests\")]`, Template.FromStack\n after constructs are added (see CLAUDE.md \"Testing Patterns\").\n- Close a bead only when its acceptance criteria are met; record validation evidence (commands run + results) in notes.\n\nFeature completion is gated by the \"Verify release acceptance criteria\" bead, which depends on the sandbox deployment bead.\nOptional bead T4a never blocks completion.\n","acceptance_criteria":"All required child beads closed, including the AWS sandbox release gate and the release acceptance verification bead; optional spike may be open or closed.","notes":"Agent workflow: find work with 'bd ready --parent cdkc-18e --exclude-type epic'; read 'bd show \u003cid\u003e' (description, acceptance, deps); claim with 'bd update \u003cid\u003e --claim' (or --status in_progress); record evidence with 'bd update \u003cid\u003e --append-notes \"...\"'; close with 'bd close \u003cid\u003e --reason \"...\"' only when acceptance criteria are met; then re-run bd ready. Never claim or close this epic directly: when all children are closed, the maintainer runs 'bd epic close-eligible'. Optional spike cdkc-18e.7 never blocks required work; close it with outcome A or B before epic closure. The feature is complete only after cdkc-18e.14 (which depends on the mandatory AWS sandbox gate cdkc-18e.13).","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":1,"issue_type":"epic","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:45Z","created_by":"Nick Cipollina","updated_at":"2026-10-27T20:08:16Z","closed_at":"2026-10-27T20:08:16Z","close_reason":"All children completed","external_ref":"gh-98","labels":["lambda-web-functions"],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.2.7","title":"#109 HUMAN GATE: owner merges PR for #109","status":"open","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-11-24T02:33:29Z","created_by":"claude","updated_at":"2026-11-24T02:33:29Z","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.2.7","depends_on_id":"cdkc-2lh.2","type":"parent-child","created_at":"2026-11-24T02:33:29Z","created_by":"claude","metadata":"{}"},{"issue_id":"cdkc-2lh.2.7","depends_on_id":"cdkc-2lh.2.6","type":"blocks","created_at":"2026-11-24T02:33:44Z","created_by":"claude","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.2.6","title":"#109 P: PR review (targeted Codex)","status":"open","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-11-24T02:33:28Z","created_by":"claude","updated_at":"2026-11-24T02:33:28Z","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.2.6","depends_on_id":"cdkc-2lh.2","type":"parent-child","created_at":"2026-11-24T02:33:28Z","created_by":"claude","metadata":"{}"},{"issue_id":"cdkc-2lh.2.6","depends_on_id":"cdkc-2lh.2.5","type":"blocks","created_at":"2026-11-24T02:33:42Z","created_by":"claude","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.2.5","title":"#109 R: local review and final validation","notes":"Integration 77ac802 (central AutoFixture/NSubstitute/VSTest removal, CLAUDE.md test sections). Final validation on 77ac802 parents (clean tree, git clean -fdx): build Release 0 warn/0 err; dotnet test --solution -- --coverage: net10.0 +595, net11.0 +595, 1190 passed 0 failed; line coverage 94.5%, branch 86.3%; goldens byte-identical; no AutoFixture/NSubstitute/net8/net9 refs in src/test/.github/props. actionlint exit 0 (W1 tree). Release Drafter check: since v2.6.0 only #106 (type: chore) merged; breaking-change label exists -\u003e major -\u003e 3.0.0.","status":"closed","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-11-24T02:33:27Z","created_by":"claude","updated_at":"2026-11-24T03:39:12Z","closed_at":"2026-11-24T03:39:12Z","close_reason":"All local gates pass on final commit","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.2.5","depends_on_id":"cdkc-2lh.2","type":"parent-child","created_at":"2026-11-24T02:33:27Z","created_by":"claude","metadata":"{}"},{"issue_id":"cdkc-2lh.2.5","depends_on_id":"cdkc-2lh.2.1","type":"blocks","created_at":"2026-11-24T02:33:35Z","created_by":"claude","metadata":"{}"},{"issue_id":"cdkc-2lh.2.5","depends_on_id":"cdkc-2lh.2.2","type":"blocks","created_at":"2026-11-24T02:33:37Z","created_by":"claude","metadata":"{}"},{"issue_id":"cdkc-2lh.2.5","depends_on_id":"cdkc-2lh.2.3","type":"blocks","created_at":"2026-11-24T02:33:39Z","created_by":"claude","metadata":"{}"},{"issue_id":"cdkc-2lh.2.5","depends_on_id":"cdkc-2lh.2.4","type":"blocks","created_at":"2026-11-24T02:33:41Z","created_by":"claude","metadata":"{}"}],"dependency_count":4,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.2.4","title":"#109 T: 3.0.0 design doc incl. WebFunctionConstruct vs CDK L2 decision record (Claude)","notes":"Design doc committed 32cef89 (docs/designs/v3-modernization.md, rev 1 Proposed): policy, upgrade-induced changes, versioning, U1-U4/U7, U6, WebFunctionConstruct vs CDK L2 decision record with synthesis spike evidence; recommends A for 3.0.0, proposes separate gated spike issue for C (needs owner approval). Owner approval of the design is a #109 acceptance item (open).","status":"closed","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-11-24T02:33:26Z","created_by":"claude","updated_at":"2026-11-24T03:39:10Z","closed_at":"2026-11-24T03:39:10Z","close_reason":"Design drafted and committed 32cef89; owner approval tracked on #109","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.2.4","depends_on_id":"cdkc-2lh.2","type":"parent-child","created_at":"2026-11-24T02:33:26Z","created_by":"claude","metadata":"{}"},{"issue_id":"cdkc-2lh.2.4","depends_on_id":"cdkc-2lh.2.1","type":"blocks","created_at":"2026-11-24T02:33:40Z","created_by":"claude","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.2.3","title":"#109 T: Compono test-stack migration replacing AutoFixture/NSubstitute (OpenCode W2)","notes":"OWNERSHIP: may change test/LayeredCraft.Cdk.Constructs.Tests/** except GoldenTemplates/**, TestAssets/**, TestKit/Golden/**. Must not: src/**, Directory.*.props (Claude), global.json, .github, docs, README, CLAUDE.md. Worktree ../worktrees/cdk-constructs-w2-compono branch test/v3-compono baseline ab2483b; brief /private/tmp/claude-501/-Users-ncipollina-source-repos-ncipollina-jedi-duel/ff5c8c05-e7c5-46dd-80db-44e46f5c7f53/scratchpad/v3/brief-w2-compono.md; log /private/tmp/claude-501/-Users-ncipollina-source-repos-ncipollina-jedi-duel/ff5c8c05-e7c5-46dd-80db-44e46f5c7f53/scratchpad/v3/w2.log\nW2 session ses_df496565affeRbmllFcBWcbts3. Observed reads: all required (AGENTS, SKILL, implement, testing, cross-repository, compono SKILL + xunit-v3/registrations/composition-model/patterns/diagnostics, CLAUDE.md). Round 1: f6f6ce2..0ab6d0b (profiles, per-construct migration, package removal), 595/TFM. Claude finding C1 (incidental values no longer generated) -\u003e correction-1: d90be14, 3e12fcc (MemorySize/Timeout/log levels generated via CompositionContext.DeriveSeed within valid ranges; documented 'Compono does not provide this because' optional members). Worker: 3x full suite 595/TFM. Merged 2526588.","status":"closed","priority":2,"issue_type":"task","assignee":"claude","owner":"ncipollina@gmail.com","created_at":"2026-11-24T02:33:24Z","created_by":"claude","updated_at":"2026-11-24T03:39:08Z","started_at":"2026-11-24T02:36:37Z","closed_at":"2026-11-24T03:39:08Z","close_reason":"Reviewed; merged 2526588; 595/TFM","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.2.3","depends_on_id":"cdkc-2lh.2","type":"parent-child","created_at":"2026-11-24T02:33:24Z","created_by":"claude","metadata":"{}"},{"issue_id":"cdkc-2lh.2.3","depends_on_id":"cdkc-2lh.2.1","type":"blocks","created_at":"2026-11-24T02:33:38Z","created_by":"claude","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.2.2","title":"#109 T: workflows (devops-templates v11.2, action pins) + docs/CLAUDE.md/README (OpenCode W1)","notes":"OWNERSHIP: may change .github/workflows/*, README.md, CLAUDE.md (excluding testing sections), docs/** except docs/designs/**. Must not: src, test, props, global.json, release-drafter.yml, dependabot.yml. Worktree ../worktrees/cdk-constructs-w1-workflows branch ci/v3-workflows-docs baseline ab2483b; brief /private/tmp/claude-501/-Users-ncipollina-source-repos-ncipollina-jedi-duel/ff5c8c05-e7c5-46dd-80db-44e46f5c7f53/scratchpad/v3/brief-w1-workflows.md; log /private/tmp/claude-501/-Users-ncipollina-source-repos-ncipollina-jedi-duel/ff5c8c05-e7c5-46dd-80db-44e46f5c7f53/scratchpad/v3/w1.log\nW1 session ses_df49637d7ffeeHlCYvnfVE26JR; OpenCode 1.19.3 / openrouter/deepseek/deepseek-v4.1-flash. Round 1 commits dd63def ci v11.2, 8fd2dd0 docs. Observed reads: all required paths. Worker validation: YAML parse (ruby), actionlint exit 0, greps clean. Review findings -\u003e correction-1 (same session): C1 blocking false 'L1-only' claims (CDK 2.278 ships L2) + add consumer type-name collision note; C2 blocking unverified F3006@2.278 claim, restore 2.274 wording; C3 SDK pin is contributor not consumer requirement; C4 publish-release comment consistency.\nCorrection-1 commits bb7c44d, 4164270 address C1-C4; Claude re-ran actionlint (exit 0); sample check confirmed. Integration follow-up (Claude): add IWebFunctionEndpoint (root namespace) to the collision note. Merged into chore/v3-modernization.","status":"closed","priority":2,"issue_type":"task","assignee":"claude","owner":"ncipollina@gmail.com","created_at":"2026-11-24T02:33:23Z","created_by":"claude","updated_at":"2026-11-24T02:40:44Z","started_at":"2026-11-24T02:36:37Z","closed_at":"2026-11-24T02:40:44Z","close_reason":"W1 reviewed, no blocking findings after correction-1; merged","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.2.2","depends_on_id":"cdkc-2lh.2","type":"parent-child","created_at":"2026-11-24T02:33:23Z","created_by":"claude","metadata":"{}"},{"issue_id":"cdkc-2lh.2.2","depends_on_id":"cdkc-2lh.2.1","type":"blocks","created_at":"2026-11-24T02:33:36Z","created_by":"claude","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.2.1","title":"#109 T: foundation — SDK pin, net10/net11, dependency bumps, CDK 2.278 compile/jsii fixes (Claude)","notes":"Claude foundation on chore/v3-modernization (worktree ../worktrees/cdk-constructs-v3-modernization): ab2a58b fix FunctionUrlOptions/AddBehaviorOptions (jsii 2.278 required-member validation); ab2483b build! net10/net11, SDK 11.0.100, CDK 2.278.0 (+ file-local aliases for CDK's new same-named Web Function types), SourceLink 11.0.100, xunit.v3.mtp-v2 4.0.3, MS.NET.Test.Sdk 18.12.0, runner.visualstudio 4.0.1, Compono 1.4.0 central, VersionPrefix 3.0.0. Validation: build 0 warn/0 err; dotnet test --solution 595 passed per TFM (net10.0, net11.0); goldens byte-identical; baseline before: 595x4 TFMs.","status":"closed","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-11-24T02:33:22Z","created_by":"claude","updated_at":"2026-11-24T02:36:35Z","closed_at":"2026-11-24T02:36:35Z","close_reason":"Foundation committed ab2483b; green; goldens unchanged","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.2.1","depends_on_id":"cdkc-2lh.2","type":"parent-child","created_at":"2026-11-24T02:33:22Z","created_by":"claude","metadata":"{}"}],"dependency_count":0,"dependent_count":4,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.7","title":"HUMAN GATE: owner authorizes #110/#111 implementation (after #109 design review)","description":"Owner 2026-11-24: #110-#112 may not start until the #109 design and implementation are reviewed and the next phase is authorized.","status":"open","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-11-24T02:33:18Z","created_by":"claude","updated_at":"2026-11-24T02:33:18Z","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.7","depends_on_id":"cdkc-2lh","type":"parent-child","created_at":"2026-11-24T02:33:18Z","created_by":"claude","metadata":"{}"},{"issue_id":"cdkc-2lh.7","depends_on_id":"cdkc-2lh.2","type":"blocks","created_at":"2026-11-24T02:33:20Z","created_by":"claude","metadata":"{}"}],"dependency_count":1,"dependent_count":2,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.6","title":"HUMAN GATE: owner publishes the v3.0.0 stable release","description":"After #112 downstream validation evidence. Publishing the GitHub release triggers publish-release.yaml (NuGet push).","acceptance_criteria":"Owner publishes; release URL + NuGet version recorded.","status":"open","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-11-24T01:27:25Z","created_by":"Nick Cipollina","updated_at":"2026-11-24T01:27:25Z","labels":["human-gate","release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.6","depends_on_id":"cdkc-2lh","type":"parent-child","created_at":"2026-11-24T01:27:25Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-2lh.6","depends_on_id":"cdkc-2lh.5","type":"blocks","created_at":"2026-11-24T01:27:31Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.5","title":"#112 3.0.0: downstream validation (Jedi Duel, Sharedale) and stable release","description":"https://github.com/LayeredCraft/cdk-constructs/issues/112 (authoritative). Throwaway-branch validation against the same 3.0.0-preview in both consumers; nothing merged downstream here.","acceptance_criteria":"See #112.","status":"open","priority":2,"issue_type":"feature","owner":"ncipollina@gmail.com","created_at":"2026-11-24T01:27:24Z","created_by":"Nick Cipollina","updated_at":"2026-11-24T01:27:24Z","external_ref":"gh-112","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.5","depends_on_id":"cdkc-2lh","type":"parent-child","created_at":"2026-11-24T01:27:24Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-2lh.5","depends_on_id":"cdkc-2lh.3","type":"blocks","created_at":"2026-11-24T01:27:29Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-2lh.5","depends_on_id":"cdkc-2lh.4","type":"blocks","created_at":"2026-11-24T01:27:30Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":2,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.4","title":"#111 3.0.0: private static-assets construct (BPA, OAC, optional DNS, immutable deployment)","description":"https://github.com/LayeredCraft/cdk-constructs/issues/111 (authoritative).","acceptance_criteria":"See #111.","status":"open","priority":2,"issue_type":"feature","owner":"ncipollina@gmail.com","created_at":"2026-11-24T01:27:22Z","created_by":"Nick Cipollina","updated_at":"2026-11-24T01:27:22Z","external_ref":"gh-111","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.4","depends_on_id":"cdkc-2lh","type":"parent-child","created_at":"2026-11-24T01:27:22Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-2lh.4","depends_on_id":"cdkc-2lh.2","type":"blocks","created_at":"2026-11-24T01:27:28Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-2lh.4","depends_on_id":"cdkc-2lh.7","type":"blocks","created_at":"2026-11-24T02:33:19Z","created_by":"claude","metadata":"{}"}],"dependency_count":2,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.3","title":"#110 3.0.0: LambdaFunctionConstruct U1 alias name, U2 alias-only default, U3 public alias, U4 scoped log policy, U7 S3 artifacts","description":"https://github.com/LayeredCraft/cdk-constructs/issues/110 (authoritative).","acceptance_criteria":"See #110.","status":"open","priority":2,"issue_type":"feature","owner":"ncipollina@gmail.com","created_at":"2026-11-24T01:27:21Z","created_by":"Nick Cipollina","updated_at":"2026-11-24T01:27:21Z","external_ref":"gh-110","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.3","depends_on_id":"cdkc-2lh","type":"parent-child","created_at":"2026-11-24T01:27:21Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-2lh.3","depends_on_id":"cdkc-2lh.2","type":"blocks","created_at":"2026-11-24T01:27:27Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-2lh.3","depends_on_id":"cdkc-2lh.7","type":"blocks","created_at":"2026-11-24T02:33:19Z","created_by":"claude","metadata":"{}"}],"dependency_count":2,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.2","title":"#109 3.0.0: drop net8/net9, update all dependencies, SDK and workflows, Compono-first tests (+ design doc)","description":"https://github.com/LayeredCraft/cdk-constructs/issues/109 (authoritative). Golden templates byte-identical; breaking-change label; supersedes Dependabot #101; first merge publishes 3.0.0-preview.N.","acceptance_criteria":"See #109.","status":"in_progress","priority":2,"issue_type":"feature","assignee":"claude","owner":"ncipollina@gmail.com","created_at":"2026-11-24T01:27:20Z","created_by":"Nick Cipollina","updated_at":"2026-11-24T02:33:21Z","started_at":"2026-11-24T02:33:21Z","lease_expires_at":"2026-11-24T02:38:21Z","heartbeat_at":"2026-11-24T02:33:21Z","external_ref":"gh-109","labels":["release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.2","depends_on_id":"cdkc-2lh","type":"parent-child","created_at":"2026-11-24T01:27:20Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-2lh.2","depends_on_id":"cdkc-2lh.1","type":"blocks","created_at":"2026-11-24T01:27:26Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":3,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh.1","title":"HUMAN GATE: owner authorizes 3.0.0 implementation","description":"Planning authorized 2026-11-24 (issues/Beads only). Implementation needs the owner's separate explicit authorization.","acceptance_criteria":"Owner authorization quoted in a note.","notes":"Owner statement 2026-11-24: 'Authorize upstream Phase 1a — #109. Proceed with the modernization of LayeredCraft.Cdk.Constructs ... Create the PR for my review. I retain merge and publication authority.' and 'Do not begin #110, #111 or #112 implementation until the #109 design and implementation have been reviewed and the next phase is authorized.' Gate covers #109 only.","status":"closed","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-11-24T01:27:19Z","created_by":"Nick Cipollina","updated_at":"2026-11-24T02:33:17Z","closed_at":"2026-11-24T02:33:17Z","close_reason":"Owner authorized Phase 1a (#109 only) 2026-11-24; #110-#112 need a new gate","labels":["human-gate","release:v3.0.0"],"dependencies":[{"issue_id":"cdkc-2lh.1","depends_on_id":"cdkc-2lh","type":"parent-child","created_at":"2026-11-24T01:27:19Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-2lh","title":"LayeredCraft.Cdk.Constructs 3.0.0 — .NET 10/11 modernization, LambdaFunctionConstruct options, private static assets","description":"GitHub milestone v3.0.0 https://github.com/LayeredCraft/cdk-constructs/milestone/1 ; epic issue https://github.com/LayeredCraft/cdk-constructs/issues/108 (authoritative scope; Beads = execution state). Owner decisions 2026-11-24: dogfooding is an architectural requirement; fix gaps upstream; don't compromise APIs to avoid breaking changes; drop net8/net9; update all deps/SDK/workflows to current stable; Compono-first tests; U2 default alias-only; include U7 S3 artifacts. Preview strategy: first code PR (#109) labeled breaking-change so all previews are 3.0.0-preview.N; fold Dependabot #101 into #109; stable publish only on owner authorization. Downstream consumers: ncipollina/jedi-duel #292 (tracking bead jedi-duel-aub.16), sharedale/sharedale #266.","acceptance_criteria":"All child issues closed with evidence; net10/net11 green; golden diffs only intentional; migration guide; downstream validation; owner publishes v3.0.0.","status":"open","priority":2,"issue_type":"epic","owner":"ncipollina@gmail.com","created_at":"2026-11-24T01:27:17Z","created_by":"Nick Cipollina","updated_at":"2026-11-24T01:27:17Z","external_ref":"gh-108","labels":["release:v3.0.0"],"dependency_count":0,"dependent_count":0,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.18.3","title":"#104 O: Document companion log groups, ownership, regional limits, and AlreadyExists remedies","description":"Objective: consumer documentation and operational guidance for LayeredCraft/cdk-constructs#104, written against design\nrevision 5 (cdkc-18e.18.1). May run in parallel with cdkc-18e.18.2 once revision 5 is approved; reconcile with the final\ncode before the PR. (Design doc itself: cdkc-18e.18.1. XML docs: cdkc-18e.18.2.)\n\nFiles: docs/constructs/web-function.md (\"Execution Role and Logging\" ~L132-139, props table ~L95, reserved IDs ~L151,\ntesting helpers ~L369, limitations ~L387-388); docs/testing/index.md (Web Function assertions, if listed);\nCHANGELOG.md [Unreleased]; CLAUDE.md (WebFunctionConstructAssertions list + WebFunctionLogs notes).\n\nMust cover:\n1. Why two groups exist (in-Region staging -\u003e home-Region centralization) and why events look duplicated (same\n timestamps/messages; centralized stream name adds -{account}-{region}); storage billed for both.\n2. Retention: centralized default TWO_WEEKS, companion default THREE_DAYS, why the companion is short; how to set\n both (Create(retention, removalPolicy, companionRetention)); companion inherits the removal policy.\n3. Which group to query: centralized for normal querying/alarms; `.local` in the serving Region for lowest-latency Live Tail.\n4. Ownership table for Create / Use(logGroup) / Use(logGroup, companion) / ServiceDefault: who creates, owns,\n deletes each group; ServiceDefault = both service-created, unlimited retention, outlive the stack.\n5. Execution-role permissions: the verified resource types (CreateLogGroup -\u003e log-group ARN; CreateLogStream/\n PutLogEvents -\u003e log-stream ARN), the per-role matrix, and the exact caller-provided permissions from design rev 5\n §8.3 (stream write on {c}:log-stream:* in the home Region and {c}.local:log-stream:* in {R}; CreateLogGroup on\n {c}.local only where Lambda creates it, and on {c} for ServiceDefault). Without .local write, logs from that Region\n are not delivered. Immutable roles are caller-managed.\n6. Ordering: managed groups precede the revision; supplied same-stack groups too; imported/cross-stack groups must\n exist before deployment.\n7. Regional limits: PerRegion/MultiRegion companions in other Regions are service-created with no expiry and not\n managed; set retention there separately; W2 id and how to acknowledge (Annotations acknowledgeWarning /\n `cdk synth --strict` impact). W1 id for Use without companion.\n8. AlreadyExists when adopting a managed companion where Lambda already created `{name}.local` (e.g. preview.27 stacks\n that served traffic, ServiceDefault -\u003e Create, redeploy after stack deletion): remedies = delete the\n service-created group(s) before deploying, or move to a new centralized group name; no adoption support.\n9. Teardown: DESTROY removes both managed groups after the revision; RETAIN keeps both; remote-Region companions\n always remain.\n10. CHANGELOG: Added (companion group, companionRetention, Use companion, LocalLogGroup, assertions, warnings);\n Fixed (missing .local write grant for Use custom groups; missing ordering for same-stack supplied groups);\n Notes (two groups per Create, AlreadyExists, binary break vs 2.6.0-preview.27 requiring recompilation). Reference #104;\n claim no released version.\n","acceptance_criteria":"- Topics 1–10 covered, with code examples for Create(custom retentions) and Use(logGroup, companion).\n- Ownership table and permissions matrix present in docs/constructs/web-function.md.\n- W1/W2 ids documented verbatim.\n- CHANGELOG [Unreleased] entry references #104 and claims no released version.\n- Docs match the final implemented API names/defaults (cross-checked with cdkc-18e.18.2 before the PR).\n- `uv run mkdocs build --clean` passes.","notes":"Documentation complete per design revision 5. Updated docs/constructs/web-function.md (two-group behavior, duplicate events/storage, query guidance, Create/Use/ServiceDefault, ownership+retention table, ordering/teardown, execution-role and caller-provided permissions incl. log-group vs log-stream ARNs and minimizePolicies, Multi-Region/W2, verbatim W1/W2 IDs and acknowledgement, AlreadyExists remedies, public API, testing helpers). Updated docs/testing/index.md (ShouldHaveWebFunctionLogGroup, ShouldHaveCompanionLogGroup, ShouldHaveRevisionDependingOnLogGroups), CLAUDE.md, and CHANGELOG [Unreleased] Added/Fixed/Notes for #104 with no released version claimed. Validation: uv run mkdocs build --strict --clean passed with no errors/warnings (built in 1.20s); AWS logging/permissions docs and GitHub #104 links return 200; internal anchors verified in built HTML; examples cross-checked against WebFunctionLogs.cs/WebFunctionConstruct.cs; W1/W2 IDs exact; design revision 5 unchanged; no src/test/GoldenTemplates changes; git diff --check clean.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-26T15:32:53Z","created_by":"Nick Cipollina","updated_at":"2026-10-26T22:57:33Z","started_at":"2026-10-26T22:52:52Z","closed_at":"2026-10-26T22:57:33Z","close_reason":"Documentation for #104 completed against design revision 5: two-group logging behavior, all three modes, ownership/retention and execution-role permission matrices, Multi-Region limits, verbatim W1/W2 warnings with acknowledgement, AlreadyExists remedies, public API/testing helpers, and CHANGELOG [Unreleased] entries. uv run mkdocs build --strict --clean passes; links, anchors, API examples, and warning IDs verified; no src/test/golden changes.","external_ref":"gh-104","labels":["docs","gh-104","lambda-web-functions","logging"],"dependencies":[{"issue_id":"cdkc-18e.18.3","depends_on_id":"cdkc-18e.18","type":"parent-child","created_at":"2026-10-26T15:32:53Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.18.3","depends_on_id":"cdkc-18e.18.1","type":"blocks","created_at":"2026-10-26T15:32:53Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.16","title":"T2 follow-up: Harden owned code-bucket inspection (tokens, unrecognized values, DSSE classification)","description":"Purpose: align WebFunctionCodeFromBucket.ValidateOwnedBucketConfiguration (src/LayeredCraft.Cdk.Constructs/Models/WebFunctionCode.cs) with design §14 and the revision-4 clarification under the §14 table. Source: independent review findings P4 and DSSE.\n\nDefects:\n(1) Tokens are rejected instead of skipped: a VersioningConfiguration.Status token resolves to {Ref:...}, its ToString() is compared to 'Enabled', and the bucket is rejected.\n(2) A Stack.Resolve result whose structure is not recognized should be treated as unknown and skipped, not rejected.\n(3) UsesAwsManagedKey rejects every aws:kms:dsse bucket, including DSSE with a customer-managed key. Per §8.7/§14, reject only DSSE_MANAGED (no key) and KMS_MANAGED/aws/s3, and make each message name the actual problem.\n(4) Versioning enabled only through an escape-hatch property override is a documented limitation, not a fix target. T6a documents the workaround (Bucket.FromBucketName + ExternallyManaged).\n\nKeep the current rule that owned buckets are inspected even under ExternallyManaged; the design does not change that.\n\nTests: token Status skipped; DSSE with a customer key accepted; DSSE_MANAGED rejected with an accurate message; KMS_MANAGED still rejected; customer-key SSE-KMS accepted; unversioned still rejected.\n\nExclusions: IAM/grant code (T3c), docs (T6a). No golden changes expected; verify. No commits or pushes unless authorized.","acceptance_criteria":"• Unresolved bucket configuration values are handled conservatively: a token or unrecognized versioning Status, encryption algorithm, encryption structure, or KMS key id is SKIPPED and never rejected (each case has a test). Unresolved values are never treated as proof of a violation.\n• Literal violations are still rejected: unversioned, KMS_MANAGED/aws/s3, DSSE_MANAGED (no key).\n• DSSE with a customer-managed key is accepted. Messages name the actual problem.\n• Escape-hatch-only versioning remains a documented limitation (T6a); it is not handled in code.\n• New tests pass; all goldens unchanged.\n• Release build has 0 warnings and the full suite passes on net8.0–net11.0; evidence is recorded in notes.","notes":"Maintainer decision (2026-10-23): keep escape-hatch S3 versioning as a documented limitation. Handle unresolved values conservatively: never reject tokenized values.\nIMPLEMENTATION (2026-10-23): Rewrote WebFunctionCodeFromBucket.ValidateOwnedBucketConfiguration in src/LayeredCraft.Cdk.Constructs/Models/WebFunctionCode.cs into ValidateVersioning + ValidateEncryption + ValidateKmsKey, classifying every value as literal-valid, literal-invalid, or unresolved/unrecognized.\n\nStorage/versioning/encryption handling:\n- Versioning: missing VersioningConfiguration or literal Status \"Suspended\" -\u003e reject (VersioningMessage). Literal Status \"Enabled\" -\u003e accept. A token Status, a missing status key, a non-dictionary resolved structure, or any other literal status -\u003e skipped (never rejected).\n- Encryption: missing BucketEncryption -\u003e no violation. Unrecognized structure (not a map, no rules, no ServerSideEncryptionByDefault) -\u003e skipped. Algorithm literal \"aws:kms\": key literal aws/s3 or empty/absent -\u003e reject (KmsManagedMessage names aws/s3); literal customer key -\u003e accept; token/absent-as-token key -\u003e skipped (never treated as AWS-managed). Algorithm literal \"aws:kms:dsse\": no key / aws/s3 -\u003e reject (DsseManagedMessage names customer-managed key); literal customer key -\u003e accept; token key -\u003e skipped. AES256 and any other literal algorithm -\u003e accepted.\n- LiteralString helper returns null for a non-string value or a string containing `${Token[`, so resolved tokens are never misread as literals.\n\nSecurity-policy behavior: ExternallyManaged still inspects owned buckets (versioning/encryption) exactly as before - design §14 row unchanged. The Automatic-only cross-stack account/Region guard and AddToResourcePolicy remain bypassed under ExternallyManaged (no bucket-policy statement is generated). No other semantics changed.\n\nRegression tests added to test/LayeredCraft.Cdk.Constructs.Tests/WebFunctionConstructTests.cs (13 new): enabled+S3-managed accepted (asserts synthesized S3::BucketPolicy); disabled (Versioned=false) rejected with versioning message; suspended rejected; tokenized versioning Status skipped (asserts synthesized policy); unrecognized literal versioning Status skipped; AWS-managed KMS (aws/s3) rejected naming aws/s3; customer-managed KMS accepted; tokenized KMS key skipped; DSSE with customer-managed key accepted; DSSE_MANAGED rejected naming customer-managed; DSSE + aws/s3 rejected; unrecognized encryption structure skipped; ExternallyManaged cross-stack owned bucket with unresolved function env does not throw (Automatic-only guard not applied). Existing fixtures retained (owned-bucket policy statements + revision DependsOn on bucket policy, imported-bucket Automatic error, ExternallyManaged no-policy, unversioned, KMS_MANAGED, cross-stack Automatic error). These exercise the real L1 property structs (CfnBucket.VersioningConfigurationProperty / BucketEncryptionProperty) so validation runs against synthesized configuration.\n\nEvidence: dotnet build -c Release -\u003e Build succeeded, 0 Warning(s), 0 Error(s). Full suite per TFM (dotnet run --project test/LayeredCraft.Cdk.Constructs.Tests/ -c Release --no-build): net8.0/net9.0/net10.0/net11.0 each Total 450, Errors 0, Failed 0, Skipped 0 (was 437 before; +13). All 24 golden templates byte-identical (git reports no GoldenTemplates changes); no golden updates required. dotnet format --verify-no-changes reports no issues in the two changed files. Only two files modified. No commit or push performed (per task restrictions).\n\nUnresolved behavior (documented, not code): versioning enabled solely via an escape-hatch property override is not detected (limitation, T6a workaround); imported buckets remain uninspected.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":2,"issue_type":"task","assignee":"Nick Cipollina","owner":"ncipollina@gmail.com","created_at":"2026-10-23T12:49:20Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T14:43:43Z","started_at":"2026-10-23T14:34:44Z","closed_at":"2026-10-23T14:43:43Z","close_reason":"Owned-bucket inspection hardened per design §14 rev4. Unresolved values (token/unrecognized versioning Status, encryption algorithm, KMS key id, encryption structure) are skipped and never rejected; literal violations still rejected (unversioned/Suspended, KMS_MANAGED aws/s3, DSSE_MANAGED); DSSE with a customer-managed key accepted; messages name the actual problem. ExternallyManaged still inspects owned buckets but emits no policy and keeps the Automatic-only cross-stack guard. 13 new regression tests; Release build 0 warnings; full suite 450/450 on net8.0-net11.0; all 24 goldens unchanged. Not committed (per task).","external_ref":"gh-98","labels":["core","lambda-web-functions","t2"],"dependencies":[{"issue_id":"cdkc-18e.16","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T12:49:20Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.16","depends_on_id":"cdkc-18e.3","type":"blocks","created_at":"2026-10-23T12:49:20Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.12","title":"T7b: Create sandbox CDK app and deploy/smoke/destroy scripts (no deployment)","description":"Purpose: sandbox CDK app and smoke-test tooling that exercises the implemented constructs exactly as a consumer would. No deployment in this bead. Design §19.1 item 3 (all sub-items), §9, §12.\n\nDeliverables under samples/web-functions/sandbox/ (not in the library slnx/CI):\n- A CDK app (C#) referencing the library project, with explicit Env (account/region from context or env vars; never hard-coded production values):\n * ArtifactsStack: owned versioned SSE-S3 Bucket used with WebFunctionCodeBucketPolicy.Automatic (bucket stack deployed and artifacts uploaded BEFORE the app stack, because the\n object must exist before the revision is created and Automatic adds the statement to the bucket's own stack).\n * A pre-provisioned \"external\" bucket (created by the script or a separate stack with its own lambda.amazonaws.com read policy) imported via Bucket.FromBucketName and used with ExternallyManaged.\n * AppStack: Next.js Web Function (IamAuth) behind a Distribution via WebFunctionOrigin.WithOriginAccessControl (default uncached + ALL_VIEWER_EXCEPT_HOST_HEADER, /_next/static/* cached);\n ASP.NET Core Web Function (IamAuth) with a second endpoint (for the endpoint-specific denial test) and GrantInvoke to a dedicated \"caller\" IAM role assumable by the operator;\n Blazor Web Function (IamAuth) behind OAC (fingerprinted/static assets cached); context flags to (a) switch artifacts to the v2 build (revision update), (b) add/remove a second\n distribution on the Next.js endpoint (resource-policy lifecycle), (c) optionally add an ExternallyManaged cross-account grant for a second sandbox account.\n * Outputs needed by the smoke script (endpoint URLs/ARNs, distribution domains/ids, caller role ARN). Use the library's naming; prefix all names with a sandbox prefix.\n- smoke.sh (bash, AWS CLI v2 + curl with --aws-sigv4 \"aws:amz:\u003cregion\u003e:lambda\" and header x-amz-content-sha256: UNSIGNED-PAYLOAD) implementing every §19.1 3.x check with expected status codes,\n `aws lambda-web get-resource-policy` inspection, revision/endpoint state checks, and a machine-readable summary; deploy.sh (ordered: artifacts stack → upload zips → app stack) and destroy.sh\n (destroys stacks, empties/deletes buckets incl. all object versions, deletes log groups).\n- README.md: prerequisites, required IAM permissions, non-production account requirement, cost notes, step-by-step run, cleanup, and how to record evidence.\n\nValidation in this bead: `cdk synth` of the sandbox app succeeds locally without deploying (use dummy account/region context); scripts pass shellcheck if available. No AWS deployment.\nExclusions: running against AWS (next bead); changes to library production code (record blockers instead).\n","acceptance_criteria":"- Sandbox CDK app synthesizes using only the public library API and covers every §19.1 item 3 scenario via stacks/context flags.\n- deploy/smoke/destroy scripts and README exist; smoke script checks every §19.1 3.1–3.8 item with explicit expected results; cleanup removes all created resources.\n- No deployment performed; library validation gates still pass.","notes":"## T7b implementation + correction record (no AWS deployment performed)\n\n### Sandbox CDK app (samples/web-functions/sandbox/, 20 files, untracked)\nC# CDK app (net10.0) referencing the real LayeredCraft.Cdk.Constructs project and exercising only the public Web Function API (WebFunctionConstruct, AddEndpoint, WebFunctionOrigin OAC, GrantInvoke, GrantCloudFrontInvoke). Stacks: lccdk-wf-sandbox-{id}-artifacts (versioned SSE-S3 bucket, Automatic), -external (versioned bucket + scoped read policy + 2 imported-caller roles), -app (Next.js/ASP.NET Core/Blazor Web Functions, 4 endpoints, 3 resource policies, 2 CloudFront distributions + OACs, caller/denied/imported roles, 28 outputs). Scripts: common.sh, validate-env.sh, synth.sh, upload-artifacts.sh, deploy.sh, update-to-v2.sh, destroy.sh, smoke.sh, run-workflow.sh + README.md.\n\n### Corrections applied (independent review)\n- B1 repeat-deploy: deploy.sh always synthesizes the COMPLETE app (SANDBOX_COMPONENTS=all) so support-stack cross-stack exports survive; support stacks deployed first with guarded placeholder versions, then upload, then app stack with real versions.\n- B2 destroy: destroy.sh synthesizes with SANDBOX_ALLOW_PLACEHOLDER_VERSIONS=1 so teardown works without a manifest / after partial failure; destroys app-\u003eexternal-\u003eartifacts, verifies each stack is gone before removing the manifest.\n- H1 ownership: fixed namespace lccdk-wf-sandbox in stack names; stack tags lc-webfunction-sandbox-id / lc-webfunction-sandbox-owner on every stack; shell stack_ownership (absent|owned|foreign|error) + assert_stack_owned_or_absent (deploy) / require_stack_owned (destroy); fail-closed on foreign or ambiguous results; every aws call pinned to --region and ambient-region mismatch aborts; mutations require SANDBOX_ALLOW_AWS=1 AND SANDBOX_ACKNOWLEDGE_NON_PRODUCTION=1.\n- M1: stack_exists replaced by stack_ownership (distinguishes not-found from AccessDenied/throttling/expired creds).\n- M2: empty_bucket deletes only object versions + delete markers (never delete-bucket); --expected-bucket-owner on head/list/delete; CloudFormation deletes the buckets; only stack-owned buckets are emptied.\n- M3: artifacts prefix consistent (SandboxConfiguration default key now uses the configured SANDBOX_ARTIFACTS_PREFIX; manifest/upload/CDK agree).\n- M4: CDK CLI pinned to 2.1145.0 (common.sh CDK_CLI_VERSION); SANDBOX_CDK override documented.\n- M5: external bucket policy scoped per function (arn:aws:lambda:{region}:{account}:web-function/{wfsbx-aspnetcore|wfsbx-blazor}/revision/*), no broad web-function/*/revision/*.\n- M6: app stack declares explicit CDK dependencies on artifacts + external (AddStackDependency).\n- SM1-SM7: smoke.sh rewritten - errexit disabled during tests + always writes build/smoke-summary.json + non-zero exit on fail/blocked; live resource-policy validation (BLOCKED, never PASS, when lambda-web API unavailable) checking Principal/Action/Effect/Resource/aws:SourceArn; revision/endpoint state via lambda-web get-web-function; Next.js build-id parser strips the 'Build id: ' label; Blazor sample now exposes id=\"build-id\"; real warm-request and Blazor assertions; denial classification (signature vs access-denied) requiring the matching positive to pass; imported immutable/mutable roles verified to have NO caller-side identity policy; cross-account distinguishes not-configured/missing-setup/negative/positive; SigV4 creds passed via a 600-perm curl -K config (never argv); bounded retry with validated numeric input.\n- Phase 7 misc: missing-flag-value guards, explicit SANDBOX_SECOND_DISTRIBUTION=0 reset, manifest target (sandboxId/account/region/prefix) validated before reuse, README documents CDK bootstrap + AWS CLI + missing lambda-web subcommands + prefix + pinned CLI + non-prod ack.\n\n### Offline validation (no AWS mutations)\n- Offline lifecycle harness with stubbed aws/cdk: 61/61 checks across 16 scenarios (fresh prep, support provisioning, upload+manifest, app deploy, repeat deploy, v1-\u003ev2, second-distribution enable/disable, normal/partial/repeated destroy, account mismatch, foreign-stack refusal, credential/API failure, S3 cleanup failure, manifest missing/foreign, nondefault prefix). Proves destroy never calls s3api delete-bucket.\n- Real cdk synth (npx aws-cdk@2.1145.0): verified stack ownership tags on all three stacks, per-function scoped external bucket policy, app-\u003eartifacts/external dependencies, cloudfront SourceArn resource policies, ASP.NET Core 2 imported-role statements, 28 app outputs. Expected F3006 warnings for the new resource types.\n- bash -n clean on all scripts. shellcheck not installed locally.\n- Library tests: 2140 passed / 0 failed (net8/9/10/11); no golden-template regressions.\n- Generated outputs (cdk.out/bin/obj/build) remain gitignored; git add -n lists exactly the 20 intended files.\n- Read-only identity check used a disposable test account (id withheld); NO deploy/destroy/upload performed.\nSecond independent review (Claude) returned CHANGES REQUIRED. Deploy/update/destroy lifecycle, placeholder mechanism, stack ownership, cross-stack deps, and synthesized IAM policies are independently validated and must NOT be redesigned. Correcting: S1 smoke.sh $4 under set -u; S2 CURL_AUTH omitted on CallerRole/imported-role positives; S3 CloudFront ARN empty region; S4 fail-closed live resource-policy verification (parser crash/omission must FAIL/BLOCKED); S5 imported-role identity-policy checks (list-role-policies failure != no policy; inline+attached; IAM sim); S6 Next.js build-ID extraction (HTML comments); S7 per-function revision/update verification; L1 remove unsafe log-group deletion; L2 prevalidate manifest on --skip-upload before any mutation; L3 first-run workflow without manifest; L4 preserve shell command failures; L5 bound --attempts + cross-account negative authorization. No real AWS mutations; do not start T7c.\n## T7b second-round corrections (independent review) — complete\n\n### S1-S7 (smoke execution correctness)\n- S1: smoke.sh settle() and fetch_until() optional positional args now use ${4:-}; regression scenario 1 proves the first passing check no longer aborts the suite.\n- S2: every IAM-signed positive invocation passes ${CURL_AUTH[@]} (curl -K config file, 0600); credentials are never on the curl argv. Scenario 2 asserts the signed requests reached the endpoint.\n- S3: CloudFront ARNs now use the empty region component arn:aws:cloudfront::\u003caccount\u003e:distribution/\u003cid\u003e; scenario 3 validates the policy checks against that ARN.\n- S4 (fail-closed): policy_report catches parse/schema errors and emits FAIL; unreadable/missing live policies emit FAIL/BLOCKED; a completeness check requires all 3 policy-check records (fewer =\u003e FAIL). Validates Effect=Allow, principal, action lambda:InvokeWebFunctionEndpoint, endpoint Resource ARN, aws:SourceArn; detects duplicate statements and unexpected distribution grants. Scenarios 4-8 cover malformed JSON, parser exception, missing policy, duplicate, extra, and second-distribution-removed.\n- S5: role_invoke_state inspects inline AND attached policies; any lookup failure returns error =\u003e BLOCKED (never PASS); scenario 9 (IAM AccessDenied) asserts BLOCKED.\n- S6: Next.js and Blazor samples render a stable data-build-id attribute; smoke extracts it (immune to SSR HTML comments); scenario 10 rejects a wrong build id.\n- S7: per-function revision tracking (each function queried separately; BLOCKED when the API is unavailable); --revision-baseline compares per-function revision identities before/after an update; run-workflow.sh derives --expect-build-id from the local artifact zip build-id.txt; scenarios 11-12 cover distinct per-function revisions and the v1-\u003ev2 transition (advanced vs unchanged).\n\n### L1-L5\n- L1: destroy.sh no longer deletes log groups by predictable name; CloudFormation deletes the CFN-owned log groups with their stacks. Scenario 13 asserts no log-group deletion API call and no delete-bucket.\n- L2: deploy.sh validates the artifact manifest (existence, sandbox id, account, region, prefix, required keys+versions) BEFORE any support-stack mutation when --skip-upload; a mismatched manifest performs zero AWS mutations. Scenario 14.\n- L3: run-workflow.sh no longer synthesizes before deploy (deploy.sh synthesizes), so a fresh checkout works without an existing manifest; placeholder-version protection is unchanged. Scenario 15.\n- L4: common.sh export_artifact_env assigns then exports (no export VAR=$(cmd) masking of failures under errexit).\n- L5: --attempts is bounded 1..60; cross-account adds the negative half (cross-account role on the alt endpoint =\u003e denied) and never PASSes when unconfigured.\n\n### Files changed (all uncommitted)\nsamples/web-functions/sandbox/: smoke.sh, common.sh, deploy.sh, destroy.sh, run-workflow.sh, synth.sh, upload-artifacts.sh, validate-env.sh, README.md, SandboxConfiguration.cs, SandboxNaming.cs, ArtifactsStack.cs, ExternalStack.cs, AppStack.cs, Program.cs; NEW tests/run-scenarios.sh, tests/run-smoke-scenarios.sh, tests/stubs/{aws,cdk,curl}. Also apps/nextjs/app/page.js, apps/blazor/Components/Pages/Home.razor, apps/blazor/Program.cs (S6 data-build-id). Plus .beads/issues.jsonl.\n\n### Regression test results (stubbed AWS/CDK/curl; no real AWS)\n- tests/run-scenarios.sh: 61 passed / 0 failed (lifecycle: stacks-only, upload, deploy, repeat, v1-\u003ev2, second-dist enable/disable, destroy, partial/repeated destroy, account mismatch, foreign stack, credential/API fail, S3 cleanup fail, manifest missing/mismatch, nondefault prefix).\n- tests/run-smoke-scenarios.sh: 38 passed / 0 failed (S1-S7/L1-L5 smoke correctness, fail-closed policy verification, per-function revisions, v1-\u003ev2, L1/L2/L3).\n\n### Other validation\n- bash -n OK for all 11 sandbox+test scripts; shellcheck not installed (noted).\n- Library tests: 2140 passed / 0 failed (net8.0/9.0/10.0/11.0); no golden-template changes.\n- Offline cdk synth OK (stacks lccdk-wf-sandbox-wfsbx-{artifacts,external,app}); H1 ownership tags on all stacks, M5 external bucket policy scoped per function revision ARN, M6 app-\u003esupport dependencies, resource policies 1/2/1 statements.\n\n### Remaining AWS-only uncertainties (deferred to T7c)\nReal deploy/smoke/destroy not performed. lambda-web CLI subcommands are unavailable in the local CLI, so live revision/policy checks report BLOCKED there. Cross-account requires a second sandbox account. IAM identity-policy propagation timing is only observable against real AWS.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:57Z","created_by":"Nick Cipollina","updated_at":"2026-10-24T21:05:54Z","started_at":"2026-10-24T01:31:48Z","closed_at":"2026-10-24T21:05:54Z","close_reason":"T7b second-round corrections complete: S1-S7 and L1-L5 resolved; added stub-driven regression harness (tests/run-scenarios.sh 61/61, tests/run-smoke-scenarios.sh 38/38); bash -n clean; library tests 2140/0; offline synth verified (H1/M5/M6). No AWS mutations; T7c still pending.","external_ref":"gh-98","labels":["lambda-web-functions","samples","sandbox","t7"],"dependencies":[{"issue_id":"cdkc-18e.12","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:57Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.12","depends_on_id":"cdkc-18e.11","type":"blocks","created_at":"2026-10-23T01:15:19Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.12","depends_on_id":"cdkc-18e.6","type":"blocks","created_at":"2026-10-23T01:15:18Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":2,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.11","title":"T7a: Create sandbox workload sample apps (Next.js, ASP.NET Core shim, Blazor Static SSR) and artifact builds","description":"Purpose: minimal, deployable workload artifacts for the sandbox release gate. Independent of the library code; can start immediately. Design §16 recipes, §19.1 items 2–3.8.\n\nDeliverables under samples/web-functions/apps/ (consumer-style sample code, NOT library code; must not be added to LayeredCraft.Cdk.Constructs.slnx or the PR CI build):\n1. nextjs/: minimal Next.js app (one server-rendered page that prints a request-time value + one static asset), `output: \"standalone\"`, and an index.js entry that sets\n HOSTNAME/PORT from AWS_LAMBDA_HTTP_ENDPOINT (\"host:port\"), handles SIGTERM with exit(0), then require(\"./server.js\"). Zip layout: standalone output + .next/static + public at zip root.\n2. aspnetcore/: minimal ASP.NET Core API (GET /status returning JSON incl. a build id; one protected-by-IAM-only route is fine) published self-contained linux-arm64 as apphost `server`;\n zip root contains index.js = `process.execve(\"/var/task/server\", [\"/var/task/server\"], process.env);` and the publish output. App listens on http://$AWS_LAMBDA_HTTP_ENDPOINT,\n then POSTs `{}` to http://$AWS_LAMBDA_RUNTIME_API/2025-09-01/ready after StartAsync (skip when the variable is absent); no UseHttpsRedirection/HSTS; invariant globalization\n or app-local ICU (runtime has no libicu).\n3. blazor/: minimal Blazor Static SSR app (one SSR page; wwwroot/app.css), same shim/readiness contract, untrimmed publish, ContentRootPath = AppContext.BaseDirectory\n when AWS_LAMBDA_HTTP_ENDPOINT is set, MapStaticAssets/MapRazorComponents; NO Interactive Server/Auto render modes. Reference https://github.com/j-d-ha/lambda-web-function-not-node (src/blazor, src/node-wrapper).\n4. build script (samples/web-functions/build-artifacts.sh): produces nextjs.zip, aspnetcore.zip, blazor.zip (and a second \"v2\" build id variant for the revision-update test) into an\n output folder; uses Docker/`--platform linux/arm64` or `dotnet publish -r linux-arm64 --self-contained`; documents prerequisites (Node 24+, pnpm/npm, .NET 10 SDK, Docker optional).\n5. Local smoke check per artifact (run the server with AWS_LAMBDA_HTTP_ENDPOINT=127.0.0.1:PORT and a mock readiness endpoint, assert the page/asset/status) — local only.\n\nConstraints: samples get their own Directory.Build.props/Directory.Packages.props overrides if needed so they do not alter the library build; framework-only dependencies for .NET samples\n(do not add packages to the repo's central Directory.Packages.props). Use .NET 10 (GA) for samples. No AWS calls.\n","acceptance_criteria":"- Three sample apps and the build script exist under samples/web-functions/; artifacts build reproducibly and pass local smoke checks (record commands and output).\n- Blazor sample is Static SSR only, serves a rendered page and app.css.\n- Library solution build/tests unaffected (samples not in slnx; central package file unchanged); validation gates pass.","notes":"T7a evidence — samples/web-functions (build id 8024874b91cc)\n\nArtifacts (./build-artifacts.sh --clean):\n- build/nextjs.zip (12M) + nextjs-v2.zip\n- build/aspnetcore.zip (45M) + aspnetcore-v2.zip\n- build/blazor.zip (44M) + blazor-v2.zip\n\nBuild commands:\n- cd samples/web-functions \u0026\u0026 ./build-artifacts.sh [--clean|--only \u003capp\u003e|--build-id \u003cid\u003e|--out \u003cdir\u003e]\n- nextjs: npm ci + next build (output:\"standalone\"); zip root = .next/standalone/. + .next/static + public + index.js + build-id.txt\n- aspnetcore/blazor: dotnet publish -c Release -r linux-arm64 --self-contained -p:PublishTrimmed=false -p:TargetFramework=net10.0; zip root = publish output + index.js + build-id.txt\n\nLocal validation (./smoke-artifacts.sh [--only \u003capp\u003e]):\n- shim parse: node --check on all three apps/*/index.js -\u003e ok\n- nextjs: PASS (SSR heading, build id, sample.txt static asset)\n- aspnetcore: PASS (/health backend+buildId, /status requestTimeUtc, readiness POST received) under mcr.microsoft.com/dotnet/runtime-deps:10.0 --platform linux/arm64\n- blazor: PASS (rendered page, app.css, _framework/blazor.web.js, readiness POST received)\n\nLayout/permission checks:\n- no absolute-path entries in any zip\n- server entry mode -rwxr-xr-x in aspnetcore.zip and blazor.zip\n- nextjs top-level: server.js, index.js, package.json, build-id.txt\n- blazor contains wwwroot/app.css + wwwroot/_framework/blazor.web.js\n- v1 vs v2 build-id.txt differ (8024874b91cc vs 8024874b91cc-v2)\n- Blazor Static SSR only; no Interactive Server/Auto/AddInteractive anywhere in source\n\nLibrary unaffected:\n- dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release =\u003e 0 warnings, 0 errors\n- tests 535/535 pass on net8.0, net9.0, net10.0, net11.0\n- golden templates unchanged; samples not referenced by slnx; central Directory.Packages.props / Directory.Build.props unchanged\n\nLimitations: local smoke covers the HTTP contract and readiness handshake only; real deployment, CloudFront/OAC behavior, and runtime scaling are not verifiable without AWS (deferred to T7b). Docker Desktop on macOS cannot bind-mount the /var/folders TMPDIR, so smoke work dirs live under build/.smoke/.\nT7a corrections (F1-F8) — validated 2026-10-23 (macOS arm64; Node v26.7.0/npm 11.19.0; .NET 10.0.103; Docker 29.2.1).\n\nF1 --out normalization: build-artifacts.sh resolves --out to an absolute path (against the caller's CWD) before any cd. Relative and absolute --out both write zips to the intended directory and leak no build directory into the source tree. Covered by tools/test-tooling.sh.\n\nF2 safe cleanup: --clean removes only generated content (*.zip, stage/, .smoke/) inside --out and never deletes --out itself or unrelated files. tools/test-tooling.sh uses sentinels (KEEP.txt, unrelated.txt, subdir) that survive --clean: 4/4 regression cases PASS.\n\nF3 Next.js platform deps: next.config.mjs sets images.unoptimized=true; the build installs with `npm ci --os=linux --cpu=arm64 --libc=glibc`. nextjs.zip now contains @img/sharp-linux-arm64 + @img/sharp-libvips-linux-arm64 and no darwin/win32 native modules (previously darwin-arm64). The artifact targets linux/arm64 and is not host-independent.\n\nF4 real entrypoints: smoke-artifacts.sh mounts the extracted artifact read-only at /var/task in public.ecr.aws/lambda/nodejs:24 (linux/arm64, Node v24.22.1, process.execve present) and runs `node /var/task/index.js`. ASP.NET Core and Blazor exercise the Node.js execve shim; the readiness POST is verified through a mock runtime API.\n\nF5 stronger checks: asserts the artifact's actual build-id.txt value in the running app (nextjs page, aspnetcore /health), fetches a real /_next/static/*.js chunk (HTTP 200), validates all six zips (v1 + v2), and asserts v2 id == v1 id + \"-v2\".\n\nF6 diagnostics: containers run without --rm; on failure the script prints the container and mock-runtime logs before failing, then removes the containers on exit. Negative test (injected crash) captured the app's \"simulated crash marker\" stderr and left no containers behind.\n\nF7 determinism: README and the build script header state builds are repeatable but not byte-for-byte reproducible (ZIP mtimes/ordering, Next.js generated identifiers).\n\nF8 tracing root: next.config.mjs sets outputFileTracingRoot to the app directory; server.js remains at the zip root.\n\nValidation: `./build-artifacts.sh --clean` =\u003e nextjs.zip 12M, aspnetcore.zip 44M, blazor.zip 44M (+ -v2 variants). `./smoke-artifacts.sh` =\u003e all six artifacts PASS through their index.js in the Lambda nodejs:24 image (nextjs: heading + build id + public asset + static chunk; aspnetcore: /health build id + /status dynamic + readiness; blazor: page + app.css + _framework/blazor.web.js + readiness). Library Release build 0 warnings/0 errors; tests 535/535 on net8.0/net9.0/net10.0/net11.0; golden templates unchanged; root build config, slnx, and src unchanged. Not committed.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:56Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T20:03:37Z","started_at":"2026-10-23T19:19:08Z","closed_at":"2026-10-23T20:03:37Z","close_reason":"T7a corrections F1-F8 applied and validated: safe --out handling, targeted cleanup with sentinel regression tests, linux-arm64 Next.js native deps, real index.js execution in the Lambda nodejs:24 base image for all three workloads, stronger build-id/static-chunk/v1-v2 checks, failure diagnostics, corrected determinism claims, pinned tracing root. All six artifacts pass smoke; library build/tests/goldens unaffected. Not committed (awaiting maintainer acceptance).","external_ref":"gh-98","labels":["lambda-web-functions","samples","sandbox","t7"],"dependencies":[{"issue_id":"cdkc-18e.11","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:56Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":0,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.10","title":"T6b: Update README, testing docs, CHANGELOG, and repo CLAUDE.md for Web Functions","description":"Purpose: repository-level docs for the release. Design §16 (last bullets), §13 (semver/CDK floor).\n\nDeliverables:\n- docs/testing/index.md: WebFunctionConstructAssertions and WebFunctionConstructPropsBuilder usage (from the Testing helpers bead).\n- README.md: construct list entry and short example.\n- docs/index.md: construct list.\n- CHANGELOG.md: new types; Amazon.CDK.Lib minimum raised to 2.274.0; no changes to existing constructs; KMS deferral; FromAsset not yet available.\n- CLAUDE.md (repo): architecture section entry for the Web Function constructs and Testing helpers (keep style).\nExclusions: version number bumps / VersionPrefix changes (maintainer decides at release; design §18 item 7); release notes publishing.\nValidation: `uv run mkdocs build --clean`; samples match the API.\n","acceptance_criteria":"- README, docs/index.md, docs/testing/index.md, CHANGELOG.md, CLAUDE.md updated consistently with the implemented API.\n- No version-number changes; mkdocs build succeeds.","notes":"T6b IMPLEMENTATION (2026-10-23, session T6b-docs).\\n\\nFiles changed (docs only; no production/dependency changes):\\n- README.md: +Web Functions feature bullet; new 'Quick Start \u003e Web Function' example (WebFunctionCode.FromBucket + IamAuth endpoint; compiles against public API); Documentation links for Web Function Construct + Web Function Workloads; Requirements CDK floor 2.203.1+ -\u003e 2.274.0+.\\n- docs/index.md: +Web Functions key-feature bullet; +Web Function Construct entry under Available Constructs; +Web Function Workloads link; CDK floor -\u003e 2.274.0+.\\n- docs/testing/index.md: +'## Web Function Testing' section (Props Builder, Assertion Methods, AutoData Support, Golden-Template Conventions, CDK/jsii Compatibility Considerations); +WebFunctionConstructAutoDataAttribute in Custom Attributes; +Web Function test files in Examples list.\\n- CHANGELOG.md: +'## [Unreleased]' entry (Added: WebFunctionConstruct/Endpoint/Origin + models + testing helpers; Changed: Amazon.CDK.Lib min 2.274.0; Notes/Deferrals: existing constructs zero diff, FromAsset not available, customer-managed revision KMS deferred, principal-behavior regression rule, F3006 warnings). No package version claimed.\\n- CLAUDE.md: Project Overview +Core Components WebFunctionConstruct; Configuration Models Web Function line; Target Frameworks 2.274.0; Test Architecture attr/customization; Testing Helpers CreateWebFunctionPropsBuilder + WebFunctionConstructAssertions/WebFunctionConstructPropsBuilder/Golden Templates; new 'CDK Upgrade Regression Rule' section (CdkUpgradeGuard_* gate + jsii principal-materialization detection).\\n- .beads/issues.jsonl: status update.\\n\\nVALIDATION EVIDENCE:\\n- uv run mkdocs build --strict --clean =\u003e RC=0. Only expected INFO: design doc not in nav. No link/validation errors.\\n- README Quick Start + docs/testing Props Builder/Assertion/AutoData snippets compiled in isolated consumer project (/var/folders/.../t6adocs-compile, Amazon.CDK.Lib 2.274.0 + ProjectReference): Build succeeded, 0 warnings, 0 errors. Used all public APIs only (including Constructs namespace fix added to README example).\\n- dotnet build -c Release =\u003e Build succeeded, 0 warnings, 0 errors.\\n- dotnet run --project test/LayeredCraft.Cdk.Constructs.Tests/ --framework net8.0 =\u003e Total: 535, Errors: 0, Failed: 0, Skipped: 0.\\n- Golden templates untouched: git status --porcelain test/.../GoldenTemplates/ empty (no existing-construct golden changes).\\n- Only docs + .beads changed; no public API/dependency changes (Directory.Packages.props untouched).\\n- T6b NOT committed (per instructions).","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":2,"issue_type":"task","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:55Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T19:10:54Z","started_at":"2026-10-23T19:06:42Z","closed_at":"2026-10-23T19:10:54Z","close_reason":"T6b complete: README, docs/testing, CHANGELOG, CLAUDE.md updated for Lambda Web Functions. Evidence: mkdocs --strict RC=0; examples compile against public API (0 warn/0 err); dotnet build Release 0/0; tests 535 passed/0 failed; zero golden changes; no dependency changes. Not committed (per instructions).","external_ref":"gh-98","labels":["docs","lambda-web-functions","t6"],"dependencies":[{"issue_id":"cdkc-18e.10","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:55Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.10","depends_on_id":"cdkc-18e.8","type":"blocks","created_at":"2026-10-23T01:15:17Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":1,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.9","title":"T6a: Write Web Function construct docs, security guidance, and workload recipes","description":"Purpose: user documentation for the constructs and the three workload recipes. Design §16 (AUTHORITATIVE content list), §5 (facts), §10–§12 (security/deployment), §14 (documented-not-validated list), §8.7.\n\nDeliverables:\n- docs/constructs/web-function.md: overview; auth modes and who can reach an endpoint (ApplicationManaged is public even behind CloudFront; IamAuth ≠ user auth);\n WebFunctionCode.FromBucket requirements (versioning, s3:GetObject/GetObjectVersion, /revision/* SourceArn statement, optional VersionId semantics, cross-account buckets,\n SSE-KMS key policy, CDK bootstrap bucket incompatibility, object must exist before deploy); WebFunctionLogs (TWO_WEEKS default, ONE_MONTH example, ServiceDefault no expiry);\n endpoints/AddEndpoint and revision-change behavior; GrantInvoke table from §10.2 incl. ExternallyManaged contract and caller-side SigV4 (service lambda, UNSIGNED-PAYLOAD,\n Authorization stripping); single-owner resource-policy contract; WebFunctionOrigin (OAC, same-stack rule, ExternallyManaged, imported endpoints);\n cache/header guidance (§11.3: never forward Host / use ALL_VIEWER_EXCEPT_HOST_HEADER, Authorization in cache policy, Lambda@Edge origin triggers rejected, opt-in Regions 403);\n replacement table (§12.2); validation errors (§14); KMS deferral + unsupported escape hatch (§8.7); limitations.\n- Workload recipes (same page or docs/examples/web-functions.md): Next.js standalone; ASP.NET Core via Node.js execve shim (self-contained linux-arm64 apphost \"server\", index.js\n `process.execve(\"/var/task/server\", [\"/var/task/server\"], process.env);`, Kestrel on http://$AWS_LAMBDA_HTTP_ENDPOINT, readiness POST to\n http://$AWS_LAMBDA_RUNTIME_API/2025-09-01/ready after start, app-local ICU or invariant globalization, no HTTPS redirection/HSTS); Blazor Static SSR (same shim; untrimmed server;\n ContentRootPath = AppContext.BaseDirectory when AWS_LAMBDA_HTTP_ENDPOINT is set; wwwroot/_framework shipped; cache fingerprinted assets; Interactive Server/Auto/legacy Blazor Server\n UNSUPPORTED — WebSockets rejected). Mark execve/readiness as not documented by AWS. Reference https://github.com/j-d-ha/lambda-web-function-not-node.\n- mkdocs.yml nav entry under Constructs (and examples page if created). Do NOT add the design doc to nav.\n- docs/examples/index.md: §9 examples.\n\nExclusions: README/CHANGELOG/testing docs (separate bead); no code changes.\nValidation: `uv run mkdocs build --clean` succeeds; every code sample matches the implemented public API (cross-check against src/).\n","acceptance_criteria":"- docs/constructs/web-function.md and recipes cover every §16 item, including security callouts and the §10.2 grant table.\n- Three workload recipes are complete and explicitly distinguish Blazor Static SSR from Interactive Server.\n- mkdocs nav updated; mkdocs build succeeds; samples match the real API.","notes":"Also document (derived from design §8.2 + §12.1, found during planning): with WebFunctionCodeBucketPolicy.Automatic the code object must exist before the revision is created, so in practice the owned bucket must live in a separately deployed stack (deploy bucket stack -\u003e upload artifact -\u003e deploy function stack). A bucket created in the same stack as the function cannot be pre-populated.\nREVIEW ROUTING (2026-10-23, design revision 4). Add to docs/constructs/web-function.md:\n(1) Log-group switching: moving an EXISTING function from WebFunctionLogs.ServiceDefault() to Create(), or redeploying after stack deletion while /aws/lambda/web/{name} still exists, fails with AlreadyExists because Lambda auto-creates the group. Document the remedies: Use(LogGroup.FromLogGroupName(...)), or delete/import the group.\n(2) CDK 2.274 emits F3006 'Unknown resource type AWS::Lambda::WebFunction*' validation warnings, which become synthesis ERRORS when @aws-cdk/core:validateAgainstDefaultRules is enabled. Document the acknowledgement IDs (CloudFormation-Validate::F3006) and the consequence.\n(3) GrantInvoke rejects service principals (CloudFront → GrantCloudFrontInvoke; other services → explicit condition-scoped AddToResourcePolicy) and unconditioned wildcards; same-account AccountPrincipal is not 'complete'.\n(4) The revision no longer waits for execution-role DefaultPolicy statements; a brief IAM-propagation window can occur on first deploy.\n(5) Owned-bucket limitation: versioning enabled only by an escape-hatch override is not detected; workaround Bucket.FromBucketName + ExternallyManaged.\n(6) IWebFunctionEndpoint is not intended for consumer implementation.\nMaintainer clarification (2026-10-23):\n(7) Conditioned wildcard resource-policy statements are supported only through explicit AddToResourcePolicy. The consumer is responsible for ensuring the conditions meaningfully restrict access; the library checks only that conditions are present.\n(8) Imported endpoints: document the optional Account attribute. GrantInvoke needs an established endpoint account (literal ARN or literal Account); a token-ARN endpoint is still usable as an ExternallyManaged OAC origin.\nFrom T4 independent review (F1): document the IOrigin.Bind exception behavior. Exceptions thrown inside IOrigin.Bind (and inside CDK's HttpOrigin constructor) cross the jsii boundary and surface to .NET callers as System.Exception carrying the original message (e.g. \"connectionAttempts: Must be an int between 1 and 3 (inclusive); received 5.\"), whereas WebFunctionOrigin factory-time validation (auth mismatch, nulls) throws InvalidOperationException directly. Cover this in the Web Function security/usage docs.\nT6a DOCUMENTATION COMPLETE (not committed).\n\nFiles: NEW docs/constructs/web-function.md (construct reference); NEW docs/examples/web-functions.md (three workload recipes); MODIFIED mkdocs.yml (added \"Web Function\" under Constructs and split Examples into Overview + \"Web Function Workloads\"; design doc intentionally NOT added to nav); MODIFIED docs/examples/index.md (new \"Web Function Examples\" section reproducing design 9.1-9.7 using only the real public API).\n\nConstruct page contents: when to use WebFunctionConstruct; intentional non-goals (v1); prerequisites (CDK \u003e= 2.274.0, explicit-Env stack, versioned bucket with an uploaded artifact, bootstrap not usable); S3 artifact requirements and ownership (versioning required, VersionId pinning, Lambda service-principal read with the /revision/* aws:SourceArn statement, Automatic vs ExternallyManaged, SSE-KMS key-policy requirement, cross-account/cross-region, 409 Platform.RevisionNotActive when the pinned object/read access disappears) with a warning that the artifact (and an externally managed bucket policy) must exist before deploy and that an owned bucket must be separately deployed; execution role (AWSLambdaBasicExecutionRole default / Role override) and logging (WebFunctionLogs Create/ServiceDefault/Use, retention default TWO_WEEKS, log levels); function revisions and endpoints (default endpoint, AddEndpoint, reserved child ids, replace-vs-no-interruption semantics); authentication modes table (IamAuth vs ApplicationManaged) with the explicit warning that IamAuth is a transport boundary, not user authentication; invocation grants (GrantInvoke overloads, GrantCloudFrontInvoke, identity vs resource policy); resource-policy single-owner contract (endpoint-only entry points, Resource must be exactly the endpoint ARN, validate-then-freeze, dedup, no other AWS::Lambda::ResourcePolicy/Permission); imported endpoints (FromEndpointAttributes, owns nothing, literal validation, optional Account for token ARNs); CloudFront OAC integration (With/WithoutOriginAccessControl, factory-time auth check, same-stack automatic rule, ExternallyManaged two-phase, one OAC per distribution, supplied OAC used unchanged) plus caching/header guidance (never forward Host use ALL_VIEWER_EXCEPT_HOST_HEADER, CACHING_DISABLED for dynamic routes, Authorization cache-policy caveat, CloudFront Function host recovery, CACHING_OPTIMIZED for content-hashed assets, Lambda@Edge origin triggers rejected, opt-in Region 403, transient 403 after deploy); public testing helpers; known limitations and operational guidance; validation-error table; links to the testing guide and examples.\n\nSecurity/IAM model documented plainly: owned vs imported principals; owned vs imported endpoints; same-stack environment-agnostic grants; cross-stack and cross-account restrictions; identity-policy vs resource-policy permissions; Automatic vs ExternallyManaged caller policies with an explicit warning that ExternallyManaged does NOT mean invocation permissions have been configured; why GrantInvoke rejects service principals (use GrantCloudFrontInvoke or an explicit AddToResourcePolicy), account principals, wildcard principals, PrincipalWithConditions and WithoutPolicyUpdates; GrantCloudFrontInvoke SourceArn scoping; consumer responsibility for explicit conditioned wildcard policies; the imported endpoint optional Account attribute; conditions that cannot be fully validated during synthesis.\n\nWorkload recipes: Next.js standalone (artifact prep, index.js shim env mapping, entry-point expectation, CloudFront OAC + static-asset caching, ISR/image caveats); ASP.NET Core (self-contained linux-arm64 server apphost + Node.js execve shim, Kestrel on AWS_LAMBDA_HTTP_ENDPOINT, readiness POST to the runtime API, no HTTPS redirection/HSTS, app-local ICU or invariant globalization, CloudFront integration); Blazor Static SSR (same shim/readiness, untrimmed publish, ContentRootPath, wwwroot/_framework size, cache fingerprinted assets; Interactive Server/Auto/legacy UNSUPPORTED). Each recipe states that configurations synthesize but runtime behavior still requires AWS deployment; a \"Sandbox validation\" section lists exactly what synthesis tests do NOT prove (execve shim, readiness POST, first request, OAC end-to-end including transient 403), leaving real deployed smoke validation to T7c.\n\nKnown issues/operational guidance: S3 versioning configured exclusively through escape hatches is not inspected; tokenized bucket configuration is skipped by validation; log-group switching AlreadyExists with remedies; IAM policy propagation when revisions become active (CfnRole-only dependency); CloudFront origin-binding exceptions surface as System.Exception through jsii vs InvalidOperationException at the factory; F3006 warnings and the CloudFormation-Validate::F3006 acknowledgement / validateAgainstDefaultRules consequence; OAC naming; origin-request policy requirements (AllViewerExceptHostHeader vs AllViewer); imported endpoints with externally managed permissions.\n\nVALIDATION: `uv run mkdocs build --clean` =\u003e rc=0, \"Documentation built\" (the only notice is the Material for MkDocs 2.0 team announcement; the design doc is expectedly absent from nav). Relative links verified to resolve: docs/constructs/web-function.md -\u003e ../examples/web-functions.md, ../testing/index.md, ../examples/index.md; docs/examples/web-functions.md -\u003e ../constructs/web-function.md and ../constructs/web-function.md#caching-and-header-guidance (heading \"### Caching and header guidance\" at line 307); docs/examples/index.md -\u003e ../constructs/web-function.md. Every code sample cross-checked against the implemented public API in src via grep (WebFunctionConstruct, IWebFunctionEndpoint, WebFunctionLogs, WebFunctionOrigin, WebFunctionEndpointConstruct.FromEndpointAttributes, WebFunctionConstructProps, WebFunctionEndpointOptions, WebFunctionCode.FromBucket/options, WebFunctionEndpointAttributes, WebFunctionInvokeGrantOptions, WebFunctionOriginProps/WithOacProps). No contradiction with revision 4. `dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release` =\u003e 0 warnings / 0 errors (docs are markdown only and do not affect build inputs). mkdocs artifacts .venv/ and site/ are gitignored. No production construct changed; Sharedale untouched.\nT6a CORRECTION EVIDENCE (independent-review findings 1-9 resolved; awaiting maintainer acceptance; NOT committed).\n\nDocs changed: docs/constructs/web-function.md (~413 lines), docs/examples/web-functions.md (~205 lines), docs/examples/index.md (Web Function Examples section), mkdocs.yml (nav). No production construct changed.\n\nFinding 1 (grant direction): docs/examples/web-functions.md ASP.NET Core recipe now calls api.DefaultEndpoint.GrantInvoke(web) (was web.DefaultEndpoint.GrantInvoke(api)). The identity policy is written on the caller (the Next.js front end \"web\"); the API remains the invoke target.\n\nFinding 2 (code-bucket ownership): docs/constructs/web-function.md - the S3 Artifact Requirements read-access bullet now states Lambda reads with the Lambda service principal and the Automatic statement is scoped with BOTH StringEquals aws:SourceAccount and ArnLike aws:SourceArn (arn:aws:lambda:{region}:{account}:web-function/{FunctionName}/revision/*); the Automatic bullet now says it manages an owned bucket, including a bucket owned by another stack when that stack's account and Region are explicitly resolvable, while an imported bucket or a cross-stack bucket with unresolved environment info fails and asks for ExternallyManaged. The \"artifact must exist before you deploy\" warning now says a same-stack owned bucket does not contain the artifact at first deployment and the artifact must be uploaded before the function stack deploys (a separately deployed bucket is a good fit; any pre-populated bucket works). docs/examples/index.md Next.js comment corrected accordingly.\n\nFinding 3 (wildcard conditions): \"Why GrantInvoke rejects certain principals\" now explains AddToResourcePolicy only checks that an Allow wildcard statement HAS conditions and does not verify they restrict access; the consumer owns the condition semantics (aws:PrincipalOrgID given as a potentially meaningful restriction); the mere presence of a condition proves nothing.\n\nFinding 4 (ExternallyManaged + account principals): the account-principal bullet now states account-root is never a complete Automatic grant, and under ExternallyManaged an explicitly requested account principal may be recorded in the OWNED endpoint's resource policy while caller-side authorization is still not configured. The Imported Endpoints section now states GrantInvoke with CallerPolicy = ExternallyManaged also throws on an imported endpoint because there is no owned resource policy to receive the statement.\n\nFinding 5 (reference material): three new sections added to docs/constructs/web-function.md before \"Public Testing Helpers\": \"Grant Behavior Reference\" (grantee x caller-policy matrix matching rev-4 section 10.2, incl. \"partial by contract\" definition), \"Signing Requests\" (SigV4 service name lambda; x-amz-content-sha256: UNSIGNED-PAYLOAD; MultiRegion SigV4A with region *; direct IAM invocation vs CloudFront OAC signing; Lambda strips its own SigV4 Authorization), and \"Resource Replacement and Update Behavior\" (rev-4 section 12.2 table: revision-triggering changes, Endpoint AuthType transitions with transient 403, EndpointName/EndpointType/Regions/FunctionName replacement, distribution replacement, clearing scaling/throttling, no unverified AWS behavior asserted as proven).\n\nFinding 6 (namespaces + real compilation): added a \"Required namespaces\" section to docs/examples/web-functions.md. Created an isolated consumer project (/var/folders/d5/h9s1_byj70391flgcvsfsqn40000gn/T/opencode/t6adocs-compile: net8.0 exe, ProjectReference to src/LayeredCraft.Cdk.Constructs, Amazon.CDK.Lib 2.274.0) whose Examples.cs reproduces the documented examples via the public API only; it compiles green (Basic Usage; ASP.NET Core api + api.DefaultEndpoint.GrantInvoke(web); Next.js web with ObjectVersion; cross-account partner with ExternallyManaged; Next.js CloudFront OAC distribution; Blazor CloudFront distribution; imported-endpoint ExternallyManaged origin). NOTE for consumers with ImplicitUsings enabled: qualify Amazon.CDK.Environment (System.Environment is otherwise ambiguous).\n\nFinding 7 (config/exception accuracy): MaxConcurrencyPerEnvironment now reads \"Max concurrent requests per environment, 1-128 (AWS default 64)\". The Known Limitations section retains that bind-time CloudFront origin exceptions surface as System.Exception through jsii while factory-time checks throw InvalidOperationException. The \"Same-stack, environment-agnostic grants\" paragraph now says Automatic grants are valid when the owned caller and endpoint belong to the same Stack instance, and that two separate env-agnostic stacks are NOT the same stack.\n\nFinding 8 (operational): supplied execution roles are documented as receiving no AWSLambdaBasicExecutionRole and no automatic log-write grant; Create()-to-ServiceDefault() is documented as deleting the stack-owned log group (default DESTROY) with Lambda recreating the default group without expiry; OAC naming collisions are documented as identical names across Regions within the SAME account; cross-stack ExternallyManaged CloudFront is documented to use a literal distribution ARN; linux-arm64 is described as the recipe's tested target (not asserted as AWS-confirmed); the 10-second listen deadline on AWS_LAMBDA_HTTP_ENDPOINT is documented; internal \"Sharedale-style\" wording removed; the Blazor CloudFront example was completed with a full Distribution (DefaultBehavior + /_framework/* and /_content/* CACHING_OPTIMIZED + DomainNames + Certificate).\n\nFinding 9 (KMS): recorded on cdkc-18e.14 (T8 release-readiness) for evaluation before publication - the KMS error messages say \"a customer-managed key the function role can read\" but Lambda reads/decrypts the artifact with the Lambda service principal, so the KMS key policy must allow that principal kms:Decrypt. No production code changed in T6a.\n\nValidation evidence: uv run mkdocs build --strict --clean succeeded (only the intentional INFO that docs/designs/lambda-web-functions-integration.md is not in nav); dotnet build LayeredCraft.Cdk.Constructs.slnx -c Release = 0 warnings / 0 errors; full 4-TFM suite = total 2140, failed 0, skipped 0; relative links and anchors verified (web-function.md headings caching-and-header-guidance, grant-behavior-reference, signing-requests, resource-replacement-and-update-behavior, public-testing-helpers all exist; mkdocs nav has \"Web Function\" and \"Web Function Workloads\"); git status --porcelain test/LayeredCraft.Cdk.Constructs.Tests/GoldenTemplates/ is empty, so all 17 existing-construct goldens remain byte-identical.\n\nStatus: bead reopened and set in_progress; T6a docs are NOT committed pending maintainer acceptance.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":2,"issue_type":"task","assignee":"Nick Cipollina","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:54Z","created_by":"Nick Cipollina","updated_at":"2026-10-23T17:06:12Z","started_at":"2026-10-23T16:32:30Z","closed_at":"2026-10-23T17:06:12Z","close_reason":"T6a documentation corrections complete (independent-review findings 1-9 resolved): grant direction fixed; code-bucket ownership guidance corrected (service-principal read, SourceAccount+SourceArn, cross-stack Automatic only when account/Region resolvable, artifact-must-exist warning); wildcard-condition responsibility documented; ExternallyManaged/account-principal and imported-endpoint rules corrected; added Grant Behavior Reference, Signing Requests, and Resource Replacement and Update Behavior sections; required namespaces added and representative examples compiled green against the library in an isolated consumer project; MaxConcurrencyPerEnvironment, jsii System.Exception, and env-agnostic same-stack wording corrected; operational items fixed (supplied-role log-write, Create-\u003eServiceDefault log-group deletion, OAC naming scope, literal distribution ARN cross-stack, linux-arm64 as tested target, 10s listen deadline, Sharedale references removed, Blazor CloudFront example completed); KMS message issue recorded on cdkc-18e.14. Validation: mkdocs --strict green, Release build 0/0, full 4-TFM suite 2140 pass, links/anchors verified, 17 goldens byte-identical. NOT committed pending maintainer acceptance.","external_ref":"gh-98","labels":["docs","lambda-web-functions","t6"],"dependencies":[{"issue_id":"cdkc-18e.9","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:54Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.9","depends_on_id":"cdkc-18e.6","type":"blocks","created_at":"2026-10-23T01:15:16Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":2,"comment_count":0} -{"_type":"issue","id":"cdkc-18e.7","title":"T4a (optional): Spike narrow warning for managed AllViewer policy on Web Function origins","description":"OPTIONAL, time-boxed (≤ 4 hours). The feature must not depend on the outcome. Design §11.1 (\"Removed in revision 2\" paragraph), §18 item 4, §19 T4a.\n\nQuestion: can a narrow, warning-only check detect a Distribution behavior that targets a WebFunctionOrigin with the MANAGED AllViewer origin request policy\n(id 216adef6-5c7f-47e4-b989-5492eafa07d3) using only public CDK APIs on objects the library already holds (e.g. the BehaviorOptions/Origin object identity), WITHOUT resolving\nCloudFormation templates, tokens, or CfnDistribution.DistributionConfig?\n\nRules: disposable spike code first (scratch or a throwaway test); no template-resolution machinery; zero false positives; emits Annotations warning only (never an error).\nOutcome A (feasible and simple): implement it within WebFunctionOrigin with tests (warning present for AllViewer; absent for ALL_VIEWER_EXCEPT_HOST_HEADER and custom policies).\nOutcome B (not feasible): record findings in notes and close as \"won't implement\"; documentation (cdkc docs bead) already covers the Host-header rule.\nExclusions: Lambda@Edge detection, opt-in Region detection, any IValidation that resolves templates.\n","acceptance_criteria":"- Findings recorded in notes with the exact approach tried and the decision (A or B).\n- If A: warning-only check, tests prove no false positives, golden templates unchanged, validation gates pass.\n- If B: no production code changes remain.","notes":"T4a spike (2026-10-25): Decision = Outcome B (will not implement). Question: can a narrow warning-only check detect a Distribution behavior that targets a WebFunctionOrigin using the MANAGED AllViewer origin request policy (216adef6-5c7f-47e4-b989-5492eafa07d3), using only public CDK APIs on objects the library already holds. Finding: the library holds only the IOrigin and, in Bind, receives IOriginBindOptions; in Amazon.CDK.Lib 2.274.0 IOriginBindOptions exposes only DistributionId and OriginId (verified in the package XML docs). The behavior origin request policy is not reachable without resolving the distribution config or CfnDistribution, both excluded by the spike rules. No zero-false-positive public-API signal exists, so implementing would violate the spike constraints. Docs already cover the rule (docs/constructs/web-function.md Known Limitations: use ALL_VIEWER_EXCEPT_HOST_HEADER, never ALL_VIEWER; design section 11.3). No production code changes. Closing as wont-implement.","spec_id":"docs/designs/lambda-web-functions-integration.md","status":"closed","priority":4,"issue_type":"spike","owner":"ncipollina@gmail.com","created_at":"2026-10-23T01:14:52Z","created_by":"Nick Cipollina","updated_at":"2026-10-25T18:19:49Z","closed_at":"2026-10-25T18:19:49Z","close_reason":"Outcome B: not feasible with public CDK APIs without template resolution (IOriginBindOptions exposes only DistributionId and OriginId); docs already cover the Host-header rule; no production code changes.","external_ref":"gh-98","labels":["lambda-web-functions","optional","t4a"],"dependencies":[{"issue_id":"cdkc-18e.7","depends_on_id":"cdkc-18e","type":"parent-child","created_at":"2026-10-23T01:14:52Z","created_by":"Nick Cipollina","metadata":"{}"},{"issue_id":"cdkc-18e.7","depends_on_id":"cdkc-18e.6","type":"blocks","created_at":"2026-10-23T01:15:14Z","created_by":"Nick Cipollina","metadata":"{}"}],"dependency_count":1,"dependent_count":0,"comment_count":0} diff --git a/CLAUDE.md b/CLAUDE.md index 5352a9f..9b7afa2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -282,4 +282,36 @@ var stack = CdkTestHelper.CreateTestStackMinimal("stack-name" - Methods use `BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic` to access internal constructors - This follows standard testing library patterns for accessing non-public members - CDK's default pattern is internal constructors, so this support is essential for real-world testing -- The reflection approach ensures compatibility with any custom stack implementation \ No newline at end of file +- The reflection approach ensures compatibility with any custom stack implementation +## Issue Tracking (Beads) + +This repository tracks execution state in [Beads](https://github.com/steveyegge/beads) (`bd`, prefix `cdkc`). GitHub issues hold scope and acceptance criteria; Beads hold claims, subtasks, dependencies, gates, notes and evidence. + +**Storage and synchronization (owner decision, 2026-11-24).** Beads records live in an embedded Dolt database (`.beads/embeddeddolt/`, `dolt_database: cdkc`) and are synchronized through Dolt refs in this GitHub repository, the same model as the owner's Jedi Duel repository: + +- `refs/dolt/data` holds the Dolt database history, outside normal branches. +- `__dolt_remote_info__` is a Beads-managed branch recording Dolt remote metadata. + +Both are required for synchronization. Do not delete, rename, force-update or merge them, and do not open PRs from `__dolt_remote_info__`. + +- Synchronize with `bd dolt pull` before writing and `bd dolt push` after writing. Never `bd dolt push --force`, and never resolve conflicts with `--strategy ours|theirs`, without the owner's approval. +- `.beads/issues.jsonl` is **not** tracked: JSONL exports are local interchange files only (ignored by `.beads/.gitignore`). Never commit a Beads export in a PR. +- Committed Beads files: `.beads/.gitignore`, `.beads/README.md`, `.beads/config.yaml`, `.beads/metadata.json`. The database, backups, locks and runtime state are local. +- Bead text syncs to GitHub: never put secrets, credentials or personal data in titles, descriptions or notes. + +**Fresh clone or new machine:** + +```bash +git clone git@github.com:LayeredCraft/cdk-constructs.git && cd cdk-constructs +cat .beads/metadata.json # must show "dolt_database": "cdkc"; otherwise stop +git ls-remote origin 'refs/dolt/*' # must show refs/dolt/data +chmod 700 .beads +git config beads.role maintainer +bd bootstrap --dry-run # expect "Bootstrap plan: clone from remote", Database: cdkc +bd bootstrap --yes +bd list --all # compare with another working copy +``` + +Never run `bd init` in a clone of this repository. Linked Git worktrees share the primary checkout's database. + +**Agents.** The orchestrating agent is the only Beads actor. Delegated implementation workers never create, modify or synchronize Beads and never edit `.beads/`.