Skip to content

aws generates from an unpinned upstream spec URL #1390

Closed

Description

@lex00

aws generates from an unpinned upstream URL, so any prepack can fold an upstream schema change into an unrelated branch.

What happens

const SCHEMA_ZIP_URL = "https://schema.cloudformation.us-east-1.amazonaws.com/CloudformationSchema.zip";

There is no version in the path, and AWS republishes the artifact constantly:

$ curl -sI .../CloudformationSchema.zip
Content-Length: 2829894
Last-Modified: Mon, 03 Aug 2026 01:29:20 GMT
ETag: "69f2a6b07432ca3df3ab360e31c020a5"

Last-Modified is today. So npm run --prefix lexicons/aws prepack — which CI runs on every build, and which any local docs or codegen task triggers — resolves to whatever CloudFormation shipped that morning.

This bit twice during the #1312 docs work: a docs-only branch picked up a resource-count move from 1659 to 1660 in the generated index.mdx "At a Glance" table, with nothing in the commit explaining it. I reverted it both times rather than let an unexplained upstream bump ride in an unrelated PR, but the next person may not notice, and the count is the visible symptom rather than the change itself — the same regeneration silently alters generated types and the resource registry.

Every other lexicon with an upstream schema either pins it (k8s, gcp, gitlab and docker each declare upstreamPin) or has no spec of its own (forgejo, helm, fountain). aws is the exception, and the largest surface.

Why upstreamPin does not fit

The contract's upstreamPin resolves a version constant against GitHub releases or tags. The CloudFormation schema is neither: it is a single "latest" artifact on an S3-backed host with no version handle at all. Pinning by URL is not available.

Proposal — pin by content

Record a digest of the upstream schema set and fail generation when it moves, so accepting a new spec is an explicit, reviewable commit rather than a side effect.

Digest the extracted content, not the zip: a repackaged archive with identical schemas produces a different ETag and a different zip hash, which would fire on nothing. Sorted typeName → sha256(schema bytes), hashed in order, is stable against repackaging and changes exactly when a schema does.

Today's upstream:

resources = 1650          (raw typeNames in the archive)
digest    = sha256:a2d99e08c8b32a421b9e6e55f73fbdb2fa29e062e053ffdcd34de7138223b3b3

Generation compares against the committed pin and refuses on a mismatch, naming what moved and how to accept it. An explicit accept path prints the new pin to paste in — the same shape as the emulator freshness policy (#808): the tool reports, a human decides.

Done when

  • A committed pin records the accepted upstream content
  • prepack on an unrelated branch cannot silently regenerate against a newer spec
  • Accepting a new spec is one reviewable commit that says what changed
  • The mismatch message names the resource-count delta, not just "digest differs"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions