Skip to content

fix(aws): examples pass their own post-synth checks, and CI gates on it (#1400) - #1807

Merged
lex00 merged 1 commit into
mainfrom
fix/1400-aws-examples-post-synth
Aug 23, 2026
Merged

lex00 merged 1 commit into
mainfrom
fix/1400-aws-examples-post-synth

Conversation

@lex00

@lex00 lex00 commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Three aws examples failed their own lexicon's post-synth checks at error severity, and nothing in CI noticed because the tier-1 "Every shipped example builds" check stops at serialization.

The three examples

  • lambda-api: adds src/data-bucket-policy.ts, an AWS::S3::BucketPolicy that denies aws:SecureTransport = false on the data bucket (WAW042). 10 resources becomes 11.
  • lambda-s3: adds src/bucket-policy.ts attaching the same policy to the bucket the LambdaS3 composite owns. 3 resources becomes 4.
  • shared-alb: both ECR repositories set ImageTagMutability: "IMMUTABLE" (WAW054). Count unchanged at 24.

READMEs, the lexicon examples.mdx page (source and generated copy), and examples.test.ts move with the counts. lambda-s3 had no resourceCount assertion before; it has one now, and lambda-api's resource list names the new policy. The okf snapshot for lambda-s3 picks up the new resource.

The gate

checkExamplesBuild (behind chant dev check-lexicon and scripts/check-lexicons.ts in CI) now runs each loaded plugin's postSynthChecks() against that plugin's output after a structurally clean build, with the same per-plugin scoping and lint.rules severity resolution chant build uses, and fails the example on any diagnostic left at error. Warnings do not fail it, and project lint.policies are not run. The check is renamed "Every shipped example builds and passes its own post-synth checks"; the completeness-checklist doc and the existing test follow. Two new tests cover a bare bucket failing (WAW018/WAW042) and an example's own lint.rules demoting a check.

What else the gate caught

Running it across every lexicon found three more examples failing:

  • gcp/cloud-function: WGC402, CloudFunctionsFunction missing the required projectRef. Added projectRef: { external: GCP.ProjectId }, matching cloud-run.
  • github/docs-snippets: GHA011, the NodePipeline test job declares needs: ["build"] but the snippet exported the build job as nodeBuild, so the serialized job was node-build. Exported as build/test.
  • aws/core-concepts and aws/docs-snippets: 19 single-resource teaching buckets with no bucket policy (WAW042) and one DBCluster serialization example without backups (WAW039). These are doc snippet collections, not deployable stacks, and already skip lint and build in examples.test.ts. Their chant.config.ts now demotes those checks to warning with a comment saying why, so the gate reads them the way chant build would for a user with that config. The findings stay visible.

npx tsx scripts/check-lexicons.ts is green across all lexicons with the gate on.

Verification

  • npx vitest run lexicons/aws/examples/examples.test.ts lexicons/gcp/examples lexicons/github/examples packages/core/src/okf.test.ts packages/core/src/cli/commands/check-lexicon examples/fold-differential.test.ts: 241 passed
  • npm run build -w @intentius/chant-lexicon-aws: clean
  • npx tsc --noEmit -p packages/core/tsconfig.json and npx tsx scripts/typecheck.ts: no regressions
  • chant lint on lambda-api, lambda-s3, gcp/cloud-function: no problems

Closes #1400

@lex00
lex00 merged commit b8a8b75 into main Aug 23, 2026
6 checks passed
@lex00
lex00 deleted the fix/1400-aws-examples-post-synth branch August 23, 2026 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Three aws examples fail their own lexicon's post-synth checks

1 participant