fix(conformance): write compliance/CACHE_VERSION marker to detect stale storyboard cache#1651
fix(conformance): write compliance/CACHE_VERSION marker to detect stale storyboard cache#1651
Conversation
…le storyboard cache compliance/cache/ is gitignored, so schema-sync.yml's diff guard was blind to compliance-only spec bumps (fixed idempotency_key strings, new storyboard YAMLs). The guard only watched src/lib/types/, src/lib/agents/, and package.json — causing stale storyboards to ship undetected when TypeScript types were unchanged. - sync-schemas.ts writes compliance/CACHE_VERSION (tracked in git, one level above the gitignored compliance/cache/) after every tarball sync, using adcp_version from the tarball's index.json - schema-sync.yml diff guard now includes compliance/CACHE_VERSION via git status --short so compliance-only spec bumps trigger an automated PR - ci.yml gains a post-sync validation step asserting compliance/CACHE_VERSION matches ADCP_VERSION, catching version drift before it reaches npm Closes #1648 https://claude.ai/code/session_01JACGQ4QjAH319KJNKjCwQy
…a-sync.yml - sync(): write compliance/CACHE_VERSION on the per-file fallback path so the ci.yml validation step doesn't hard-fail when the tarball endpoint is unavailable (pre-release builds, network failures). Marker uses adcpVersion (ADCP_VERSION pin); compliance storyboards are not actually synced on this path — the existing console.warn makes that clear. - schema-sync.yml: remove dead `|| cat ADCP_VERSION` fallback. Piping through `tr -d '[:space:]'` exits 0 on empty input so the || never fired; since sync-schemas now always writes the marker file (both tarball and per-file paths), the unconditional read is safe. https://claude.ai/code/session_01JACGQ4QjAH319KJNKjCwQy
|
Closing — source issue #1648 was a misdiagnose (npx cache pointed at a stale install at a different path), so the hazard this guards against hasn't materialized. The existing |
|
Acknowledged — makes sense. The Generated by Claude Code |
|
Understood — closing the loop here. #1655's Triaged by Claude Code. Session: https://claude.ai/code/session_01CR6y6uzgoLTEt4L7RF1cit Generated by Claude Code |
Closes #1648
Summary
compliance/cache/is gitignored (populated at sync/publish time), soschema-sync.yml's diff guard was blind to compliance-only spec bumps — new storyboard YAMLs, fixedidempotency_keystrings — any spec release that didn't also change TypeScript schemas would leave stale storyboards in the published npm artifact. This caused the silent mismatch the issue describes:--versionreportsAdCP 3.0.8whilecompliance/cache/still contains3.0.6storyboards, producing false-positive and false-negative results in buyer-side storyboard validation.Root cause is two-part:
schema-sync.ymlwatched onlysrc/lib/types/,src/lib/agents/, andpackage.json— invisible to compliance-only spec changes.The fix avoids removing
compliance/cache/from.gitignore(which would add large YAML bulk to git history). Instead,sync-schemas.tswrites a tiny tracked marker filecompliance/CACHE_VERSION(one level above the gitignoredcompliance/cache/) that CI can diff against.Changes:
scripts/sync-schemas.ts: writescompliance/CACHE_VERSIONafter every tarball sync, usingadcp_versionfrom the tarball'sindex.json. The per-file fallback path (tarball endpoint 404) also writes the marker using theADCP_VERSIONpin — compliance storyboards aren't actually synced on that path, but the marker prevents a hard CI failure..github/workflows/schema-sync.yml: diff guard now includescompliance/CACHE_VERSIONviagit status --short(detects both new/untracked and modified marker files). Version capture moved before the diff check so PR titles are correct for compliance-only bumps too..github/workflows/ci.yml: post-sync validation step assertscompliance/CACHE_VERSIONmatchesADCP_VERSION, catching version drift before any PR can merge.Known limitation: The per-file fallback path writes the marker with the
ADCP_VERSIONpin rather than the tarball's embeddedadcp_version, since no tarball is available. This reflects intent (the pin) rather than actual cached content — the pre-existingconsole.warndocuments that compliance storyboards are not synced on this path. The asymmetry is safe for semver pins but would produce a mismatch ifADCP_VERSIONwere ever set to"latest"(pre-existing concern, not introduced here).What tested
npm run format:check: ✅ passesCannot find type definition file for 'node', deprecatedmoduleResolution) verified to exist onmainbefore this branch — not introduced heregit diff HEAD~2 HEAD: reviewed manually; all imports already present insync-schemas.ts;path.dirname(COMPLIANCE_CACHE_DIR)resolves tocompliance/(confirmed by reviewers);compliance/guaranteed byreplaceTree'smkdirSyncbefore the marker writeNits from pre-PR review (not fixed)
ci.ymllines 39/45:cat FILE | tr -dis useless-use-of-cat;tr -d '[:space:]' < FILEis idiomatic — no correctness impactschema-sync.ymlline 58:2>/dev/nullsuppresses stderr ongit status; if git exits non-zero for any reason the compliance bump is silently missed — ci.yml's hard check is the safety net, so no release-safety gap, but the failure mode is invisiblesync-schemas.tstarball path (~line 388): a// compliance/ guaranteed by replaceTree abovecomment would clarify whymkdirSyncis absent there but present in the per-file fallback pathPre-PR review
|| cat ADCP_VERSIONfallback inschema-sync.yml(pipe throughtrexits 0 on empty input, silently producing empty string). Fixed in second commit.sync()— the blocker was thatsyncSchemasPerFilepath never wrote the marker, which would have causedci.ymlto hard-fail with "not found". Fixed in second commit.Session: https://claude.ai/code/session_01JACGQ4QjAH319KJNKjCwQy