apply refuses a Role's push to a protected path or a model Lens's input, read from its bundle before any token is minted (#139, record 0188)
Closes #139, "Harness: apply refuses a Role's push to a protected path or a Lens's input that no model Lens has reviewed". It is the first story of slice 2.
The edits to config/hooks.json and tools/hooks/protected.py are pre-approved by the Maintainer 2026-11-08, ruled by the Factory Builder.
Record docs/decisions/0188-a-roles-push-is-refused-where-it-touches-a-protected-path-or-a-model-lenss-input-read-from-its-bundle-before-any-token-is-minted.md replaces 0070. The Factory Builder gave it 0188, behind 0186 and 0187.
What changes (the Factory Builder's rulings of 2026-11-10)
- What a push refuses.
- Refused:
protectedpaths (records 0004 and 0005, the paths a person must judge) and each model Lens's inputs (record 0052). - Pushed: a path that is only a deterministic Lens's input (
verify's, the secret scan's). Record 0020 holds it at convergence, until every model Lens has reviewed its head. adapters/rules.pyreads which Lenses are model Lenses fromconfig/defaults.jsonat the base commit, besideconfig/hooks.json. A commit that names none ispush_list_unreadable.- Under 0070 the Factory's author could have pushed only
docs/to this repo.
- Refused:
- Code owners.
CODEOWNERSanddocs/CODEOWNERSjoin.github/among the protected paths. effect/1gainspush_commits. One to a Result, naming the bundle by artifact and digest. The branch and the commit it lands on areapply's. No Role permits it yet.harness/bundle.py.fetch_bundle(artifact, digest)is the one function that #314's choice fills; until then it fetches nothing.names()reads every name a patch writes or reads from the patch itself, as git reads it. It reads the header, rename and copy lines, and sides that must match them. Quoted names are unquoted byte by byte. Anything else makes the bundle unreadable: an unknown line, a miscounted hunk, a NUL, a binary patch, or a marker git does not write.held()reads the base's list first, takes the bundle by its digest, then callspush_refusal.
apply.jobholds a push after every other check and before minting any token.harness/apply_step.pygives it the hold, at the base commit of a read of the pull request made at the head its facts were read at. A push with no hold is refused. A refusal lists each Effect refused inapplied/1and gives its fault inoutcome/1.- Faults.
- The Role's:
push_protected,bundle_unreadable,bundle_digest_differs,bundle_not_handed_over. - The Factory's:
push_list_unreadable,bundle_unfetched,push_not_held. - The Result names the bundle, so no item can pause the Factory through it.
- The Role's:
- What waits. The push's write itself, with the fix Intent's push.
harness/push.pystays reserved for it, so the eleven rows that wait on that file still wait. Until it lands,config/apps.jsongrants no need forpush_commits. - Residuals in the record.
- The author may change what
verifyreads. Only model review and the machine user's approval hold such a change at convergence; #198's switch makes that approval required. - The names checked are the patch's. The write must land exactly that patch.
- The author may change what
Notes for review
- Records. 0070 is replaced. Its three rows now point at the checks that hold the narrowed rule; the rows themselves are not reworded (the Claude review's minor). 0004's and 0005's push rows are re-pointed. 0020 and 0052 each gain a row. 0020's older row, which waits on
harness/push.pyand names the issue's original words, is left as it is. - The session hook.
docs/now holds a protected path, so the hook asks before commands that may write acrossdocs/as a whole. Two hook tests moved to anotes/directory. - The token sweep (record 0184). Main's walk of every step's reads now reaches this change's read of
config/hooks.jsonandconfig/defaults.jsonat the base,adapters/rules.py's_file_at.tests/test_token_needs.pyclasses it ascontents: read, one request.apply's token already holdscontents: readthrough three of its needs, so nothing more is minted and no App's grant changes. - Binary changes. Binary changes are refused, as a binary patch or as text with a NUL. So is a patch whose no-newline marker is in another locale's words. Each fails closed, as a person's to push.
Reads
The Claude review and security pass at 1ac1ceb4:
- Blocking: a header holding a quote was split otherwise than git splits it, so
CODEOWNERScould be touched unread. - Major: a hunk count long enough to crash Python; a missing artifact counted as the Factory's fault; no step gave
applythe hold. - Minor:
/dev/nullwith no mode line; the 0070 rows; 0020's old row. - Info: the hook asking about
docs/.
All were fixed in b7f396ff, except the two record rows and the hook note, which are described above.
| Reviewer | Head | Unread parts | Blocking | Major | Minor | Info |
|---|---|---|---|---|---|---|
| agy | 1ac1ceb | none | 1 | 1 | 0 | 0 |
| muse | 1ac1ceb | none | 0 | 0 | 3 | 0 |
| astra | 882f9de | none | 0 | 4 | 0 | 0 |
| Finding | Severity | Criterion | Where | What | Disposition |
|---|---|---|---|---|---|
| agy#1 | blocking | PR-2 | harness/bundle.py:60 | Unquoted paths with tabs or trailing fields on diff headers bypass held() while git apply writes the target path | fixed in 5f924cb1 (each side names only what its header or rename names; the tab case refused at b7f396ff) |
| agy#2 | major | PR-3 | harness/bundle.py:54 | _name() double-decodes raw UTF-8 bytes in quoted paths and leaves unknown backslash escapes unrejected | fixed in 5f924cb1 (quoted names unquoted byte by byte, unknown escapes refused) |
| muse#1 | minor | PR-5 | harness/apply_step.py:139 | The apply step never gives apply.job the bundle hold the decision says it gives | fixed in b7f396ff (apply_step gives apply.job its hold, at the base of a read at the facts' head) |
| muse#2 | minor | PR-3 | harness/bundle.py:91 | A mutant deleting the spaced-name header reading survives every Bundle test | fixed in 5f924cb1 (test and mutant for the spaced-name header) |
| muse#3 | minor | PR-3 | harness/bundle.py:139 | A hunk count past Python's int digit limit raises out of bundle.names instead of reading as unreadable | fixed in b7f396ff (counts of nine digits at most) |
| astra#1 | major | PR-5 | harness/bundle.py:29 | The nine-digit hunk limit has no test at its boundary | fixed in 9ccca631 (nine- and ten-digit counts, mutant) |
| astra#2 | major | PR-5 | harness/bundle.py:94 | Matching a side to its header does not hold the prefix rule | fixed in 9ccca631 (side prefixes on both sides, mutant restored) |
| astra#3 | major | PR-3 | harness/bundle.py:181 | Binary content passes the hold when represented as text hunks | fixed in 9ccca631 (a line with a NUL makes the bundle unreadable) |
| astra#4 | major | PR-3 | harness/bundle.py:186 | Arbitrary backslash lines are accepted inside a hunk | fixed in 9ccca631 (only git's own marker is read) |
Astra's second read, after its four majors were fixed:
| Reviewer | Head | Unread parts | Blocking | Major | Minor | Info |
|---|---|---|---|---|---|---|
| astra | 9ccca63 | none | 0 | 1 | 0 | 0 |
| Finding | Severity | Criterion | Where | What | Disposition |
|---|---|---|---|---|---|
| astra#1 | major | PR-5 | harness/bundle.py:128 | The header-prefix guard has no test that kills its removal | fixed in bada18a4 (a mode change under long/ prefixes, mutant) |
All three readers ran: Argon (gemini-4-argon-high, 12 parts), Muse (muse-wonder-full-1.0), and Astra (gpt-6-astra, twice). Astra's second read found one test gap, now fixed; no code changed, so it was not read a third time.
Checks
At the numbered head, with main merged in up to record 0187:
make checkspasses whole.tests.test_token_needs,tests.test_apply,tests.test_adapters,tests.test_steps,tests.test_hooksandtests.test_approvepass, with the twotests.test_toolstests that failed while the record had no number.- Every mutant of this change is killed by its named test: 124 run by name on the merge at 6b2fbc32, none stale at the numbered head. The merge group runs every shard in full.
- The full
make verifyis CI's, per the Maintainer's rule of 2026-11-09.
š¤ Generated with Claude Code