Skip to content

fix(hooks): give each guard fixture row its own branch context - #196

Merged
danielvm-git merged 1 commit into
mainfrom
fix/guard-git-branch-context
Nov 3, 2026
Merged

danielvm-git merged 1 commit into
mainfrom
fix/guard-git-branch-context

Conversation

@danielvm-git

Copy link
Copy Markdown
Owner

Summary

main went red right after #194 merged. The parity gate compared a TS side pinned to a feature
branch
with a shell side reading the real HEAD. Protected-branch rules answer differently on
main, so the table could only pass off-branch. Fixes
BUG-2026-11-03-guard-normalize-branch-context.

  • Fixture rows may state branch: — default is a feature branch. The two commit rows are now the
    same command text with opposite verdicts: allow on fix/…, block on main. That pair is the
    property that had no coverage.
  • scripts/omp-guard-probe.ts takes [{command, branch}], so branchFor answers per row.
  • scripts/test-guard-git-normalize.sh builds one throwaway repo per distinct branch — git init,
    empty commit, checkout — and runs the shell hook inside it, so both implementations are judged in
    the same context. Deliberately no production env override: a pinned branch would be a bypass
    for real agents.
  • The adjacent assertions in section (d) run in a feature repo for the same reason.
  • New branch: main row also documents the protected-branch commit rule that was untested before.

Test plan

  • bash scripts/test-guard-git-normalize.sh → 4 passed, 0 failed (31 rows) from a feature worktree
  • same script from a clone with HEAD -> main → 4 passed, 0 failed
  • old harness in that same main clone → 2 passed, 3 failed — byte-identical to the CI failure
  • mutation: removing the commit rule from the TS port fails (b) and (c)
  • npm run compliance pass · bash scripts/run-verification-gates.sh 54/54 pass
  • bash scripts/lib/assert-epic-gate.sh release pass

The parity gate pinned the TS side to a feature branch (branchFor returned a
constant) while the shell side read the checkout's real HEAD. Protected-branch
rules answer differently on main, so the table could only pass off-branch: it
was green on every PR and went red on the first push to main after the previous
fix merged.

- Fixture rows may state 'branch:'; the two commit rows are now the SAME command
  with opposite verdicts, one on a feature branch, one on main.
- The probe takes [{command, branch}] so branchFor answers per row.
- The harness creates a throwaway repo per distinct branch and runs the shell
  hook in it, so both sides are judged in the same context — no production env
  override (a pinned branch would be a bypass for real agents).
- (d) adjacent assertions run in a feature repo for the same reason.

Mutation-checked: removing the commit rule from the TS port fails (b) and (c).

Refs BUG-2026-11-03-guard-normalize-branch-context.
Fixes verification-gates red on main (run 41667688664).
@danielvm-git
danielvm-git merged commit 5d379df into main Nov 3, 2026
7 checks passed
@danielvm-git
danielvm-git deleted the fix/guard-git-branch-context branch November 3, 2026 16:05
github-actions Bot pushed a commit that referenced this pull request Nov 3, 2026
## [2.91.1](v2.91.0...v2.91.1) (2026-11-03)

### Bug Fixes

* **hooks:** give each guard fixture row its own branch context ([#196](#196)) ([5d379df](5d379df))
* **hooks:** judge git argv instead of command substrings in guard-git ([#194](#194)) ([9532372](9532372)), closes [#184](#184)
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.91.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant