Repository navigation
Description
Goal: scripts/repo_shape.py's YAML reader reads a block scalar as YAML does, or refuses it by its line, for a header that holds an indentation digit (|2, |1, >-2) and for four layouts it reads otherwise today (|+, a spaces-only line deeper than the block, a leading such line, and a tab line).
Filed by lane openRepoShape-3, from RV974's review of #974 (comment 6271630963).
State. Read at origin/main 6f27432c, and at #974's head dc82a4c4 (open, a draft, found READY by RV974) where it is said. Every row below reads the same at both, so none of it waits on #974. The line numbers are #974's head; at main the same code is _BLOCK_HEADER_RE at :804, _block_scalar_body at :890 (the blank test at :905, the first line's column at :912-913) and _block_scalar_text at :940 (header.endswith("-") at :951).
_BLOCK_HEADER_RE(scripts/repo_shape.py:839) is[|>][-+]?\d*: a header may hold a chomping indicator and a digit, and the reader accepts both._block_scalar_text(:991, called once, with the header) asks the header one thing,header.endswith("-")(:1002). So-strips the last newline only as the header's last character (>-2is not stripped), and+and the digit are read by nothing. The SUPPORTED paragraph (:205-209) says "the-and+chomping indicators accepted and-honoured" and says nothing of the digit._block_scalar_body(:925) takes the first non-blank line's column as the block's (:956-957) and reads every line of only spaces and tabs as blank (:949;_YAML_WHITE = " \t"at:256).- scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening
#ends the block as a comment (#917) #974 adds one rule there (:958-964): a line indented less than the block's first is refused by its line, or ends the block if it opens#. That is all it does with a digit header, sok: |2overaandbis refused by its line and every layout below is read as at main.
What happens. Two groups. In each, this reader returns a text without a word where YAML returns another text or refuses the document. No tool writes a block scalar, so each comes from a hand-written file.
RV974's SHOULD-1, the digit. A header's indentation digit is accepted and never read: the block's column is the first line's. #974 refuses the one document where a later line is shallower than the first, and its body had said the case was "now refused ... and not misread", which is true of that example only. With no line shallower than the first, the digit is still ignored (head against PyYAML 6.0.3; main reads each the same):
k: |2 over " a", " b" -> head {'k': 'a\nb\n'}, PyYAML {'k': ' a\n b\n'}
k: |1 over " a", " b" -> head 'a\nb\n', PyYAML ' a\n b\n'
k: >-2 over " a", " b" -> head 'a b\n' (the `-` is not honoured either), PyYAML ' a\n b'
RV974's second NIT, four layouts that already disagreed with PyYAML at main and still do. Lane 3 wrote each as a document and ran it again at dc82a4c4 and at 6f27432c, with PyYAML 6.0.3 on Python 3.12.3 (parse_yaml over the text, no tool run); the two copies read each the same. Each quoted string is one line of the document after k:, and \t is a tab:
1 k: |+ over " a", "" -> head 'a\n', PyYAML 'a\n\n'
2 k: | over " a", " ", " b" -> head 'a\n\nb\n', PyYAML 'a\n \nb\n'
3 k: | over " ", " a" -> head '\na\n', PyYAML refuses
4a k: | over " a", "\t", " b" -> head 'a\n\nb\n', PyYAML refuses
4b k: | over " a", " \t", " b" -> head 'a\n\nb\n', PyYAML refuses
- 1:
|+is read as clip, so the blank lines it keeps are dropped and one newline stays. With two blank lines andz: 1after, the head reads'a\n'and PyYAML'a\n\n\n'. - 2: a spaces-only line deeper than the block (four spaces in a block of two) is a blank line to this reader and loses the two spaces YAML keeps.
- 3: a LEADING spaces-only line deeper than the first text line is read as blank. PyYAML refuses the document.
- 4a, 4b: a tab-only line, or fewer spaces than the block's column and then a tab, inside a block is read as blank. PyYAML refuses both.
- Not on RV974's list, measured for this issue: spaces to the block's own column and then a tab (
k: |overa,\t,b) is no refusal in PyYAML, which reads the tab as text,'a\n\t\nb\n'; this reader reads'a\n\nb\n'. A rule that refused every line holding a tab would refuse a document YAML reads.
Evidence.
- RV974's review: scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening
#ends the block as a comment (#917) #974 (comment). It found scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening#ends the block as a comment (#917) #974 READY with no MUST, and gave SHOULD-1's fix as either refusing a header that holds a digit or saying this in scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening#ends the block as a comment (#917) #974's body and filing a follow-up issue. Lane 3 takes the second: scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening#ends the block as a comment (#917) #974's body is edited to say it, and this is the issue. The review's second NIT calls the four layouts "Good material for the SHOULD-1 follow-up". - No tracked YAML file uses a digit header or a
+header: the 16 tracked.yamland.ymlfiles at origin/main hold only|and>-headers (git grepover them). No tool writes one; scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening#ends the block as a comment (#917) #974's sweep found no writer that emits a block scalar. tests/test_yaml_reader_spaces.py:1094-1100(scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening#ends the block as a comment (#917) #974's head) pins the one row scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening#ends the block as a comment (#917) #974 refuses,test_an_indentation_digit_is_still_not_read_and_now_refuses. A grep oftests/at that head for a+header and for a digit header finds only that andtests/test_yaml_block_scalar_keys.py:114(the same line at main), which uses>+and|2as headers overtext, where YAML reads'text\n'as this reader does.
Direction.
- The digit. Refuse a header that holds an indentation digit, by its line, in the words of scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening
#ends the block as a comment (#917) #974's other refusals; or read it as YAML does, the digit counted from the parent's column, with PyYAML 6.0.3 as the oracle. Refusing is the smaller change and takes nothing from a project, since no tracked file uses a digit header and no tool writes one. It turns the|2rows oftests/test_yaml_block_scalar_keys.py:114into refusals; reading the digit leaves them as they are. - The four layouts. Make each agree with YAML, or refuse it by its line: (1) honour
+, or refuse it; (2) keep the spaces a spaces-only line holds beyond the block's column; (3) refuse the leading line, as PyYAML does; (4) refuse a tab-only line, and a line of fewer spaces than the block's column and then a tab, and read a tab at the block's own column as text, as PyYAML does. Then make the SUPPORTED paragraph (:205-209) say what was decided. scripts/repo_shape.pyis a pinned copy, so this re-pins every project once. Land it with the next change to that file, for example with validate-repository-naming.py and validate-manifest.py: aSHAPE_PIN_SOURCE_<LINK>that is set and that the run guard passes over, because two products share it, is named by no line, so thedeclared-unverifiedWARNING reads as if none were set #990, and not on its own.
Verify.
- One row per document above in
tests/test_yaml_reader_spaces.py, besidetest_an_indentation_digit_is_still_not_read_and_now_refuses(:1094at scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening#ends the block as a comment (#917) #974's head): the three of SHOULD-1, rows 1, 2, 3, 4a and 4b, and the tab at the block's own column, each read byparse_yamland by PyYAML 6.0.3 under the file'sNEEDS_PYYAMLguard. Where PyYAML reads the document, the two agree, or the row says why this reader refuses it, by its line. Where PyYAML refuses it, this reader refuses it by its line. - The 16 tracked
.yamland.ymlfiles read as before (they hold only|and>-headers).tests/test_yaml_block_scalar_keys.py, the other YAML-reader files in scripts/repo_shape.py: the YAML reader refuses a key written twice in one mapping, block or flow, by the line of the second, and a block scalar line indented less than its first by its line, where it kept the last key and cut the line's first characters; such a line opening#ends the block as a comment (#917) #974's Tests table, the docs guards (tests/test_agents_md_codes.py,tests/test_cli_reference.py,tests/test_update_add_codes_documented.pyandtests/test_repo_hygiene.py),tests/test_no_auto_maintenance.pyandtests/test_pinned_copy_text.pypass, one file at a time under a stubgh.
Size. Small if each layout is refused by its line: one header rule, up to four refusals in _block_scalar_body, and nine test rows. Medium if |+ and the deeper spaces-only line are read as YAML reads them, because _block_scalar_text and _fold_block_body then carry the kept lines.
Lane: openreposhape-3 (openRepoShape-3)
Activity
scripts/repo_shape.py: the YAML reader refuses a key written twice in…
brettheap commentedon Oct 19, 2026
CLAIMED — lane openRepoShape-3, session b30e8b49-f249-4668-adb1-1dbfa93c09e1@Eagle, 2026-10-19T22:26:16Z, for #1004
Logged in
lanes/log/openRepoShape-3.mdat75fb6a72275414f212bf498816433faed0c8e5ff.The three reads (lane-collision-protocol Rule 1):
scripts/repo_shape.py: `_block_scalar_body`'s first-line and shallowe…
scripts/repo_shape.py: `_shallower_line_refusal`'s docstring says a l…