Repository navigation
Conversation
A contract-sync PR has one correct content, yet each waited on the owner's approval: the ruleset needs one, and sydevs-bot cannot approve its own PR. contract-verify.yml, called from each consumer's workflow-state.yml, re-runs the consumer's contractSync command on its own main and compares the result with the PR head. A byte-for-byte match on a ready bot PR that changes nothing but the copy is approved as github-actions[bot], pinned to that head. A mismatch, or a check that never finishes, asks assignment.reviewer and says why. Nothing from the PR executes: the head is only fetched and diffed. The dispatcher stops asking the reviewer at a contract-only sync's mark-ready, since the check asks on a mismatch. 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, and the design is forced in a way the PR never says: only a workflow running in the consumer can approve there, because the sync job holds the producer's GITHUB_TOKEN and a PAT that is the PR's own author. The diff is the size of that problem — one reusable workflow, one gate, one finisher, tests for each. Safety holds: nothing from the head runs, the approval is pinned and dismissed on push, the queue still runs CI. My two real objections are about the check this adds rather than what it decides: it is not declared as the dispatcher's own check run, and it does not decide where it runs.
Findings
should-fix— the new check is absent fromci.ignoreCheckNamesand cancels in progress; a cancelled run reads as failing CI..github/workflows/contract-verify.yml:42should-fix— theverifyjob carries no event guard, unlike its siblingcontracts-plan..github/workflows/contract-verify.yml:33should-fix— why.md omits the fact that makes this design the only one available.docs/why.md:1395consider— the approval dedupe hardcodesgithub-actions[bot].dispatcher/contracts.mjs:155
What was checked. contract-verify.yml and contracts.mjs whole; dispatcher.yml's contracts-plan and contracts-sync beside them (the new job mirrors the sync job's step set, install step included, so the toolchain is proven); gather.mjs:286 and requiredOnly for how the new check reaches the CI verdict; workflow-state.yml here as the caller template — it does fire ready_for_review, so the gate's draft skip is reachable; docs/why.md#our-own-check-runs-are-not-ci and #only-required-checks-are-ci. Ladder: contractVerifyGate reuses isContractSyncOnly and changedPaths and adds no helper of its own. No linked ticket, so judged against the body. Not run.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
| # A newer head supersedes an older one's check. | ||
| concurrency: | ||
| group: contract-verify-${{ github.repository }}-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true |
There was a problem hiding this comment.
This job's check run is not in ci.ignoreCheckNames, and cancel-in-progress cancels it on every push. Where the ruleset cannot be read, every check counts and a cancelled run reads as failing — the shape that fired fix-ci five times on SahajCloud#742 (docs/why.md#our-own-check-runs-are-not-ci). Every sibling job is listed there. Add this one's <caller job> / verify name.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
| permissions: {} | ||
|
|
||
| jobs: | ||
| verify: |
There was a problem hiding this comment.
The verify job carries no if:. Its sibling contracts-plan in dispatcher.yml guards itself with if: github.event_name == 'pull_request_target' && …, so the called workflow decides when it runs. Here that condition lives in three consumer callers, on an on: block that also fires for issues, comments, statuses and a */30 cron — a runner and a checkout per event unless each caller's if: is right, and three places to drift. Guard the job here.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
| sync's mark-ready; the check asks instead, and says why, when the copy differs (a hand edit, or a | ||
| source that moved) or the check does not finish. Once `fix-ci` touches a file beside the copy, | ||
| `isContractSyncOnly` is false and the PR is reviewed like any other. The rulesets are unchanged: a | ||
| bypass actor could not be scoped to these paths, and would skip the queue for every bot PR. |
There was a problem hiding this comment.
This says why not a bypass actor, but not why the check re-derives bytes contracts-sync already wrote. That answer looks load-bearing: the sync job runs in the producer's event, so its GITHUB_TOKEN cannot approve in the consumer, and its PAT is sydevs-bot, who cannot approve its own PR. Only a workflow running in the consumer can approve. Without that line, "approve what you just pushed and let dismiss-on-push catch a hand edit" has no answer here.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
| if (pr.head.sha !== sha) return core.info(`#${number}: the head moved past ${sha.slice(0, 7)}; its own run decides`) | ||
| if (matched) { | ||
| const reviews = await github.paginate(github.rest.pulls.listReviews, { owner, repo, pull_number: number, per_page: 100 }) | ||
| if (reviews.some((r) => r.state === 'APPROVED' && r.commit_id === sha && r.user?.login === 'github-actions[bot]')) return core.info(`#${number}: ${sha.slice(0, 7)} is already approved`) |
There was a problem hiding this comment.
'github-actions[bot]' pins the dedupe to the token identity, while every other login here comes from config. An APPROVED review whose commit_id is sha is already this check's own — nothing else approves a head it did not compare. Dropping the login test is shorter and survives a token change.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
Superseded mid-run. All four critic findings were built and pushed before this closed — they are on One thing #280 does not take. The branch security review found that the check never dismisses its own approval. It approves head X; a later head the gate refuses leaves that approval standing, with auto-merge armed and nobody asked, so a commit nothing compared can merge. Filed as #282 (Critical), with the fix and its tests on that branch. Threads here are left as they are: this PR is closed and #280 carries them. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
.github/workflows/contract-verify.yml, a reusable workflow that each contract consumer (WeMeditateWeb, SahajAtlasWeb, SahajAtlasWordpress) calls fromworkflow-state.ymlon PRs oncontractSync.branch.contractSynccommand on the consumer's ownmainand compares the output with the PR head, byte for byte. If they match, and the PR is a ready bot PR from the same repo that changes nothing but the copy (isContractSyncOnly), it approves asgithub-actions[bot], pinned to that head SHA. The dispatcher already arms auto-merge at mark-ready, so the merge queue runs CI and merges.assignment.reviewerand leaves one comment per head saying why.ready_for_review. The check asks instead, and only when it can't vouch.Failure this prevents
Every contract-sync PR (17 of the 32 small bot merges in the eight weeks to 2026-10-20) waited on the owner's approval. The ruleset needs one, and sydevs-bot can't approve its own PR. Yet the PR has exactly one correct content, and a person checks nothing a machine can't. Example: sydevs/WeMeditateWeb#292 sat
BLOCKEDwith green CI and auto-merge armed.Safety
pull_request_target, and the PR head is onlygit fetched and diffed. The command comes fromloop-config.jsonon this repo'smain, and the script it runs comes from the consumer'smain.paths, so it can't editpackage.jsonor the strip script to game the comparison.dismiss_stale_reviews_on_pushdrops it on any later push, which re-runs the check.can_approve_pull_request_reviews: true.Rollout order
contract-verify.yml@main, and a caller referencing a missing file would breakworkflow-state.yml(and so the dispatcher) in that repo.verify-contract-syncjob withcontents: readandpull-requests: write.Between steps 1 and 2, a sync PR that reaches mark-ready gets no reviewer request. It still gets the dispatcher's "critic skipped" comment.
sydevs/WeMeditateWeb#292 will not be auto-approved. It carries a hand edit that restores
blocks.general.wisdom_sidetext, which the generator drops until sydevs/SahajCloud#1218 merges. The check will ask for review on it. That is correct behaviour.Test results
node --test dispatcher/test/*.test.mjs: 383 pass, 0 fail. The new tests cover the gate (draft, closed, non-bot, fork, other branch, extra file, empty list, producer), approval pinned to the SHA and given once, a moved head left alone, a mismatch or unfinished check asking once per head, dry run, and no reviewer request on a contract-only sync draft.github-actions[bot]approval.🤖 Generated with Claude Code