Skip to content

aws-sam: two YAML-based checks (handler-path, cloudfront-authorization) via a minimal YAML parser - #137

Merged
missingbulb merged 2 commits into
mainfrom
claude/claudanite-instructions-tests-15kcku
Jul 6, 2026
Merged

aws-sam: two YAML-based checks (handler-path, cloudfront-authorization) via a minimal YAML parser#137
missingbulb merged 2 commits into
mainfrom
claude/claudanite-instructions-tests-15kcku

Conversation

@missingbulb

Copy link
Copy Markdown
Owner

Follow-up to the prose-to-checks pass (#131). The first pass rejected two aws-sam gotchas as false-positive-prone because a text-grep can't tell template structure. This adds a small dependency-free YAML-subset parser and converts both, FP-free.

What's here

  • checks/lib/yaml.mjs — a minimal YAML-subset parser (nested block maps, block + flow sequences, scalars, CloudFormation !Tags kept as their value). Deliberately not a general parser (no anchors, block scalars, or flow maps) and never throws. 9 tests.
  • checks/lib/cfn.mjs — parses the repo's SAM templates into resources.
  • aws-sam/handler-path (blocking) — under BuildMethod: esbuild with a single subdirectory entry point and no OutBase, the Handler must drop the subdir. FP fixes (from the adversarial pass): skips when OutBase is set or there are multiple entry points.
  • aws-sam/cloudfront-authorization (blocking) — a custom AWS::CloudFront::OriginRequestPolicy may not list Authorization (AWS rejects it at deploy). FP fix: scoped to the policy's own headers, so Authorization in an API Gateway authorizer elsewhere is not flagged.

Each check has fixtures that include the exact false-positive cases the first pass got caught on — proving the narrowing works. The third rejected candidate (chrome SetIcon({path})) is JS, not YAML, so it stays backlogged.

aws-sam pack now has 3 checks; corpus catalog 22 → 24. 64 tests, sweep clean.

Closes #136

🤖 Generated with Claude Code

https://claude.ai/code/session_015vFRrv67zrVJkQ4UTVxWr5


Generated by Claude Code

claude added 2 commits July 6, 2026 17:02
…hecks

Enough to query SAM/CloudFormation template structure (nested block maps,
block + flow sequences, scalars, CloudFormation !Tags kept as their value);
deliberately not a general parser (no anchors, block scalars, or flow maps)
and never throws. 9 tests including the SAM function and CloudFront
OriginRequestPolicy structures the two checks need.

Refs #136

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vFRrv67zrVJkQ4UTVxWr5
…ation

Convert the two SAM gotchas the first prose-to-checks pass rejected as
FP-prone, now made false-positive-free by navigating template structure
via the minimal YAML parser:
- handler-path: under BuildMethod esbuild with a single subdir entry and
  no OutBase, the Handler must drop the subdir. Skips the OutBase and
  multi-entry cases the adversarial pass flagged.
- cloudfront-authorization: a custom OriginRequestPolicy may not list
  Authorization. Scoped to the policy's own headers, so Authorization in
  an API Gateway authorizer elsewhere is not flagged.
Both blocking, each with fixtures including the adversarial FP cases.
aws-sam pack now has 3 checks; catalog 22 -> 24.

Closes #136

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015vFRrv67zrVJkQ4UTVxWr5
@missingbulb
missingbulb merged commit 5a573bb into main Jul 6, 2026
1 check passed
@missingbulb
missingbulb deleted the claude/claudanite-instructions-tests-15kcku branch July 6, 2026 20:52
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.

aws-sam: convert the two YAML-based gotchas into FP-free checks (minimal YAML parser)

2 participants