Skip to content

fix(azure): pin the resource-manager-schemas source — codegen stops drifting with upstream main (#1144) - #1145

Merged
lex00 merged 1 commit into
mainfrom
fix/1144-azure-schema-pin
Jul 27, 2026
Merged

lex00 merged 1 commit into
mainfrom
fix/1144-azure-schema-pin

Conversation

@lex00

@lex00 lex00 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • lexicons/azure/src/spec/fetch.ts fetched refs/heads/main.tar.gz of Azure/azure-resource-manager-schemas unpinned. A cold ~/.chant cache regenerated against whatever upstream state currently existed; a warm cache kept serving whatever was current when it was last filled — nondeterministic per-runner CI failures depending on cache warmth (bit PR fix(cli): --flag=value works everywhere, unknown flags error — nothing silently drops (#1127) #1141's first run while main passed the same hour on a warm cache).
  • Pins the fetch to a commit SHA (AZURE_SCHEMA_COMMIT, current upstream main HEAD at the time of this PR: 0085cb6f3a98e735359807143bcb1667aeec930f), following the fly emulator-pin precedent (fly: single-source the mudflaps/spritzer emulator image pins #814). The constant's docstring records the bump procedure and notes epic: scheduled lexicon spec upgrades (auto-PR from latest upstream specs) #523's rolling-spec-drift sub-issue (feat(codegen): rolling-spec drift pipeline (aws, azure, github) #526) is meant to eventually propose bumps here automatically.
  • The cache filename now embeds the pin (azure-resource-manager-schemas-<sha>.tar.gz) so a stale tarball from before a bump can never mask the bump — a GitHub Actions cache restore-keys partial-key fallback, or a developer's pre-existing ~/.chant, simply misses the new filename and re-downloads instead of silently serving pre-bump schemas.
  • At the pinned commit, Microsoft.Compute's naive "latest date wins" schema selection (latestVersionPerProvider) picks a disk-only delta file (2026-03-02) that drops virtualMachines, virtualMachineScaleSets, and availabilitySets entirely — Azure alternates a "VM flavor" and a "disk flavor" snapshot of this file across dates rather than publishing one cumulative file, so this isn't a rename, it's an omission. Extends PROVIDER_VERSION_OVERRIDES (previously only Microsoft.Authorization, bug(azure): lexicon no longer generates Microsoft.Authorization/roleAssignments — breaks k8s-aks-microservice #223) with a Microsoft.Compute: "2026-03-01" entry — the latest date that still has the VM family — which restores VirtualMachine/VirtualMachineScaleSet/AvailabilitySet generation under their original names. No composite source changes were needed as a result (composites/vm-linux.ts still imports VirtualMachine unchanged).
  • Updated api-versions.test.ts: the existing "picks the latest API version per provider" test used Microsoft.Compute as its no-override example, which now conflicts with the new override — swapped it for Microsoft.Network, and added a new test asserting the override itself picks 2026-03-01 over the naive 2026-03-02.

Other lexicons audited (per #1144, filing separately)

  • docker: COMPOSE_SPEC_URL in lexicons/docker/src/codegen/versions.ts fetches raw.githubusercontent.com/compose-spec/compose-spec/master/schema/compose-spec.json — the same unpinned-moving-git-ref shape as this bug (a live file off master, not a tagged release). ENGINE_API_URL in the same file is already pinned to a tag (v27.3.1) and is fine.
  • gcp (KCC_VERSION), k8s (K8S_SCHEMA_VERSION), gitlab (GITLAB_SCHEMA_VERSION): already pinned to tagged releases. Fine.
  • github (SchemaStore github-workflow.json), fly (docs.machines.dev/openapi.json), aws (CloudFormation's own published schema zip): all fetch a live "current" endpoint with no git ref/branch and no tag/release scheme to pin against — already classified as "rolling, nothing to bump" in epic: scheduled lexicon spec upgrades (auto-PR from latest upstream specs) #523, same as fly's own documented rationale. Not the same failure mode (no git-branch-tarball non-determinism), so not touched here.
  • helm, temporal, forgejo: no remote spec (per epic: scheduled lexicon spec upgrades (auto-PR from latest upstream specs) #523). N/A.

CI cache-key check

.github/workflows/chant.yml's "Cache lexicon schemas" step keys on hashFiles('lexicons/*/src/**/fetch.ts', 'lexicons/*/src/**/versions.ts'). The pin constant lives directly in lexicons/azure/src/spec/fetch.ts, which matches that glob, so bumping AZURE_SCHEMA_COMMIT changes the file's content hash and rotates the cache key automatically — no workflow change needed. Verified this is the actual key derivation (not assumed).

Test plan

All run against a cold cache (a temp HOME override, ~/.chant on the actual machine untouched):

  • npm run generate -w @intentius/chant-lexicon-azure clean from a truly empty cache — cache file lands as azure-resource-manager-schemas-0085cb6f3a98e735359807143bcb1667aeec930f.tar.gz
  • npm run build -w @intentius/chant-lexicon-azure clean (~27s, not the historical 17-minute regression territory)
  • npm run validate -w @intentius/chant-lexicon-azure — all checks OK including required-names (VirtualMachine/VirtualMachineScaleSet/AvailabilitySet present)
  • just build / just lint / just test all green (771 test files, 8996 tests passed, 5 skipped)
  • just check-lexicons — azure 17/17, no regression (github's pre-existing 15/17 known-tracked failures, bug(github): 'expression' intrinsic is registered but never exported from src/index.ts #1069, untouched)
  • examples/fold-differential.test.ts (part of just test) — drift: 0, unchanged from baseline

…rifting with upstream main (#1144)

The ARM schema fetch pulled refs/heads/main.tar.gz unpinned, so a cold
~/.chant cache regenerated against whatever upstream state currently
existed while a warm cache kept serving the old one — nondeterministic
per-runner CI failures (bit PR #1141). Pin to a commit SHA instead,
following the fly (#814) single-source-pin precedent, and name the cache
file after the pin so a stale cached tarball can never mask a bump.

At the pinned commit, Microsoft.Compute's naive "latest date wins" schema
selection picks a disk-only delta file that drops virtualMachines,
virtualMachineScaleSets, and availabilitySets entirely (Azure alternates
"VM flavor" and "disk flavor" snapshots of this file rather than
publishing one cumulative one). Extend PROVIDER_VERSION_OVERRIDES
(previously just Microsoft.Authorization, #223) to pin Microsoft.Compute
to the last date that still has the VM family, restoring the composites'
and validate.ts's expected exports without touching any composite source.
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.

1 participant