Skip to content

feat(cognito): accept an explicit hosted zone for custom domains - #99

Merged
ncipollina merged 2 commits into
mainfrom
feat/cognito-domain-hosted-zone
Oct 13, 2026
Merged

ncipollina merged 2 commits into
mainfrom
feat/cognito-domain-hosted-zone

Conversation

@ncipollina

Copy link
Copy Markdown
Contributor

Summary

CognitoUserPoolConstruct resolved a custom domain's hosted zone with HostedZone.FromLookup, a synth-time context lookup that needs AWS credentials or a cached cdk.context.json value. Consumers that already know their zone (Sharedale builds it with HostedZone.FromHostedZoneAttributes) could not synthesize without AWS access, which blocks credential-free PR CI (sharedale/sharedale#69: PR jobs synthesize untrusted code with no AWS credentials).

  • New optional ICognitoUserPoolDomainProps.HostedZone / CognitoUserPoolDomainProps.HostedZone (IHostedZone?). When supplied, it is used for certificate DNS validation and the alias record, and no context lookup is performed.
  • Backward compatible: when null (the default), behavior is unchanged: the lookup still happens. The interface member uses a default implementation (=> null), so existing custom implementations of ICognitoUserPoolDomainProps keep compiling.
  • Docs: docs/constructs/cognito-user-pool.md documents HostedZone (and the previously undocumented Certificate) and an offline-synthesis example.

StaticSiteConstruct has the same unconditional HostedZone.FromLookup; it is not changed here (Sharedale does not use it). It could get the same option in a follow-up.

TDD evidence

  • Construct_ShouldUseSuppliedHostedZone_WithoutContextLookup_WhenCustomDomainHasHostedZone: asserts the cloud assembly has no missing context and the AWS::Route53::RecordSet targets the supplied zone ID.
    • Red (property added as an unused shell): Expected app.Synth().Manifest.Missing to be null or empty, but found at least one item.
    • Green after using props.Domain.HostedZone ?? HostedZone.FromLookup(...).
  • Construct_ShouldLookUpHostedZone_WhenCustomDomainHasNoHostedZone: characterization of the unchanged default (one missing hosted-zone: context entry); passed before and after.

Validation

  • dotnet build LayeredCraft.Cdk.Constructs.slnx: 0 warnings, 0 errors.
  • dotnet test --solution LayeredCraft.Cdk.Constructs.slnx: 676/676 passed (169 × net8.0, net9.0, net10.0, net11.0).
  • dotnet format --verify-no-changes on the changed C# files: clean. Note: the repository-wide dotnet format --verify-no-changes already fails on main (whitespace in TestKit/Customizations/LambdaFunctionConstructCustomization.cs and StaticSiteConstructCustomization.cs); those files are untouched here.

🤖 Generated with Claude Code

CognitoUserPoolConstruct always found the custom-domain hosted zone with
HostedZone.FromLookup, a synth-time context lookup that requires AWS
credentials (or a cached cdk.context.json value). Consumers that already
know the zone could not synthesize offline, for example in credential-free
pull request CI.

Add an optional CognitoUserPoolDomainProps.HostedZone. When supplied it is
used for certificate DNS validation and the alias record, and no lookup is
performed; when null the existing lookup is unchanged. The interface member
has a default implementation so existing implementers keep compiling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T23:37:47.549244Z 6cfae20 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ncipollina
ncipollina merged commit 15b7efe into main Oct 13, 2026
9 checks passed
@ncipollina
ncipollina deleted the feat/cognito-domain-hosted-zone branch October 13, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant