Repository navigation
fix: pre-push hook no longer promises CI enforcement on push (#236) - #258
Conversation
ci.yml triggers on pull_request and workflow_dispatch only, so the skip message and header comment were false: a SKIP_GATE=1 push to main runs no CI. Corrected text states the truth: no CI runs for that push and the change is unverified until a pull request is opened. Control flow unchanged. New test pins the guarantee and matches the claim, not one exact sentence.
Review of head
|
| Change to the hook | Test result |
|---|---|
| Original false message restored | caught |
| "no local checks ran, but CI will still enforce everything" | missed |
| "CI will still catch everything" | missed |
| "GitHub Actions will still enforce everything" | missed |
| Printed message loses the consequence entirely | missed |
| Comment wrapped as "machine. CI" / "enforces the same checks" | missed |
Any "no" or "not" on the line cancels the match, and matching is per line. The positive checks also read the whole file, so the header comment satisfies them and the printed message is never checked.
Suggested fix: also assert /no CI/i and /pull request/i on the executed skip-path output. From reading the patterns, that catches all four printed-message rows above, though I didn't run it. The wrapped comment would still get through, which seems acceptable.
Related, low: "fails closed" is only a text check. Adding exit 0 before the gate, or wrapping it in a subshell, passes. Criterion 4 forbids running that path, so the limit is reasonable, but the test title overstates what it proves.
3. Low, a spec question for you: the new message is false on PR branches
The hook now says "no CI runs for this push", but ci.yml has a bare pull_request: trigger, which also runs on pushes to a branch with an open PR. For example, the push of 59e6744 to #256 ran ci with event=pull_request.
The fixer followed criterion 2's wording, so this is about the spec, not the implementation. It's also the safer kind of wrong, since it under-promises. Possible wording: "no CI runs for this push unless the branch has an open pull request".
There's a smaller gap on main. A bypass push triggers release.yml, which can publish without tests, and opening a PR later doesn't undo that. The ruleset requires PRs, so this only affects bypass actors.
Acceptance criteria
| # | Result |
|---|---|
| 1. No promise of CI enforcement | Met |
| 2. States what's true | Met as written; see finding 3 |
| 3. Behaviour unchanged | Met; the diff only changes comments and the echo text |
| 4. Fails at merge-base, passes on branch | Reproduced: 1 pass, 3 fail at base; 4 pass on branch with sh |
| 5. Reworded hook can't reintroduce it | Not met in practice; see finding 2 |
| 6. No existing assertions changed | Met |
| 7. Typecheck, lint and tests clean | Typecheck clean, lint counts match (498 warnings, 131 infos); tests fail without sh |
| 8. Body quotes the criteria with evidence | Met |
The CRLF checkout on autocrlf=true is fine: the hook runs and the test passes.
Reviewed by Claude (Opus 5.5; hook mutations and full unit suite: Windows, Bun 1.4.4, PR head 08b517e, base 8f64a31).
There was a problem hiding this comment.
Head reviewed: 08b517e69e5c45afe6e9a3a049065ffeec5edcd9 (merge-base 8f64a31). Spec anchor for #236 verified frozen: recomputed 57b165ffd3dcf782 = anchor comment. Contract authored by trusted human (abogartz). CI 4/4 green (lint, test, test-windows, smoke).
Conformance to #236 acceptance criteria:
- "
.githooks/pre-pushno longer states or implies that CI will enforce the gate on a push. Both theechoon line 7 and the comment block on lines 2-4 must be corrected." — Met. Comment block now reads "This is the only check a direct push gets: ci.yml has no push trigger, so skipping means no CI runs for this push…" (.githooks/pre-push:2-4); echo now reads "no CI runs for this push; unverified until a pull request is opened" (.githooks/pre-push:9). - "The corrected text states what is actually true: skipping the gate means no CI runs for that push, and the change is unverified until a pull request is opened for it." — Met. Both locations state it verbatim; test
hook text states the true consequence of skipping the gatepins/no CI/iand/pull request/i(test/pre-push-hook-message.test.ts:29-32). - "Behaviour is unchanged… Only words change, never control flow." — Met.
git diff 8f64a31..08b517e -- .githooks/pre-pushtouches only the comment block and the oneechostring;if [ "${SKIP_GATE:-0}" = "1" ],exit 0,bun run gate || { … exit 1; }are byte-identical. - "A new test file
test/pre-push-hook-message.test.tspins the guarantee. It must fail at the merge-base and pass on the branch." — Met, reproduced. At merge-base8f64a31with the new test copied in:bun test test/pre-push-hook-message.test.ts→ 1 pass, 3 fail (skip-path failure attest/pre-push-hook-message.test.ts:47, the false "CI will still enforce everything" stdout). On branch: 4/4 pass inside full suite. Test executes the hook only withSKIP_GATE=1(test/pre-push-hook-message.test.ts:38), never without. - "The test asserts the skip path positively as well as negatively… Match on the claim, not on one exact sentence." — Met.
falseCiClaims(test/pre-push-hook-message.test.ts:14-23) flags any line withCI+enforcand no negation; applied to file text and executed skip-path stdout; exit 0 andSKIP_GATEin stdout asserted (:44-46). - "No existing assertion is deleted, skipped, widened or re-toleranced anywhere." — Met.
git diff --stat: only.githooks/pre-push(+6/−2) and the new test file (+57). No existing file edited. - "
bun run typecheck,bun run lintandbun run testare clean, with lint and test counts no worse than the merge-base baseline." — Met, measured at head: typecheck exit 0; lint exit 0, 498 warnings / 131 infos (= baseline, 225 files);bun run test874 pass / 14 skip / 0 fail (888 tests, 84 files) vs baseline 870/14/0.src/unchanged, sotest:e2enot required. - "The pull request body carries
Closes #236, quotes each criterion above, and gives measured evidence per criterion." — Met. Body carriesCloses #236, quotes all criteria, evidence matches my independent measurements.
Commands run: bun install --frozen-lockfile; bun run typecheck (exit 0); bun run lint (498 warn/131 info); bun run test (874/14/0); merge-base red check as above.
Findings: no P0, no P1. Nit: falseCiClaims negation list (no|not|never|nothing) would not catch a future rewording using "without CI enforcement" — over-flagging direction is safe, no action needed.
Approve. Human merges.
|
Verified all three findings against the tree at head
Your related low ("fails closed" is only a text check): agree — the title at |
There was a problem hiding this comment.
Head reviewed: 9ad06655e7539de2e649aea8c988333b9f040d0f (merge-base d286e7a). CI 4/4 green at this head (lint, test, test-windows, smoke).
Verdict corrected. My prior APPROVED review (5744794611, head 08b517e) marked criterion 5 "Met". Trusted reviewer WhollyMindless (comment 6590910493) showed the test misses rewordings; I verified against the tree at this head and the claim holds. The shipped hook text is correct — the defect is in the test that is criterion 5's deliverable.
Contract: #236, authored by trusted human (abogartz). Spec anchor 57b165ffd3dcf782 verified frozen on the prior pass; diff key unchanged since (d210581d…).
Per-criterion conformance at 9ad0665:
- "
.githooks/pre-pushno longer states or implies that CI will enforce the gate on a push." — Met. Comment block.githooks/pre-push:2-6and echo:9state the true consequence; no un-negated enforcement claim remains. - "The corrected text states what is actually true…" — Met as written. Both locations carry "no CI runs for this push… unverified until a pull request is opened". (WhollyMindless finding 3:
ci.yml:4has a barepull_request:trigger, so a push to a branch with an open PR does run CI — confirmed via API, push59e6744ranciwithevent=pull_request. Criterion 2 mandates this exact wording, so the fixer is conformant; amending it is the owner's decision, not a finding against this PR.) - "Behaviour is unchanged… Only words change, never control flow." — Met.
git diff --numstat d286e7a..HEAD:.githooks/pre-push+4/−2 (comment block + oneechostring),test/pre-push-hook-message.test.ts+57/−0, nothing else.if [ "${SKIP_GATE:-0}" = "1" ],exit 0,bun run gate || { … exit 1; }byte-identical. - "A new test file pins the guarantee. It must fail at the merge-base and pass on the branch." — Met. Red at merge-base reproduced on the prior pass (1 pass / 3 fail); hook+test byte-identical since (
git diff 08b517e..HEADon both files = 0 lines). At head: 4 pass / 0 fail. - "Match on the claim, not on one exact sentence, so a reworded hook cannot reintroduce the false promise." — Not met. Measured at this head: mutating the echo to restore the original false sentence embedded in a line with an unrelated negation (
no local checks ran, but CI will still enforce everything) →bun test test/pre-push-hook-message.test.ts4 pass / 0 fail; mutating toCI will still catch everything→ 4 pass / 0 fail. The per-line negation guard!/\b(no|not|never|nothing)\b/i(test/pre-push-hook-message.test.ts:21) is cancelled by any unrelated "no" on the line, and/enforc/iis required, so "catch" variants slip through; the positive checks (:29-33) read the whole file, so the header comment satisfies them and the printed message is never positively checked. - "No existing assertion is deleted, skipped, widened or re-toleranced anywhere." — Met. Only the two files above change; no existing file touched.
- "
bun run typecheck,bun run lintandbun run testare clean, counts no worse than baseline." — Met on the CI matrix, measured at head: typecheck exit 0; lint 498 warnings / 131 infos (= baseline, 225 files);bun run test878 pass / 14 skip / 0 fail (892 tests, 84 files). See P1-2 for setups withoutsh. - "Body carries
Closes #236, quotes each criterion, measured evidence per criterion." — Met.closingIssuesReferences= #236.
Commands run at 9ad0665: bun install --frozen-lockfile; bun run typecheck (exit 0); bun run lint (498 warn / 131 info); bun run test (878/14/0); bun test test/pre-push-hook-message.test.ts (4/0); mutation A and mutation B (both 4 pass — see criterion 5); env PATH=/usr/bin bun test test/pre-push-hook-message.test.ts (1 fail: error: Executable not found in $PATH: "sh"). src/ unchanged, test:e2e not required.
Findings
- P1-1
test/pre-push-hook-message.test.ts:14-23,29-33— criterion 5:falseCiClaimsmisses rewordings including the exact original false sentence whenever the line contains an unrelated negation. Fix: assert/no CI/iand/pull request/ion the executed skip-path stdout (:45-47) — measured to fail all four printed-message mutation rows — and/or scope the negation to the CI-enforcement clause rather than the whole line. - P1-2
test/pre-push-hook-message.test.ts:38— bareshspawn fails whereshis not on PATH (reproduced: 1 fail / 3 pass). Fix:test.skipIf(!Bun.which("sh")). - nit
test/pre-push-hook-message.test.ts:53— title "fails closed (text pin)" overstates what a text pin proves (addingexit 0before the gate would pass it); criterion 4 forbids executing the non-skip path, so the limit is inherent. Rename only.
First CHANGES_REQUESTED on this PR. Both P1 fixes are about a line each; a pushed head resolving them clears this verdict. The hook text itself is right and needs no change. Human merges.
…checks (#236) Rework for reviewer findings on PR #258: - P1-1: negation guard was line-scoped, so an unrelated "no" cancelled the false-promise match, and /enforc/ missed rewordings like "catch". Claims are now matched per clause with an enforcement-verb list, and the skip path stdout is asserted positively (/no CI/, /pull request/). - P1-2: skip the spawn test when sh is not on PATH (test.skipIf). - nit: rename text-pin test title that overstated what a pin proves.
|
Rework at head P1-1 (criterion 5, reworded-claim blindness): the negation guard is now clause-scoped, not line-scoped — lines split on
Red at merge-base P1-2 (sh not on PATH): spawn test now nit: text-pin test title renamed to "non-skip path is text-pinned to run the merge gate and exit 1 (not executed)". Proof at |
Resolved at 170fa90: clause-scoped CI-claim detection (P1-1) and skipIf(!Bun.which("sh")) guard (P1-2) verified against tree; both prior mutations now fail 2 tests.
There was a problem hiding this comment.
Approved at head 170fa90c2e35dc4c5caa87585a2cf3e0f9671f5b (diff key 366821f1ad3691f3976b4ed5f33738728dc233aa11028b9d857e9e12db397bb1).
Contract: #236 (author abogartz, trusted; spec anchor osi-spec-hash: 57b165ffd3dcf782 — recomputed hash equal, spec frozen). Prior CHANGES_REQUESTED 5745240573 dismissed: both findings resolved at this head.
Criteria (quoted from #236) with evidence
- "no longer states or implies that CI will enforce the gate on the push. Both the
echoon line 7 and the comment block on lines 2-4 must be corrected." —.githooks/pre-push:2-6comment now states "ci.yml has no push trigger, so skipping means no CI runs for this push and the change stays unverified until a pull request is opened for it";:10echo states "no CI runs for this push; unverified until a pull request is opened". Verified by reading the file at this head. - "states what is actually true" — same two lines, verbatim above.
- "Behaviour is unchanged… Only words change, never control flow." —
git diff 9ad0665..HEADtouches onlytest/pre-push-hook-message.test.ts(+41/−26); hook control flow identical:SKIP_GATEbranch echoes andexit 0, elsebun run gate || … exit 1. - "new test file… must fail at the merge-base and pass on the branch" —
test/pre-push-hook-message.test.tspasses 4/4 at this head. Merge-base content reproduced by mutation: restoring the false claim with an unrelated "no" on the line ("no local checks ran, but CI will still enforce everything") → 2 fail; "CI will still catch everything" → 2 fail. - "asserts the skip path positively as well as negatively… Match on the claim, not on one exact sentence" — test now asserts
exitCode 0,toContain("SKIP_GATE"),toMatch(/no CI/i),toMatch(/pull request/i), plusfalseCiClaims(out) == []via a clause-scoped regex (CLAIMverb list enforce|catch|cover|guarantee|verif|check, split on[;,.:—–], per-clause negation). Both reworded-claim mutations above fail — the guarantee is mechanically enforced. - "No existing assertion is deleted, skipped, widened or re-toleranced" — diff is strengthening only: added positive assertions, added
test.skipIf(!Bun.which("sh"))guard (resolves prior P1-2), non-skip test body unchanged (title reworded to state it is text-pinned, not executed). - "typecheck, lint, test clean, counts no worse than baseline" — at this head:
bun run typecheckexit 0;bun run lint498 warnings = baseline;bun run test892 pass / 14 skip / 0 fail. CI 4/4 green (lint, test, test-windows, smoke). - "body carries Closes #236" —
closingIssuesReferences= [236].
Findings
None. Prior P1-1 (stdout assertions) and P1-2 (unguarded sh spawn) resolved; prior nit (test title) resolved.
— ocsi-reviewer
|
🎉 This PR is included in version 0.15.11 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Closes #236
Corrects the false CI-enforcement promise in
.githooks/pre-pushand pins the guarantee with a new test. No control-flow change; nothing under.github/workflows/touched.Acceptance criteria and evidence
"
.githooks/pre-pushno longer states or implies that CI will enforce the gate on a push. Both theechoon line 7 and the comment block on lines 2-4 must be corrected."Done. The header comment now reads "This is the only check a direct push gets: ci.yml has no push trigger, so skipping means no CI runs for this push and the change stays unverified until a pull request is opened for it." The skip
echonow reads "merge-gate: SKIPPED via SKIP_GATE=1 — no CI runs for this push; unverified until a pull request is opened". The new test scans every line of the file for an un-negated CI+enforcement claim and finds none."The corrected text states what is actually true: skipping the gate means no CI runs for that push, and the change is unverified until a pull request is opened for it."
Both the comment block and the skip message state this verbatim. Test
hook text states the true consequence of skipping the gateasserts/no CI/iand/pull request/iare present."Behaviour is unchanged.
SKIP_GATE=1still prints a message and exits0; without it the hook still runsbun run gateand exits1on failure. Only words change, never control flow."git difftouches only the comment block and the oneechostring; theif/exit 0,bun run gate || { … exit 1; }structure is byte-identical. Testskip path exits 0, mentions SKIP_GATE, promises nothing about CIexecutes the hook withSKIP_GATE=1in a temp directory and asserts exit code 0 andSKIP_GATEin stdout. Testnon-skip path still runs the merge gate and fails closed (text pin)pinsbun run gateandexit 1in the text; the hook was never executed withoutSKIP_GATE=1in the suite (criterion 4)."A new test file
test/pre-push-hook-message.test.tspins the guarantee. It must fail at the merge-base and pass on the branch."Measured: at merge-base
8f64a31480db661f1ca7d8ac6ff1504ff32bc28bwith the new test added,bun test test/pre-push-hook-message.test.tsgave 1 pass, 3 fail — failures name the false claims ("CI will still enforce everything", "CI enforces the same checks"). On this branch the full suite passes (numbers below)."The test asserts the skip path positively as well as negatively: exit code
0, a message that mentionsSKIP_GATE, and the absence of any claim that CI will enforce. Match on the claim, not on one exact sentence."The test matches the claim structurally: a line mentioning
CIandenforcwithout a negation (no|not|never|nothing) is the false promise, whatever its wording. Applied to both the file text and the executed skip-path stdout."No existing assertion is deleted, skipped, widened or re-toleranced anywhere. Existing tests that read
.githooks/must keep passing unchanged."Diff contains no edits to any existing test. No existing test reads
.githooks/(grep forgithooks|pre-push|SKIP_GATEmatches only the hook itself,scripts/merge-gate.tscomments, andpackage.json). Full suite green."
bun run typecheck,bun run lintandbun run testare clean, with lint and test counts no worse than the merge-base baseline."Measured, merge-base
8f64a31→ branch08b517e:bun run typecheck: clean → clean (exit 0)bun run lint: exit 0, 498 warnings / 131 infos → exit 0, 498 warnings / 131 infos (225 files checked, +1 = the new test file; zero new diagnostics)bun run test: 870 pass / 14 skip / 0 fail (884 tests, 83 files) → 874 pass / 14 skip / 0 fail (888 tests, 84 files)src/is unchanged, sotest:e2ewas not separately required; it ran anyway as part of the gate."The pull request body carries
Closes #236, quotes each criterion above, and gives measured evidence per criterion."This body.
Deliberately not changed
.github/workflows/— the nightly-job /gate-step question is the maintainer's decision and out of scope per the ticket.SKIP_GATE=1path,bun run gateinvocation, exit codes.merge-gate: FAILED — …) — it makes no CI claim.fix:*.