Repository navigation
Description
Lane: openreposhape-2 (openRepoShape-2)
PR #152 ("update-shape.py apply now moves the README's trailing Shape: <repo> @ <sha>. line in the same commit as the pin it names, so a holder's README stops drifting from contracts/shape-pin.yaml", merged as b83ba5c) went through seven Copilot rounds. The eighth round, on head 7f25e14, surfaced three more findings, but the lane's brief caps a PR at three review rounds on one head before it must report back rather than keep chaining. All four checks were green and every earlier thread was answered at 7f25e14, so on Brett Heap's word "land 152 when it reports, then re-pin" the PR landed with these three recorded here rather than held open for a further round. None of the three was taken; this issue is the record of them and the place to take them.
What is wrong
-
shape-doctor.py:1030-1033— thebehind_pin_onlyfinding's reason text is self-contradicting in the one case it exists for. When no copied file differs but the pin names an older commit, the row says"no copied file differs, but the pin names an older commit, so \apply` would move the pin alone; {summary} ({where}){note}". The trailing{note}(fromreadme_shape_note) is appended unconditionally, and when the README carries its own trailingShape:line that note saysapplywill *also* rewrite the README — so the row claims in one clause thatapplymoves the pin "alone" and in the next that it moves the README too.update-shape.py checkhad exactly this defect and baa77d0 fixed it (making the "alone" clause conditional on whether the note fires); the doctor's copy of the same wording was missed and still reads the old way on main. It matters because the doctor'sNEXTguidance is what an operator reads before runningcheck/apply`, and a self-contradicting reason line undercuts the very feature A scaffolded README's trailingShape: … @ <sha>line is never rewritten by update-shape.py, so it drifts silently from contracts/shape-pin.yaml — InkRouter's holder reads 6fe09a4 four re-pins after the fact #148/update-shape.py apply now moves the README's trailingShape: <repo> @ <sha>.line in the same commit as the pin it names, so a holder's README stops drifting from contracts/shape-pin.yaml (#148) #152 added. -
update-shape.py:1884-1886(cmd_apply) —_rewrite_readme(line 1886) runs after_write_copies(line 1884), and.gitattributesis one of the digest-pinned copies_write_copieswrites._rewrite_readmecallsreadme_is_committed()(update-shape.py:1123insideReadmeShapeLine.state, using the helper defined atupdate-shape.py:960), which asksgit status/git hash-objectquestions that are answered against attributes read from the working tree. So an upstream change to.gitattributes— e.g. atext=autorule changing — is already on disk by the time the README's commit-state question is asked, even though nothing about the README itself changed. A README that would have readuncommitted-clean under the old attributes can readuncommitted-dirty under the new ones (or vice versa) purely because of copy ordering, andapplythen silently leaves that root's staleShape:line alone or rewrites it, for a reason that has nothing to do with the README. The classification_rewrite_readmeneeds (root, repository, target) is known before the first byte is copied, so reading the README's state before_write_copiesruns looks like the right fix in principle — but it moves a phase inside a command whose rollback (Rollbackledger) is ordered around "copies, then pin, then README", and no existing fixture exercises an upstream.gitattributeschange landing in the sameapplyas a README rewrite, so the fix needs a new test built first rather than a blind reorder. -
update-shape.py:1102-1104(ReadmeShapeLine.state) — theUnicodeDecodeErrorarm (self.text = self.path.read_bytes().decode("utf-8")at 1102,except UnicodeDecodeError: return README_UNREADABLEat 1103-1104) has no deterministic test.tests/test_update_shape.py::test_a_readme_the_os_will_not_read_is_a_reading_rather_than_a_traceback(around line 1465) covers the siblingexcept OSErrorarm right below it, using thedenied()helper (tests/test_update_shape.py:1418-1432) to chmod the README unreadable — but that helper explicitlypytest.skip()s when the current user isn't stopped by the permission bits (root, or a filesystem mounted without them, or Windows), so that test is non-deterministic by design. A README written as invalid UTF-8 bytes needs no privilege and skips nowhere on any platform, so it is a cheap way to get deterministic coverage of theREADME_UNREADABLEpath that the OSError test cannot always provide.
What would fix it
-
Make the
behind_pin_onlyreason's "would move the pin alone" clause conditional on whethernoteis empty, the same shape as baa77d0's fix toupdate-shape.py check: whenreadme_shape_notereturns a non-empty note (the README has its own trailingShape:line that would also move), drop or rephrase the "alone" wording so the row does not claim two things at once; whennoteis empty, the existing wording still holds. A small, self-contained diff aroundshape-doctor.py:1030-1033, with a test asserting the row's text agrees with the note in both cases (mirroring whatever test protectsupdate-shape.py check's baa77d0 fix). -
Build a fixture where an
applycopies an upstream change to.gitattributes(e.g. atext=auto/eol=change) in the same run that would also rewrite a target root's READMEShape:line, and use it to pin down current behavior before changing anything. Then move the README's commit-state read (thereadme_is_committed()call insideReadmeShapeLine.state) to before_write_copiesruns incmd_apply— snapshotting the classification (root, repository, target are all known up front) rather than reading it after the copies land — while keeping the actual README rewrite itself in its current place in theRollbackledger ordering (after the pin move, before the validators), so rollback semantics are unchanged. Land the fixture and the reorder together so the ordering hazard has a regression test. -
Add a test that writes
README.mdas invalid UTF-8 bytes (a renderedShape:line's bytes with one byte corrupted, or any non-UTF-8 byte sequence) and asserts the same three things the other left-alone READMEs are already asserted for:applyreportsunreadable(or the doctor's equivalent wording) rather than raising, the file's bytes are untouched, and the file is absent from the commit. Place it besidetest_a_readme_the_os_will_not_read_is_a_reading_rather_than_a_tracebackintests/test_update_shape.py, without adenied()-style skip since no privilege is needed to write invalid UTF-8.
Activity
brettheap commentedon Sep 13, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-13T02:45Z) CLAIMED — session b92f33f0, on Brett Heap's word 'pick up 157 and 158, fan out'. Branch fix/readme-shape-line-followups, worktree ~/projects/openRepoShape--i158-readme-followups on Eagle, from origin/main b83ba5c. Scope: all three findings — the doctor's
behind_pin_onlyreason wording, the README classification snapshot before_write_copieswith the.gitattributesfixture that proves the ordering hazard, and a deterministic invalid-UTF-8 test for theREADME_UNREADABLEarm.brettheap commentedon Sep 13, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-13T03:2xZ) PULL REQUEST OPEN: #159 (head 3f4bade).
brettheap commentedon Sep 13, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-13T04:0xZ) READY FOR REVIEW: #159, head 9eae223 (origin/main 511e9c2 merged in after #154 landed; never rebased). All four checks green on that head — tests (ubuntu) 3m19s, tests-macos 7m15s, tests-windows 15m32s, SonarCloud pass. PR-scoped Sonar quality gate OK on every condition, 0 new issues, 0 security hotspots, 0.0% duplication. Copilot round 1 on 3f4bade: "Approval recommended", 0 comments, 0 inline threads — nothing to reply to and nothing declined; Codex: "Didn't find any major issues" on 3f4bade; Sourcery: over its 7-day budget, but its guide marks all three of this issue's objectives addressed. Suite from the worktree: 1189 passed / 1 skipped (1185/1 on main plus the three tests added here). No digest-pinned file is touched, so no estate re-pin is owed by this PR. One deliberate departure from finding 1's "what would fix it", argued in the PR body and the commit: the "alone" clause is settled against the TARGET (the question
update-shape.py checkasks, and the one baa77d0 answered there) rather than against whether the note is empty — the note weighs the line against the PIN, so the commonest holder re-pin of all (a README naming its own pin, both behind) draws no note and is rewritten anyway, and a note-conditional fix would have left the false promise standing in exactly that case. Not merged: the orchestrator lands it.The doctor's behind-pin row, `apply`'s README phase order and the cla…
brettheap commentedon Sep 13, 2026
(lane openreposhape-2 (openRepoShape-2), 2026-09-13T03:50:42Z) MERGED — #159 → ba14e1d (squash), on Brett Heap's word 'land 157 and 158 when they report, then re-pin'. the three findings PR #152's round cap left untaken (#158): the doctor's behind_pin_only row derives its 'would move the pin alone / and the README' clause from what a re-pin would actually move against the TARGET, so the row and the README note can no longer contradict; apply classifies the README BEFORE _write_copies lands a pinned .gitattributes change, so an upstream attributes change can no longer decide a README's fate mid-run (fixture first, rollback order unchanged); a deterministic not-valid-UTF-8 README test no platform can skip; Copilot approved, Codex clean; 1189 passed / 1 skipped; no pinned file. Object complete.