Expand description
Does this session’s diff touch the files its own contract executes?
The outcome contract is the automated trust boundary, and its derivation is
already well hardened: OutcomeContract::validate rejects assertion-less
checks, toolchain-only no-ops and placeholder names; strip_exit_masking_pipes
blocks pipelines that always exit 0; and the derivation prompt encodes a
dogfooded anti-hacking rule about -k filters and bespoke reproduction
snippets.
What remains is that the agent can edit the test files the contract runs.
coder::policy addresses that deliberately and correctly:
“Deliberately scoped to what is mechanically decidable.
conftest.py,pyproject.toml,tox.ini, andsetup.cfgare NOT denied: editing them is often the actual task, and no matcher can separate ‘add a fixture’ from ‘change how tests run’.”
This module does not change that. Denying test-adjacent edits would break
the many sessions where editing tests is the task. But denial is not the
only option: disclosure is mechanically decidable and was simply absent. If
check run_failing_test runs pytest tests/test_x.py and the diff modifies
tests/test_x.py, that is a fact computable from data already in hand — and
it was never computed, let alone surfaced at the approval gate.
§Why the extraction errs toward flagging
Pulling paths out of a shell command is a heuristic; there is no parse that
is both general and exact. So it follows policy.rs’s established posture —
conservative token matching, biased toward reporting — because the costs are
wildly asymmetric: a false positive costs one line of disclosure that a human
dismisses in a second, while a false negative silently restores the status
quo this exists to fix.
Structs§
- Check
Overlap - One check whose command references paths the session’s diff also touched.
Functions§
- contract_
overlap - Which of
changed_pathseach contract check executes. - disclosure
- One-line disclosure for the approval surface.
Nonewhen nothing overlaps. - referenced_
paths - Path-like tokens referenced by a check’s command.