Repository navigation
feat(ci): a shared contract check that fails only a PR's own change - #283
Conversation
A hand-typed key in WeMeditateWeb's generated types and English mirror (WeMeditateWeb#269) passed every check, because nothing compared a copy with its source. The proposed gate (WeMeditateWeb#310) compared every PR's copy with SahajCloud main, which reddens every open PR on each producer merge, fires fix-ci on each open bot PR, and fails the queue. WordPress's required URL-contract job already does that. .github/actions/contract-check is a composite action each consumer runs as a step in its required CI job. A PR that changes a contractSync copy must leave it exactly as the sync command writes it; a PR that leaves it alone passes. paths and command inputs cover a copy outside contractSync. A mismatch is re-checked twice for raw.githubusercontent caching; a failing command is marked ci.infraLabel. Co-Authored-By: Claude Opus 5.5 <[email protected]>
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The shape is right: a step inside each consumer's existing required job, scoped to what the PR changes, mirroring dependency-review.yml. The diff is no bigger than the problem.
One blocker. check.sh:38 measures the consumer's whole paths, not the copies this PR touched, so a PR that syncs one copy correctly still fails when a sibling copy has drifted on main. That is the WeMeditateWeb#310 failure this PR exists to remove, it contradicts the rule the body and README state, and it lands in shared CI for three repos. I reproduced it.
Findings
- blocker —
check.sh:38fails a PR for drift in a copy it never touched.-- $touched, not-- $paths. - consider —
check.sh:43spends 5 minutes re-checking where no remote source is read. - consider —
loop-config.json'scontractSync.$commentstill names onlyaudit-contracts/SKILL.md. These values now also drive required CI in three repos, and a maintainer editingpathsreads that comment, notAGENTS.md. No diff hunk to anchor it to.
What was checked
- Read
action.ymlandcheck.shwhole.github.action_path/../../../loop-config.jsonresolves to the repo root of a@mainaction checkout, and theBASE_SHAfallbacks matchci.yml's. - Ran
check.shfrom a scratch copy against throwaway repos: two paths, one synced and one drifted (fails — the blocker), the same with-- $touched(passes), and a deleted copy under that fix (still fails). - Ladder: no shared action exists to extend.
dispatcher/contracts.mjsalready resolvesconsumers[repo], but in node, which a PHP consumer's job has no reason to carry. Composite action over reusable workflow is argued in why.md. ci.infraLabelis used as an annotation title, asloop-config.jsondescribes.CLAUDE.mdis a symlink toAGENTS.md, so no second copy went stale.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The match check ran `git status --porcelain -- $paths`, the consumer's whole copy set, after the sync command had rewritten all of them. A PR that synced one copy correctly then failed because a sibling copy it never touched had drifted on `main` — the WeMeditateWeb#310 failure this action exists to remove, and the rule the body, README and why.md all state. SahajAtlasWeb has three copies, so it was the likely first casualty, and the file annotation would have named the one correct file. `-- $touched` is the set the PR changed, which the annotation loop already uses. The two diff prints that follow a failure are scoped the same way, so the evidence shows the copies that failed, not unrelated drift. Every existing test passed one path, so the suite could not see this. The new case seeds a second copy, syncs only the first, and moves the second's source: it fails on the old line and passes on the new one. A deleted copy still fails — the command writes it back untracked, which status reports. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjY3fXbmP1FSZ6B8kWD
A maintainer editing `paths` or `command` reads this `$comment`, not AGENTS.md. It named only audit-contracts, so nothing on the way in said these values are now a required check in three repos, where a wrong path fails every PR that touches a copy. One sentence, in the file the edit happens in. The story stays in why.md. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjY3fXbmP1FSZ6B8kWD
|
Pushed b03ed04. Both critic threads answered and resolved. Adopted — the whole Rebutted — the 150 s re-check. Joined — the review body's third point. Security review ran on 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
sydevs-bot
left a comment
There was a problem hiding this comment.
Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is
Calls sydevs/claude-workflow's contract-check action. A PR that changes a copied contract must leave it exactly as its sync command writes it; a PR that leaves the copy alone passes, however far SahajCloud has moved. Drift on main is the contract sync's to fix. Needs sydevs/claude-workflow#283 on main first. Co-authored-by: Claude Opus 5.5 <[email protected]>
Calls sydevs/claude-workflow's contract-check action. A PR that changes a copied contract must leave it exactly as its sync command writes it; a PR that leaves the copy alone passes, however far SahajCloud has moved. Drift on main is the contract sync's to fix. Needs sydevs/claude-workflow#283 on main first. Co-authored-by: Claude Opus 5.5 <[email protected]>
Calls sydevs/claude-workflow's contract-check action. A PR that changes a copied contract must leave it exactly as its sync command writes it; a PR that leaves the copy alone passes, however far SahajCloud has moved. Drift on main is the contract sync's to fix. Needs sydevs/claude-workflow#283 on main first. Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
.github/actions/contract-check/, a composite action. Each contract consumer (WeMeditateWeb, SahajAtlasWeb, SahajAtlasWordpress) runs it as a step in its existing required CI job.contractSynccopy must leave it exactly as that consumer's sync command writes it. A PR that leaves the copy alone passes, however far the source has moved.mainnever fails it.ci.infraLabel, so the dispatcher re-runs it instead of firingfix-ci.mainup to about 5 minutes stale after a merge.pathsandcommand(both optional) cover a copy outsidecontractSync. WeMeditateWeb uses them for its English mirror of production translations.contractSync's$commentnow says itspathsandcommanddrive this required check in three repos. A maintainer edits those values there, not inAGENTS.md.docs/why.md#a-contract-check-checks-what-a-pr-changes, plus the "CI for the other four" paragraph inAGENTS.mdand the CI line in the README.Failure this prevents
Hand edits pass every check.
wisdom_sidetextwas hand-typed into WeMeditateWeb's generated types and its English mirror (WeMeditateWeb#269). It passed every check, because nothing compared the copy with its source, and production rendered the raw key path.The fix in ci(contracts): fail the gate when the generated types or the English mirror drift from SahajCloud WeMeditateWeb#310 fails PRs for the wrong reason. It compared every PR's copy with SahajCloud
main. One producer merge would then:fix-cion each open bot PR;It was also red by design until an unrelated SahajCloud PR shipped. WordPress's required
URL contract in syncjob already has that shape.Precedent: this follows the same rule as
#dependency-review-checks-what-a-pr-adds. Drift onmainstays the job of the contract sync, which now merges itself, and ofaudit-contracts.Rollout
Merge this first. The consumers reference
sydevs/claude-workflow/.github/actions/contract-check@main, so their PRs' CI fails until this is onmain:URL contract in syncjob's steps, keeping its required name)Then close sydevs/WeMeditateWeb#310.
⚠ This is shared CI. A broken edit to the action, or to
contractSyncinloop-config.json, blocks merges in all three consumers at once.Test results
node --test dispatcher/test/*.test.mjs: 390 pass, 0 fail. The newcontract-check.test.mjsrunscheck.shagainst a throwaway git repo:claude plugin validate ./workflow --strict,workflow/libtests): 143 pass, 0 fail.action.ymlparses, andbash -npasses oncheck.sh. It hasn't run on GitHub yet: the consumer PRs are its first runs.🤖 Generated with Claude Code