Repository navigation
fix(harness): judge the whole content on a first push in the review, comments and contract gates - #183
Open
cljiahao wants to merge 16 commits into
Open
fix(harness): judge the whole content on a first push in the review, comments and contract gates#183cljiahao wants to merge 16 commits into
cljiahao wants to merge 16 commits into
Conversation
…comments and contract gates With no origin/main, record-review --prepare exited 1/2 on a missing base, and check-comments and check-contract judged nothing or failed. On a genuine first push (same conditions as the ratchet's first-push route) they now diff against the empty tree. A base that may exist but cannot be read still exits 2; the fix text names TC_REVIEW_BASE. Overrides cannot skip a later push. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ing by exact path and hash, and resolve bases by refs/remotes On a first push the review, comments and contract gates judged every file, so a FastAPI scaffold failed on the seeded .mjs helpers and the review diff was the whole tree. A file is now left out only when its exact path and sha256 equal a row of a generated per-stack table held in the hash-pinned gate-ratchet.sh. Every other file is judged. All gates resolve origin/main and origin/master as refs/remotes/..., so a local branch of that name is not a base. No-base messages name the supported way to set the base. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…push-gates-b46940 # Conflicts: # tests/golden/fastapi-azure.sha256 # tests/golden/fastapi-github.sha256 # tests/golden/nestjs-azure.sha256 # tests/golden/nestjs-github.sha256 # tests/golden/nextjs-azure.sha256 # tests/golden/nextjs-github.sha256 # tests/golden/vite-react-azure.sha256 # tests/golden/vite-react-github.sha256
…tchet, baseline and comments gates and probe tag bases A tag named origin/main on HEAD won over the remote-tracking ref, so the change-size budget measured zero lines. The default and argument bases now map origin/main and origin/master to refs/remotes/... in change-size, ratchet, baseline growth and comments. Tag-base probes cover the review, comments, contract, mutation-diff and change-size gates, plus symlink-at-seeded-path cases and a four-stack real-scaffold first-push loop. The harness doc states the residual that the table rests on the manifest hash. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…push-gates-b46940 # Conflicts: # tests/golden/fastapi-azure.sha256 # tests/golden/fastapi-github.sha256 # tests/golden/nestjs-azure.sha256 # tests/golden/nestjs-github.sha256 # tests/golden/nextjs-azure.sha256 # tests/golden/nextjs-github.sha256 # tests/golden/vite-react-azure.sha256 # tests/golden/vite-react-github.sha256
…ts and CI gates check-workarounds no longer takes a local main or master as its base and maps an explicit origin/main argument to refs/remotes; check-comments drops its local fallback; check-shared-gates, ci-gates.sh and the seeded CI files qualify the base as refs/remotes. check-review-record --seeded-paths reads the stack from harness.json at HEAD. The seeded file table stores paths with a bar for the slash so the guard scan does not take a seeded rules file for a gate file. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…push-gates-b46940 # Conflicts: # skills/scaffold/shared/template/scripts/gate-ratchet.sh # tests/golden/fastapi-azure.sha256 # tests/golden/fastapi-github.sha256 # tests/golden/nestjs-azure.sha256 # tests/golden/nestjs-github.sha256 # tests/golden/nextjs-azure.sha256 # tests/golden/nextjs-github.sha256 # tests/golden/vite-react-azure.sha256 # tests/golden/vite-react-github.sha256
…he workarounds, comments and review gates
A base now counts only when it resolves as a fully qualified refs/remotes/origin/<branch> ref. Every origin/<branch> input maps to that ref, so a tag or local branch of the same name cannot stand in for it. check-comments.sh no longer trusts BASE_REF outside CI and refuses an argument base that is a local branch, tag, HEAD or sha. check-workarounds.sh takes @{upstream} only when it is a remote-tracking ref. check-comments.sh skips a remote-tracking candidate that stands at HEAD and judges the whole content when all do. ci-gates.sh passes the full ref. Tests cover each case with a clean control.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…push-gates-b46940 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… the pushed commit, and take a bare sha only from the pre-push route Outside CI, check-comments.sh now judges the whole content when a base given by argument or BASE_REF stands at HEAD, so a remote-tracking ref written at HEAD cannot empty the diff. check-workarounds.sh does the same for an explicit origin/<branch> base at the pushed commit, and takes a bare sha base only from its own --pre-push child call (marked with the parent process id). Tests cover each case with a clean control, and the changelog states what is still not caught. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…push-gates-b46940
…emote base, and the awk-count check uses check Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… ref Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On the first push of a scaffolded project to a new empty remote there is no
origin/main. Three seeded gates then failed or judged nothing:record-review.sh --prepareexited 1 with "no base ref found" and "cannot compute the diff hash". The fix text did not nameTC_REVIEW_BASE.check-comments.shreported "nothing checked" and exited 0.check-contract.shskipped its changed-generator rule and exited 0.The fix reuses the ratchet's first-push decision.
check-review-record.shgains afirst_push()test, exposed as the mode--first-push(exit 0 first push, 1 a base exists, 2 a base may exist but is not here). On a genuine first push:base=empty-tree;check-comments.shuses the empty tree as the merge base, so every tracked and untracked source file is judged as new;check-contract.shprints a first-push note instead of silently skipping.A second push, which has a base, behaves as before and needs a new review. One seeded-doc paragraph in
harness.mddescribes the route. Changelog fragment:changelog.d/no-base-review-diff-gates.fixed.md.gate-ratchet.shandcheck-change-size.share not touched.Threat model
TC_REVIEW_BASE,BASE_REF) that empties the diff so a first push passes unchecked.empty-treetoken set once lets a later push skip the check.The gates fail closed: whenever a base may exist and cannot be read, they exit 2.
Allow-list design
The first-push route is allowed only when all of these hold; anything else keeps the old behaviour (exit 2 or the existing message):
@{upstream},origin/HEAD,origin/mainororigin/mastercandidate resolves;The same conditions the ratchet uses, kept in one function. The token
empty-treeis reserved: an explicitTC_REVIEW_BASE=empty-treeis refused, andwrite_diffaccepts that base only whilefirst_pushstill holds.BASE_REFfrom the environment is refused on a first push incheck-comments.sh. With no base named and not a first push,check-contract.shexits 2. An explicit base argument orGATE_BASEkeeps the documented local skip.Probe list
Per gate (review, comments, contract):
empty-treeandBASE_REFon a first push: refused;Revert proof: with the three seeded scripts restored to
HEADand the new tests kept, the new probes fail (review gate 7, contract 3, comments 6 failures).Tests run
scripts/seeded-review-gate.test.sh: 456 passed, 0 failed.scripts/seeded-comments.test.sh: 1033 passed, 0 failed.scripts/seeded-contract.test.sh: 95 passed, 0 failed.bash scripts/lint-skills.sh skills/: all checks passed.shellcheckonscripts/*.shand the three seeded scripts: clean.scripts/run-gates.sh --check: map matches (92 commands).scripts/check-template-comments.sh: ok (327 files).python3 scripts/check-fences.py --root .: 571 fences OK.scripts/regen-golden.sh --write, thenscripts/check-golden.sh: 8/8 combos OK, also after mergingorigin/main.Not verified
check-comments.shon a real scaffold: not measured against the pre-push budget.🤖 Generated with Claude Code