Skip to content

guardrails: guard test suites leak enclosing-repo state (sequencer exemption flips blocked fixtures) #942

Description

@kyle-sexton

Problem

block-noncanonical-commit.test.sh (and any guard suite whose hook consults ambient repo state) is sensitive to the state of the ENCLOSING repository: the hook's sequencer_in_progress exemption resolves git rev-parse --absolute-git-dir from the process cwd, so running the suite inside a worktree with an in-progress merge (MERGE_HEAD present) silently flips all 26 "blocked" fixtures to allowed — 37/63 instead of 63/63 — with no hint the environment caused it.

Repro

In a worktree of this repo: git merge <anything> to the conflicted state (do not commit), then run bash plugins/guardrails/hooks/block-noncanonical-commit.test.sh → 26 failures. Commit or abort the merge → 63/63. Observed live 2026-07-22 while restacking PR #903's branch; cost ~20 min of misdiagnosis toward the PR's own changes.

Fix direction

The suite already isolates git config (GIT_CONFIG_GLOBAL=/dev/null); extend the same doctrine to repo state — run fixtures from a mktemp -d cwd (or an initialized scratch repo when a fixture needs one) so the hook's repo-state probes never see the developer's checkout. Audit sibling guard suites for the same leak.

Classification

Test-infrastructure isolation gap; no guard behavior defect (the sequencer exemption behaved as designed). Fail-safe direction (spurious FAILURES, never spurious passes) — deferrable per the direction test.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: mediumReal value, no hard deadline; normal backlog flow.status: readyTriaged, unblocked, and fully specified; eligible to pick up.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions