Repository navigation
fix(aws): examples pass their own post-synth checks, and CI gates on it (#1400) - #1807
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: addssrc/data-bucket-policy.ts, anAWS::S3::BucketPolicythat deniesaws:SecureTransport = falseon the data bucket (WAW042). 10 resources becomes 11.lambda-s3: addssrc/bucket-policy.tsattaching the same policy to the bucket theLambdaS3composite owns. 3 resources becomes 4.shared-alb: both ECR repositories setImageTagMutability: "IMMUTABLE"(WAW054). Count unchanged at 24.READMEs, the lexicon
examples.mdxpage (source and generated copy), andexamples.test.tsmove with the counts.lambda-s3had noresourceCountassertion before; it has one now, andlambda-api's resource list names the new policy. Theokfsnapshot for lambda-s3 picks up the new resource.The gate
checkExamplesBuild(behindchant dev check-lexiconandscripts/check-lexicons.tsin CI) now runs each loaded plugin'spostSynthChecks()against that plugin's output after a structurally clean build, with the same per-plugin scoping andlint.rulesseverity resolutionchant builduses, and fails the example on any diagnostic left aterror. Warnings do not fail it, and projectlint.policiesare 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 ownlint.rulesdemoting a check.What else the gate caught
Running it across every lexicon found three more examples failing:
gcp/cloud-function: WGC402,CloudFunctionsFunctionmissing the requiredprojectRef. AddedprojectRef: { external: GCP.ProjectId }, matchingcloud-run.github/docs-snippets: GHA011, theNodePipelinetest job declaresneeds: ["build"]but the snippet exported the build job asnodeBuild, so the serialized job wasnode-build. Exported asbuild/test.aws/core-conceptsandaws/docs-snippets: 19 single-resource teaching buckets with no bucket policy (WAW042) and oneDBClusterserialization example without backups (WAW039). These are doc snippet collections, not deployable stacks, and already skip lint and build inexamples.test.ts. Theirchant.config.tsnow demotes those checks towarningwith a comment saying why, so the gate reads them the waychant buildwould for a user with that config. The findings stay visible.npx tsx scripts/check-lexicons.tsis 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 passednpm run build -w @intentius/chant-lexicon-aws: cleannpx tsc --noEmit -p packages/core/tsconfig.jsonandnpx tsx scripts/typecheck.ts: no regressionschant linton lambda-api, lambda-s3, gcp/cloud-function: no problemsCloses #1400