The protected parser improvement still leaves lookup parsing every contract twice: its path references and dependent-update classification load the same working tree separately. Share the invocation-local complete index, reread it on every new lookup, and never substitute ambient contracts for an explicitly empty snapshot. Standalone index/commit guards keep their exact selected-source reads and reject a borrowed working-tree index in those modes. Add full current-reference equivalence, changed/deleted source, empty-source and source-selection controls.
Contract-Neutral: Preserve ownership, dependent references, verification obligations and source-selection rules; reuse only the complete working-tree index within one lookup and prevent empty-snapshot fallback.
Change-source: pulse-maintainer
Exact-main governance spent 168 seconds in subsystem lookup tests. A source profile attributes most lookup time to constructing and probing 99 numbered-list prefixes per line. Use one bounded equivalent match, preserving the existing 1..99 syntax, content and source offsets; retain full-index differential and adversarial parser coverage.
Contract-Neutral: Preserve contract syntax, reference offsets, ownership and verification requirements; only remove repeated prefix construction and scanning.
Change-source: pulse-maintainer
The completion guard's CI mode now compares contract text against the
evaluated commit (#2502), but it still decided which contracts a commit
owed from HEAD's registry and contract index. CI walks a branch with HEAD
at the tip (or at main after a merge), so a later commit could change an
earlier commit's verdict. If a later commit added a Shared Boundaries
reference to a file, an earlier commit that was complete when written got
blocked. If a later commit dropped ownership of a file, an earlier commit
that changed it without its contract passed. The pre-commit hook read
both from the commit's own index, so CI and the hook could still
disagree.
repo_file_io and subsystem_contracts can now read from a revision as well
as the working tree or index. A revision read uses only that commit's
tree and fails closed rather than falling back to the disk. In diff-base
mode the guard reads the registry and contract index from the evaluated
commit, as does the Prettier-only inference that --commit enables.
Replaying CI's per-commit loop over the last 120 commits on main gives
the same verdicts as before.
Pre-commit runs from a linked git worktree export an absolute GIT_DIR.
The release-control test helpers and the test-patched branch of
git_env() only removed GIT_INDEX_FILE, so their scratch-repo commands
targeted the REAL repository: 'git init' in a tempdir re-initialized it
with core.bare=true (breaking git status/commit for every checkout and
worktree) and the subsequent scratch 'git add' failed the hook.
Scrub GIT_DIR, GIT_WORK_TREE, GIT_INDEX_FILE, and GIT_COMMON_DIR in:
- git_env() of format_staged_go.py, governance_stage_guard.py, and
subsystem_contracts.py (test-patched branch only; production hook
behavior unchanged)
- the scratch-repo git() helpers in format_staged_go_test.py,
governance_stage_guard_test.py, readiness_assertion_guard_test.py,
subsystem_contracts_test.py
Matches the pattern contract_audit_test.py and status_audit_test.py
already used. Verified the full hook test battery passes with
GIT_DIR/GIT_WORK_TREE/GIT_INDEX_FILE pointed at a canary repo, which
stays un-corrupted.