Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
46aa04f
fix(harness): judge the whole content on a first push in the review, …
Kelerence Dec 1, 2026
6c6fc71
Merge origin/main into no-base-first-push-gates
Kelerence Dec 1, 2026
aa4c0cb
Merge origin/main into no-base-first-push-gates
Kelerence Dec 1, 2026
574b0c3
fix(harness): leave seeded files out of first-push whole-content judg…
Kelerence Dec 1, 2026
2cec0ee
Merge remote-tracking branch 'origin/main' into claude/no-base-first-…
Kelerence Dec 1, 2026
d3a7b0e
fix(harness): read origin/main as refs/remotes in the change-size, ra…
Kelerence Dec 1, 2026
dc48902
Merge remote-tracking branch 'origin/main' into claude/no-base-first-…
Kelerence Dec 1, 2026
2cb4447
fix(harness): close local-branch and tag bases in workarounds, commen…
Kelerence Dec 1, 2026
9f7ace2
Merge remote-tracking branch 'origin/main' into claude/no-base-first-…
Kelerence Dec 2, 2026
a07ca0c
fix(harness): one closed allow-list of remote-tracking bases across t…
Kelerence Dec 2, 2026
83d6c25
Merge remote-tracking branch 'origin/main' into claude/no-base-first-…
Kelerence Dec 2, 2026
085956e
fix(harness): judge the whole content when an explicit base stands at…
Kelerence Dec 2, 2026
7aff658
Merge origin/main (3157f50c) into claude/no-base-first-push-gates-b46940
Kelerence Dec 2, 2026
359211e
Merge remote-tracking branch 'origin/main' into claude/no-base-first-…
Kelerence Dec 2, 2026
57e50d4
fix(tests): harness-kit ci-gates secrets test expects the qualified r…
Kelerence Dec 2, 2026
e27682a
fix(tests): pinned CI template steps expect the qualified remote base…
Kelerence Dec 2, 2026
62db745
Merge remote-tracking branch 'origin/main' into claude/no-base-first-…
Kelerence Dec 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions changelog.d/no-base-review-diff-gates.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- On the first push of a project to a new empty remote (no `origin/main`), the seeded review gate, `check-comments.sh` and `check-contract.sh` judge the whole pushed content against the empty tree instead of exiting on a missing base or judging nothing. `record-review.sh --prepare` writes the full diff with `base=empty-tree`; `check-comments.sh` judges every tracked source file; `check-contract.sh` skips only the changed-generator rule, which has nothing to compare. A base that may exist but is not here (upstream still set, other remote-tracking refs, shallow clone, CI) still fails, `BASE_REF` is refused on a first push, and `TC_REVIEW_BASE=empty-tree` is reserved.
- On a first push a file is left out of whole-content judging (the review diff and `check-comments.sh`) only when its path and sha256 equal a row of the generated seeded file table that `gate-ratchet.sh --seeded-table <stack>` prints; the table lives in the hash-pinned ratchet script and `scripts/seeded-facts.sh --write` regenerates it. A clean FastAPI scaffold no longer fails its first push on the seeded `.mjs` helpers, and the first-push review diff of a template-only scaffold no longer carries every seeded file. An edited seeded file, a file with the project name filled in, a file not in the table, or a missing or unreadable table are judged or fail closed (exit 2). The gates print how many files were left out and how many judged.
- Behaviour change: `check-contract.sh` with no argument and no `GATE_BASE`, when `origin/main` is missing or has no merge base with HEAD and this is not a first push, exits 2 with the supported ways to name the base (the argument or `GATE_BASE`); before, the local run skipped the changed-generator rule. An explicit argument or `GATE_BASE` that does not resolve still skips locally.
- The review, comments, contract, mutation-diff, workarounds and ratchet gates resolve the default base through `refs/remotes/origin/...`, so a local branch or tag named `origin/main` is never taken for the remote base. Still not caught: a remote-tracking ref written by hand that points at an earlier commit of the same history (an intermediate commit, or an `origin/HEAD` symref that points at such a ref) cannot be told from a fetched one, so it narrows the diff to the commits after it. A hand-written ref at HEAD itself is caught: the comments gate judges the whole content outside CI, and the workarounds gate does so in CI and outside it, when the base, given by argument, by `BASE_REF` or found by default, stands at the pushed commit.
- The no-base failure messages name the supported ways to set the base (`TC_REVIEW_BASE`, the base argument, `GATE_BASE`).
- `check-change-size.sh`, `gate-ratchet.sh`, `gate-baseline.sh growth` and `check-comments.sh` now also read `origin/main` and `origin/master` as `refs/remotes/...` when they are given as an argument or default, so a tag or local branch of that name cannot stand in for the remote base and empty the measured change.
- `check-workarounds.sh` no longer takes a local branch `main` or `master` as its base: it resolves only `@{upstream}`, `refs/remotes/origin/HEAD`, `origin/main` and `origin/master` as remote-tracking refs, maps an explicit `origin/main` argument to `refs/remotes/...`, and judges the whole content when no base resolves. `check-comments.sh` drops the same local fallback. `check-shared-gates.sh`, `.claude/ci-gates.sh` and the three seeded CI files qualify the base as `refs/remotes/...`, so a tag or local branch cannot stand in for it. `check-review-record.sh --seeded-paths` reads the stack from the committed `.claude/harness.json` at HEAD, the same source the first-push judging uses.
- The seeded file table stores each path with a vertical bar for the slash and `fp_files` turns it back, so the guard scan, which reads path mentions in gate scripts, no longer takes a seeded stack rules file for a gate file that the manifest does not record.
- One closed allow-list of bases in `check-workarounds.sh`, `check-comments.sh`, `check-review-record.sh` and `.claude/ci-gates.sh`: a base counts only when it resolves as a fully qualified `refs/remotes/origin/<branch>` ref. Every `origin/<branch>` input, not only `origin/main` and `origin/master`, is mapped to that ref, so a tag named `origin/develop` cannot stand in for the base of a pull request that targets `develop`. A local branch, a tag, `HEAD`, a `refs/heads/...` name or a bare sha given as an argument is refused (exit 1 or 2), and `ci-gates.sh` passes the full `refs/remotes/...` ref to the gates.
- `check-comments.sh` no longer trusts `BASE_REF` outside CI: it must name an `origin/<branch>` remote-tracking ref, or the run is refused. `BASE_REF=HEAD` no longer gives an empty diff. A remote-tracking candidate that stands at HEAD is skipped as `check-workarounds.sh` does, and when every candidate stands at HEAD the whole content is judged. An explicit base (argument or `BASE_REF`) that stands at HEAD takes the same whole-content path outside CI.
- `check-workarounds.sh` takes `@{upstream}` only when it resolves to a `refs/remotes/origin/...` ref, so an upstream set to a local branch (`branch.<x>.remote` is `.`) is ignored and the whole content is judged.
- `check-workarounds.sh` takes a bare sha base only from its own `--pre-push` route, which marks the child call with its process id; a sha passed by hand, with or without a tip, is refused. An explicit `origin/<branch>` base that stands at the pushed commit judges the whole content instead of an empty diff.
6 changes: 4 additions & 2 deletions scripts/day-one.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ for ST in nestjs nextjs vite-react fastapi; do
git -C "$P" add -A
git -C "$P" -c user.name=t -c user.email=t@example.invalid -c commit.gpgsign=false commit -q -m "chore: scaffold" || bad "$ST/$HOST base commit failed"
git -C "$P" checkout -q -b work
git -C "$P" update-ref refs/remotes/origin/main main
git -C "$P" update-ref refs/remotes/origin/root "$ROOT"

gate harness bash .claude/verify-harness.sh
gate docs bash scripts/check-docs.sh
gate testbudget bash scripts/test-budget.sh
gate nosonar bash .claude/ci-gates.sh nosonar
gate workarounds bash scripts/check-workarounds.sh main
gate workarounds-whole-scaffold bash scripts/check-workarounds.sh "$ROOT"
gate workarounds bash scripts/check-workarounds.sh origin/main
gate workarounds-whole-scaffold bash scripts/check-workarounds.sh origin/root
gate ratchet bash scripts/gate-ratchet.sh auto
gate ratchet-whole-scaffold bash scripts/gate-ratchet.sh "$ROOT"
gate envexample bash scripts/check-env-example.sh
Expand Down
3 changes: 2 additions & 1 deletion scripts/seeded-boundaries.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ workaround_probe() { # workaround_probe <dir> <name> <file> <content>: an inline
printf '%s\n' "$content" > "$dir/$file"
git -C "$dir" add -A
"${GIT[@]}" -C "$dir" commit -q -m probe
out=$(cd "$dir" && bash scripts/check-workarounds.sh main 2>&1)
git -C "$dir" update-ref refs/remotes/origin/main main
out=$(cd "$dir" && bash scripts/check-workarounds.sh origin/main 2>&1)
rc=$?
check 1 "$rc" "workaround detector flags: $name"
has "$file:1" "$out" "workaround detector names the line: $name"
Expand Down
11 changes: 11 additions & 0 deletions scripts/seeded-change-size.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -860,5 +860,16 @@ check 1 "$EC" "real nextjs scaffold with a bulk edit fails"
echo "real run bulk edit:"
printf '%s\n' "$OUT"

# A tag named origin/main must not stand in for the remote-tracking branch: the budget is still measured against refs/remotes/origin/main.
repo tagbase
lines 900 "$D/big.txt"
commit_all
(cd "$D" && git update-ref refs/remotes/origin/main main && git tag origin/main HEAD)
run "$D"
check 1 "$EC" "a tag named origin/main is not the base: the 900 changed lines still fail ($OUT)"
has "900 changed lines (budget 800)" "$OUT" "a tag named origin/main: the count is measured"
run "$D" BASE_REF=origin/main
check 1 "$EC" "a tag named origin/main as BASE_REF: the 900 changed lines still fail ($OUT)"

echo "seeded-change-size.test: $PASS passed, $FAIL failed"
[ "$FAIL" -eq 0 ]
Loading