Repository navigation
Conversation
…hedule Nothing ran sync:atlas-contract, sync:translations or types:cms until a human remembered to. A daily contract-drift workflow (also by hand) now runs `pnpm check:contracts`, which diffs the four committed copies against upstream without writing anything and prints one row per contract. Drift fails that run and opens or updates one `contract-drift` issue, filed as the bot like production-smoke. It is never a PR check, so an unrelated upstream merge cannot turn a PR red. - sync-translations exits 2, not 1, when production cannot be read, so the checker can tell drift from a fault. - strip-payload-augmentation takes an optional file, to normalise a temp copy. - The translations check is reported as skipped, visibly, when neither ATLAS_API_KEY nor VITE_SAHAJCLOUD_API_KEY exists as a secret. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
sahajatlas-design | 4b92d31 | Nov 16 2026, 11:10 PM |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The lane is well built. The question is its size: of the four contracts it watches, two already have an owner in claude-workflow's contractSync, and a third is one data edit from that same mechanism. Only translations.en.json is CMS data that produces no commit upstream, so only it needs a clock at all. The body names the overlap and calls the rest a backstop for a missed dispatcher event — an event nobody has counted. The exit-code contract (0 / 1 / 2) is consistent end to end across all three scripts, and the lane is correctly kept out of ci.yml.
Findings
should-fix— scope: three of four rows are covered or coverable bycontractSync; only translations needs a schedule (contract-drift.yml:15).should-fix— the YAML key fallback bypassesresolveKey's production-origin guard (contract-drift.yml:43).should-fix— the spec shadowsreadRepoSourceto dodge a pinned ceilingdocs/testing.mdsays to ratchet (check-contract-drift.test.ts:9).consider—tail()returns the head, and drops the stderr lines that explain a failure (check-contract-drift.mjs:73).consider—parseCmsTypeSourcesregex-parses a shell one-liner (check-contract-drift.mjs:41).
What was checked
Read whole on the branch: check-contract-drift.mjs, check-contract-drift.test.ts, contract-drift.yml, sync-translations.mjs and sync-atlas-contract.mjs. Ladder walked on each new piece: parseCmsTypeSources, exitCodeFor, renderReport, tail, the workflow. Consumer side followed into claude-workflow/loop-config.json contractSync and into production-smoke.yml, whose issue-filing step this one mirrors faithfully. Action versions match the other three workflows. sync-atlas-contract.mjs already exits 2 on an unreachable upstream, so its new header is accurate.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`ATLAS_API_KEY: ${{ secrets.ATLAS_API_KEY || secrets.VITE_SAHAJCLOUD_API_KEY }}`
promoted the fallback into the name `resolveKey` returns at its first line, so
the guard that accepts `VITE_SAHAJCLOUD_API_KEY` only when `VITE_SAHAJCLOUD_URL`
is production never ran. A key minted against another CMS would have been sent to
`cloud.sydevelopers.com`, which is what gets one rotated in a hurry.
Each secret now arrives under its own name and `sync-translations.mjs` decides.
`skipped` therefore needs both to be the empty string. `ci-workflows.test.ts`
would own the assertion, but the YAML block it belongs beside is still here.
Verified locally: with the fallback key and `.env`'s production origin the
translations row reaches production and reports its refusal; with the origin
pointed at localhost the guard refuses the key instead.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVz9eEn2pQR44udu67
`tail` returned `all.slice(0, lines)` — the head. For `diff -u` that was the right content under the wrong name. For a sync script that exited 2 it also cut the end of stderr, which is where the reason for the failure is, so every error row in the drift issue could lose the one line a reader needs. Two named helpers now, picked by status. The spec was watched failing against the old single trim before this landed. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVz9eEn2pQR44udu67
`parseCmsTypeSources` read the upstream URLs out of the `types:cms` shell one-liner by regex, so it held only while the token order stayed `curl <one flag> -o <path> <url>`. Reorder those flags and it returns nothing: error, exit 2, a red drift lane and no issue filed — a failure mode the lane exists to prevent, reached by editing an unrelated command. `scripts/fetch-cms-types.mjs` now holds the path/URL pairs and does the download, and `types:cms` runs it. The drift check imports the same constant, so the two cannot address different files. `fetch-openapi.mjs` is the precedent for a fetch that is a script rather than a command line. Verified: `pnpm types:cms` reproduces both committed copies byte for byte, and a deliberate edit to `response-types.ts` still reports DRIFT and exits 1. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVz9eEn2pQR44udu67
`check-contract-drift.test.ts` shadowed `readRepoSource` with its own `readFileSync(resolve(__dirname, '..', path))` to keep off the dependent count `select-unit-specs.test.ts` ratchets. That is a third spelling of one read, two files from `ci-workflows.test.ts`, which #289 and #302 exist to prevent — and `docs/testing.md` names the answer when the ceiling has no headroom: time the hook and ratchet, never dodge it. So the spec uses the real helper, and the ceiling goes 22 → 23. Timed first, medians of three on 4 cores: 5.0s for the widest edit and 6.0s for `src/config/i18n.ts`, against a 12-second budget. The workflow-YAML assertions move to `ci-workflows.test.ts`, which already owns that kind and reads through the helper, leaving this spec on the script alone. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVz9eEn2pQR44udu67
The generated-types rule told a reader to add a curl line inside the `types:cms` command. That command is one script call now, and a download added anywhere but `CMS_TYPE_SOURCES` is fetched without the drift check watching it. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjVz9eEn2pQR44udu67
|
Four built, one rebutted, on
Docs: 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Closing in favour of a single sync mechanism: the review loop's |
Summary
.github/workflows/contract-drift.yml(daily cron plusworkflow_dispatch). It runs the newpnpm check:contracts(scripts/check-contract-drift.mjs), which diffs the four committed SahajCloud copies against upstream without writing to the tree, and prints one row per contract with its re-sync command (also in the step summary).src/lib/shape/atlas-url-contract.json:sync-atlas-contract.mjsin its existing check mode (public raw file).src/config/translations.en.json:sync-translations.mjsin its existing check mode (production API, needs a key).src/types/payload/payload-types.tsandresponse-types.ts: whatpnpm types:cmswould write, fetched to a temp dir and diffed. The path/URL pairs live in the newscripts/fetch-cms-types.mjs, whichtypes:cmsruns and the checker imports, so the two cannot address different files.contract-driftissue, filed withSYDEVS_BOT_PATlikeproduction-smoke.yml; later red runs comment, nothing auto-closes it. It is not a PR check and not inci.yml, so an unrelated upstream merge cannot turn a PR red. Nothing is committed.sync-translations.mjsnow exits 2 (not 1) when production cannot be read, so drift (1) and a fault (2) are distinguishable.strip-payload-augmentation.mjstakes an optional file argument. The header ofsync-atlas-contract.mjsanddocs/testing.md,docs/environment.md,AGENTS.mdno longer say nothing runs these.types:openapi.openapi.jsonis gitignored, so there is no committed copy to drift (and it needs a separate Basic-auth secret).Secrets
The lane passes
ATLAS_API_KEYandVITE_SAHAJCLOUD_API_KEYunder their own names, andresolveKeyinsync-translations.mjspicks between them — so the fallback still has to pass that script's production-origin guard. With neither secret present the row showsskipped(visible, not green-as-read).ATLAS_API_KEY(a productionsahaj-atlas-clientkey) does not exist yet. The fallback key is still unverified against the translations global.Test results
lint,typecheck,test:run): 171 files, 2091 tests./security-reviewover the branch diff: no findings.payload-types.ts,response-types.tsand the contract JSON each reported DRIFT (exit 1), then reverted.pnpm types:cmsreproduces both committed copies byte for byte through the new fetcher..env's production origin it reaches production and reports the refusal as anERRORrow; with the origin pointed at localhost the guard refuses the key instead of sending it. Whether the realVITE_SAHAJCLOUD_API_KEYreads the translations global is still what the first manual run will show.Notes for reviewer
Overlaps in part with
contractSyncin claude-workflow, which re-runstypes:cmson a producer merge. This is the backstop for the cases that does not cover:atlas-url-contract.json, whichcontractSyncdoes not list for this repo at all;translations.en.json, which is CMS data with no producer commit; and the two missesaudit-contractsitself names — a push straight tomain, or a sync PR closed unmerged.contractSyncopens a PR; nothing verifies that PR landed.The per-edit selection ceiling in
scripts/select-unit-specs.test.tsratchets 22 → 23 forcheck-contract-drift.test.ts'sreadRepoSourceread. Timed first: 5.0s widest, 6.0si18n.ts, medians of three on 4 cores, against a 12s budget.🤖 Generated with Claude Code