Skip to content

validate-manifest.py and validate-family.py: a line feed, or a character that does not print, in a value no pattern reads is refused by that key's code where it was manifest ok or family ok, and the five keys a person types keep #255's rule (#1205) - #1282

Merged
brettheap merged 5 commits into
mainfrom
l3-1205-unpatterned-values-line-feed
Nov 10, 2026

Conversation

@brettheap

@brettheap brettheap commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What changed

A v1.2.1 fix for #1205, found by lane 5's independent review of #1166 (finding 8, issuecomment-6352173084). It lands under Brett Heap's v1.2.1 merge word (2026-10-23T13:10:26Z) once reviewed and green.

A double-quoted "...\n" in a key no pattern reads was manifest ok or family ok, exit 0. name split the ok line in two. A leg's path so read passed this step and failed make validate two steps later, at validate-pins.py's pin-gitlink-absent. Each such key now gives one finding, under its own code, naming the key, the value and the character:

FINDING manifest-leg-path: leg 'spec': path is 'spec\n', which holds U+000A, a line break, and the value is one line: what prints it is split in two there. Write it on one line.

The rule is lane 3's ruling on the issue (W1205's option B, #1205 (comment)), not isprintable() in every key. The issue's filer raised no objection on the issue after the ruling.

  • Free-text keys. name, elected_by and reference in project.yaml, and name and created_by in family.yaml, refuse what adopt-project.py: since #247 a byte that is not UTF-8 in --elected-by, --reference or the --source directory passes plan and check, and execute pushes both legs before it dies with UnicodeEncodeError in write_lf #255's unwritable_reason refuses (scripts/shape_materialize.py:2891): a line break (CR, U+0085 and U+2028 among them), a lone surrogate, a byte that is not UTF-8, a bidi control or another control character. Both pinned validators get a copy of that rule (UNWRITABLE, read by _held_kind; see "Fix round" below). It uses the standard library only, and a comment names adopt-project.py: since #247 a byte that is not UTF-8 in --elected-by, --reference or the --source directory passes plan and check, and execute pushes both legs before it dies with UnicodeEncodeError in write_lf #255 and where the original lives.
  • Every other key the issue lists refuses what str.isprintable() refuses. In project.yaml that is a spec or code leg's path, shape.repository and shape.digest_algorithm. In family.yaml it is org, the holder's own repository, tracking_branch, shape.repository, shape.digest_algorithm and each member pin's digest_algorithm.
  • Exempt: the adoption records' path and resolution. adopt-project.py writes them with control characters and no-break spaces on purpose; tests/test_manifest_validator.py:802 keeps vendor/nb\xa0sp valid, and a new row keeps vendor/Icon\r and a tab in resolution valid.
  • No second finding. A key whose own check already refuses such a value is not asked again: id, the dates, the repository patterns, tracking_branch and a leg's branch in project.yaml, a name surrogate (tests/test_manifest_validator.py:422 still says "1 finding(s)"), neutral_product_pins and referent_chain. A spec or code leg's path finding is said alone, and so is a family name finding, which is not then classified as well (naming-unclassified).
  • Codes. Each key keeps its code: manifest-name, manifest-reference, manifest-elected-by, manifest-leg-path, manifest-shape-repository, family-name, family-org and family-created-by. So the scaffold's, adoption's and family.py init's refusals still name the flag (scripts/shape_materialize.py:5661, scripts/family.py:3538). Six keys had no code and get one: manifest-shape-digest-algorithm, family-repository, family-tracking-branch, family-shape-repository, family-shape-digest-algorithm and member-pin-digest-algorithm. AGENTS.md names none of the codes beside them, so it does not change, and tests/test_agents_md_codes.py passes.
  • Where. In validate-family.py the rule is in _check_envelope (a new _check_characters, plus the name, org and created_by checks), which is all family.py init asks (scripts/family.py:3603). So --no-members asks it too, and --pins (the lockstep alone) does not.

The issue's U+00A0 rows are dropped for the five free-text keys, on purpose. scaffold-project.py writes name: "Atlas\xa0One" and elected_by: "Ali\u200cReza", and family.py init writes created_by: "Ali\u200cReza". Each is valid today, and isprintable() is false for each. #255 keeps them: a Persian name joins its parts with U+200C. That rule is pinned by tests/test_adopt_template_values.py:658 and :715 and tests/test_bootstrap_spelling.py:311-331. The issue's own rule would refuse manifests the tools write, and a project already scaffolded with such a name would fail validation after update-shape.py brings in the new validator. A line feed is refused in every key, which is the defect the issue names. Refusing U+00A0 there too would overturn #255 and needs Brett Heap's ruling.

Measured, before and after

W1205's probe (probe1205.py: a scaffold and a family.py init, offline, through a stub gh) rewrites each line as a double-quoted value with a trailing \n. It ran on main 2fde6c3 (a detached worktree) and on this head's validators:

project.yaml key main 2fde6c3 this head
name exit 0, manifest ok: Atlas, then (atlas), 3 legs exit 1, manifest-name, 1 finding
reference exit 0 exit 1, manifest-reference
elected_by exit 0 exit 1, manifest-elected-by
spec leg path, code leg path exit 0 exit 1, manifest-leg-path
shape.repository exit 0 exit 1, manifest-shape-repository
shape.digest_algorithm exit 0 exit 1, manifest-shape-digest-algorithm
family.yaml key main 2fde6c3 this head
name exit 0, ok InkRouter, then : family (declared by family.yaml) exit 1, family-name, 1 finding
org exit 0 exit 1, family-org
repository exit 0 exit 1, family-repository
created_by exit 0 exit 1, family-created-by
tracking_branch exit 0 exit 1, family-tracking-branch
shape.repository exit 0 exit 1, family-shape-repository
shape.digest_algorithm exit 0 exit 1, family-shape-digest-algorithm

On both sides, the untouched manifests are exit 0, and so are the values the tools write: name: "Atlas\xa0One", elected_by: "Ali\u200cReza" (manifest ok: Atlas\xa0One (atlas), 3 legs) and created_by: "Ali\u200cReza" (family ok: InkRouter (inkrouter), 0 member(s)). digest_algorithm: banana stays manifest ok (part 3, out of scope below).

Rows

97 new rows. 82 fail on main 2fde6c3, measured with main's two validators swapped in and then restored, each checked with cmp. The other 15 are keep-rows that pass on both sides by design.

tests/test_manifest_validator.py (54):

  • test_a_value_ending_in_a_line_break_is_one_finding_of_its_key: 7 keys x LF and CR, each one finding of the key's code, naming the code point.
  • test_a_value_that_must_print_refuses_what_does_not: 4 keys x U+00A0, TAB and U+202E.
  • test_a_typed_value_refuses_what_255_refuses: 3 keys x TAB, ESC, U+202E and U+2028. Plus test_a_typed_value_holding_a_byte_that_is_not_utf8_is_a_finding for reference and elected_by (\udce9).
  • Keep-rows: test_a_typed_value_keeps_what_255_keeps, 3 keys x U+00A0, U+200C, U+3000 and U+00AD; and test_a_record_keeps_the_characters_the_source_held.
  • The guard (the issue's part 2): test_every_scalar_line_ending_in_a_line_feed_is_refused. It rewrites every scalar line of a scaffolded project.yaml (32), one at a time, as "<value>\n". Each must be refused by name, a finding or a refusal, never exit 0 and never a traceback. A key added to the template that no check refuses fails it by its line.

tests/test_family.py (43):

Mutants

Each was applied, run and restored, and every restore was checked with cmp. All four are killed.

  • M1, validate-manifest.py: the free-text keys asked isprintable() (the issue's rule). 21 failed: every keeps_what_255_keeps row, and the refuse-rows whose words differ.
  • M2, validate-manifest.py: the leg-path rule removed. 11 failed: the spec and code path rows and the sweep.
  • M3, validate-family.py: _check_characters not called from _check_envelope. 25 of 25 selected failed.
  • M4, validate-family.py: the family name finding not said alone (the classifier asked as well). Killed by test_a_typed_holder_value_refuses_what_255_refuses[name-bidi-override] ("1 finding(s)").

Gates

One pytest at a time, on the commit f71c289 (Python 3.12.3, a stub gh first on PATH, GH_TOKEN=bogus, GIT_SSH_COMMAND=false, GIT_CONFIG_GLOBAL=/dev/null):

  • The touched modules: tests/test_manifest_validator.py tests/test_family.py. Result: 314 passed in 160.66s. test_family.py imports only plain helpers from test_commit_trailers and test_update_shape, no fixtures. A first run on the dirty tree failed the three update-shape rows of test_family.py with update-conflict: they compare a holder's copy of validate-family.py with the committed template. On the commit they pass.
  • The guards and the issue's neighbours: tests/test_repo_hygiene.py tests/test_agents_md_codes.py tests/test_git_output_decoding.py tests/test_stdout_encoding.py tests/test_cli_reference.py tests/test_no_auto_maintenance.py tests/test_update_add_codes_documented.py tests/test_bootstrap_spelling.py tests/test_adopt_template_values.py tests/test_pinned_copy_text.py tests/test_link_source_chain_defaults.py tests/test_template_text_placeholders.py. test_pinned_copy_text.py imports the module-scoped pinned fixture, so its owner ran beside it. Result: 889 passed, 3 skipped in 254.78s. The skips: Windows' own default (test_stdout_encoding.py:289), and a session started with GIT_CONFIG_GLOBAL set (test_no_auto_maintenance.py:222, 2).
  • The modules that ask the two changed questions with values the tools write: tests/test_family_init_values.py tests/test_family_init_yaml_words.py tests/test_scaffold_manifest_values.py tests/test_adopt_manifest_values.py. Result: 315 passed, 19 skipped in 185.41s. Every skip is that module's own premise: this template quotes the placeholder.

Merges

git merge-tree --write-tree of this head f71c2897885c59f4216c8cce6802ca6ba3f10ad9:

Fix round

After RV1282's review and SonarCloud's quality gate: two commits on f71c289, pushed as a fast-forward. 6235a0d is the round. e91c57e moves one import so this PR still merges with #1278 without a conflict.

  • SonarCloud's duplication, 12.2% of new lines against 3%. It counted 76 of 623 new lines: validate-family.py:714-740 = validate-manifest.py:861-887 (the copied rule) and tests/test_family.py:1032-1042 = tests/test_manifest_validator.py:1005-1015 (the guard's loop).
    • Each validator keeps its own copy (Pinned shape copies: AGENTS-shape.md's CONTRACTS_DIR sentence is false for every scaffolded root, and the chain WARNING offers remedies the scaffold lacks (one shape bump before the v1.1.0 tag) #610), now as data: UNWRITABLE (each kind's words, with the categories or code points it is), LINE_BREAK and UNPRINTABLE, read by three short functions, _held_kind, _first_held and _held_character. The two copies' code is identical; their docstrings and comments differ, each naming the other copy.
    • The guard's loop is one helper, scalar_lines_not_refused in tests/conftest.py, with SCALAR_LINE.
    • Estimate: 0 duplicated new lines of 709, so 0.0%. The estimate takes a duplicate as SonarCloud does for Python: at least 10 identical lines of tokens holding at least 100 tokens. On f71c289 it gives SonarCloud's own 76 lines and 4 blocks, line for line. Across the repository, it counts at 101, 103 and 107 tokens the runs SonarCloud reports on main, and at 90, 93 and 97 tokens runs it does not. The longest identical run left is the copied data, 91 tokens over 15 lines; the longest in the tests is 32 tokens.
  • S9073, the four composite assertions at tests/test_manifest_validator.py:905, :924, :942 and :955 (f71c289's lines): each is split.
  • RV1282's SHOULD. test_each_copy_of_the_rule_answers_as_255_does loads each validator with load_without_bytecode, as tests/test_assembly_root_unreadable_paths.py:261 does. It asks each copy 24240 values: every code point where the Unicode category changes and the one before it (4007 changes, 6060 code points with the rest), the nine bidi controls, the C0 and C1 controls with the line breaks among them, and lone surrogates. Each is asked alone, between two letters, after an ESC and before a line feed. A typed value must be refused where unwritable_reason refuses it, as the same kind; any other value where str.isprintable is false; and a line break must be the character named. It takes about 0.3 s a copy.
  • RV1282's NIT 1. The way through is said by kind. A line break's finding ends Write it on one line.; any other character's ends Write it without that character. The refuse-rows in both modules now check it.
  • RV1282's NIT 2. One line under "Out of scope".
  • A line break is named first in any value, wherever it is, as adopt-project.py: since #247 a byte that is not UTF-8 in --elected-by, --reference or the --source directory passes plan and check, and execute pushes both legs before it dies with UnicodeEncodeError in write_lf #255 names it. A value held to str.isprintable named its first character that does not print, even one before a line break.
  • Two lines above are corrected to match: the example finding's last sentence, and the copy's name.

The equivalence sweep. RV1282's equiv.py, with only the names changed, compares each copy with unwritable_reason and str.isprintable. It covers all 0x110000 code points in five contexts, 5570560 values per copy. Result for each validator: 0 accept/refuse mismatches, 0 kind mismatches, 0 isprintable mismatches. The copies' code is identical, and the bidi set equals #255's BIDI_CONTROLS.

Rows. Two new: test_each_copy_of_the_rule_answers_as_255_does[validate-manifest] and [validate-family]. The 80 refuse-rows, 40 in each module, now also check the way through. The -k selection is the first round's 97 rows, these 2, and 7 older rows it also picks up: 106 in all.

  • With main 6740776's two validators swapped in: 84 failed, 22 passed. The failures are the first round's 82 and the 2 new rows; the 22 are the 15 keep-rows and the 7 older rows.
  • With f71c289's validators swapped in: 82 failed, 24 passed. The failures are all 80 refuse-rows, since the old way through fits none of their checks now, and the 2 new rows.
  • Each swap was restored and checked with cmp.

Mutants, on 6235a0d, whose validators e91c57e does not change. Each was applied, run over the 106-row selection and restored, and every restore was checked with cmp. All five are killed.

Gates, on the commit e91c57e, one pytest at a time, in the same environment as above:

  • The touched modules: tests/test_manifest_validator.py tests/test_family.py. These are the only two that use the new tests/conftest.py helper. Result: 316 passed in 266.34s.
  • The guards and the issue's neighbours, the same twelve modules as above. Result: 889 passed, 3 skipped in 367.49s, the same three environmental skips.
  • The write-path modules: tests/test_family_init_values.py tests/test_family_init_yaml_words.py tests/test_scaffold_manifest_values.py tests/test_adopt_manifest_values.py. Result: 315 passed, 19 skipped in 286.16s, the same template-quoting skips.
  • The rows with main's and f71c289's validators swapped in, as under Rows.

Merges. git merge-tree --write-tree of e91c57e96e7fa4987e1f8be7a8a7930296ca4678 is clean with each of these:

6235a0d alone conflicted with #1278 in tests/test_family.py, where both edit the conftest import. e91c57e imports the new name on its own line.

Out of scope

Closes #1205

Lane: openreposhape-3 (openRepoShape-3)

🤖 Generated with Claude Code

Summary by Sourcery

Validate previously unchecked manifest and family text values so line breaks and other prohibited characters are reported under the appropriate key-specific finding.

Bug Fixes:

  • Reject line breaks and other disallowed characters in previously unchecked manifest and family values, preventing validators from incorrectly reporting malformed documents as valid.

Enhancements:

Tests:

  • Add comprehensive manifest and family validator coverage for disallowed characters, preserved valid values, single-finding behavior, scalar-line guard sweeps, and equivalence with the materialization rules.

…ter that does not print, in a value no pattern reads is refused by that key's code where it was `manifest ok` or `family ok`, and the five keys a person types keep #255's rule (#1205)

A double-quoted `"...\n"` in `name`, `reference`, `elected_by`, a spec or
code leg's `path`, `shape.repository` or `shape.digest_algorithm` of
`project.yaml`, and in `name`, `org`, `repository`, `created_by`,
`tracking_branch`, `shape.repository`, `shape.digest_algorithm` or a member
pin's `digest_algorithm` of `family.yaml`, passed both gates, exit 0.

Lane 3's ruling on #1205 (issuecomment-6742051321): the keys a person types
(`name`, `elected_by`, `reference`; `name`, `created_by`) are held to #255's
`unwritable_reason`, copied into each pinned validator, so the joiner and
the no-break space the tools write stay valid; the others to
`str.isprintable`. The adoption records' `path` and `resolution` are not
asked, a key whose own check refuses such a value is not asked twice, and
each key keeps its code. Six keys without one get one:
`manifest-shape-digest-algorithm`, `family-repository`,
`family-tracking-branch`, `family-shape-repository`,
`family-shape-digest-algorithm`, `member-pin-digest-algorithm`. In
`validate-family.py` the rule is in `_check_envelope`, which is what
`family.py init` asks.

Rows in tests/test_manifest_validator.py and tests/test_family.py, with a
sweep of every scalar line of a scaffolded `project.yaml` and of a holder's
`family.yaml` as the guard a new key meets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Define the character-classification rule and diagnostics in both validators, including the distinct handling for typed text, line breaks, and non-printing characters.

  • templates/assembly-root/scripts/validate-manifest.py L89-99, L116, L822-908
  • templates/family-root/scripts/validate-family.py L19-29, L205, L780-875

Apply the rule at each affected manifest and family key, preserving existing finding codes and avoiding duplicate checks or findings.

  • templates/assembly-root/scripts/validate-manifest.py L1144-1151, L1254-1261 (+5 small edits)
  • templates/family-root/scripts/validate-family.py L888-891, L915-920, L978-1004 (+3 small edits)

Tests

Add shared scalar-line sweep support and tests for rejected characters, preserved typed text and adoption-record exemptions, finding behavior, and equivalence with the original rule.

  • tests/conftest.py L2732-2766
  • tests/test_family.py L50-53, L904-1046
  • tests/test_manifest_validator.py L9-18, L847-1094

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Brett Heap and others added 2 commits November 9, 2026 16:32
…r that is not a line break says `Write it without that character.`, and each validator's copy of #255's rule is data a row holds to the original (#1205)

PR #1282's fix round, after RV1282's review and SonarCloud's quality gate.

- The way through is said by kind (RV1282's NIT 1). A line break's
  finding ends `Write it on one line.` and any other character's ends
  `Write it without that character.`, where every finding said `Write it
  on one line, without that character.`, which fits only a line break.
- #255's rule, copied into each pinned validator, is data: `UNWRITABLE`
  (each kind's words with the categories or code points it is),
  `LINE_BREAK` and `UNPRINTABLE`, read by three short functions,
  `_held_kind`, `_first_held` and `_held_character`. Each copy is still
  its own (#610). Their code is identical; their docstrings and comments
  differ, each naming the other copy. SonarCloud counted the two copies'
  27 lines as duplicated; the longest identical run of tokens is now 91,
  under its floor of 100.
- A line break is named first in any value, wherever it is, as #255 names
  it. A value held to `str.isprintable` named its first character that
  does not print, even one before a line break.
- Over all 0x110000 code points in RV1282's five contexts (5570560 values
  a copy), each copy answers as `unwritable_reason` and `str.isprintable`
  do: 0 mismatches of verdict or kind.
- `test_each_copy_of_the_rule_answers_as_255_does` (RV1282's SHOULD)
  loads each validator with `load_without_bytecode` and holds its copy to
  `unwritable_reason` over every Unicode category boundary, the nine bidi
  controls, the C0 and C1 controls with the line breaks among them, and
  lone surrogates: 24240 values, under half a second a copy.
- The two guards' sweep is one helper, `scalar_lines_not_refused` in
  tests/conftest.py, with `SCALAR_LINE`: SonarCloud counted the loop's 11
  lines as duplicated.
- The four composite assertions SonarCloud's S9073 named in
  tests/test_manifest_validator.py are split, and the refuse-rows in both
  modules check the way through.

Lane: openreposhape-3 (openRepoShape-3)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… so this PR merges with #1278, which changes the `conftest` import, without a conflict (#1205)

The fix round's commit added `scalar_lines_not_refused` to the
`from conftest import (...)` statement, which PR #1278 rewrites too:
`git merge-tree` of the two heads stopped in conflict there. The name is
imported on its own line after the `test_update_shape` import, clear of
#1278's lines and of #1201's (`from repo_shape import`).

Lane: openreposhape-3 (openRepoShape-3)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-3, 2026-11-09T17:24:09Z) Lane 3's independent review of #1282 (for #1205, v1.2.1) after its fix round, by RV1282 and RV1282c (opus), neither of whom wrote #1282 or its round, at head e91c57e96e7fa4987e1f8be7a8a7930296ca4678: READY, with no MUST and no SHOULD. It lands only after tests passes on this head.

This finishes RV1282's partial review of f71c2897 and reviews the fix round (6235a0dce and e91c57e96). I wrote none of #1282 and none of its round.

Heads, main and CI

RV1282's items on f71c2897, and where each stands now

  • Per-key outcomes (RV1282's probe: 1526 validator runs, 2 passed in 255.77s, measured on f71c2897). These still hold on the head:
    • The round's validator hunks are only the rule block and _held_character. No changed line names _held_finding, _check_characters or report.finding (counted: 0).
    • Over 7,798,784 values a copy, f71c2897 and the head give the same accept or refuse answer every time (see 3 below).
  • Values the tools write (re-measured on the head, end to end): manifest ok: Atlas\xa0One (atlas), 3 legs, and family ok: InkRouter (inkrouter), 0 member(s) both with members checked and under --no-members. Main and f71c2897 say the same.
  • The exemption: the vendor/nb\xa0sp row (test_a_recorded_path_git_records_is_accepted[code-point-escape]) passes on the head inside Gate 1. It is now at tests/test_manifest_validator.py:802 (see NIT 1).
  • The six new codes (f71c2897): unchanged by the round, so RV1282's result stands.
  • Mutant M5 (f71c2897): killed, 6 failed. The code it mutated no longer exists. M13 below is its counterpart on the head.
  • RV1282's SHOULD: fixed by test_each_copy_of_the_rule_answers_as_255_does (see 4 and 5).
  • NIT 1 (the remedy): fixed (see 1).
  • NIT 2: fixed; the Out of scope line is there. Its claim rests on RV1282's measurement on f71c2897, and _check_characters is untouched by the round.

Measured on the head

1. The round's diff, read in full.

  • The rule as data. Each validator now holds UNWRITABLE, a tuple of (words, set) in adopt-project.py: since #247 a byte that is not UTF-8 in --elected-by, --reference or the --source directory passes plan and check, and execute pushes both legs before it dies with UnicodeEncodeError in write_lf #255's order: not UTF-8 (U+DC80 to U+DCFF), Cs, the nine bidi controls, then Cc, Zl, Zp. It also holds LINE_BREAK and UNPRINTABLE. Three functions read the data:
    • _held_kind checks for a line break first, then isprintable for a value nobody types, then UNWRITABLE for a typed one;
    • _first_held names the first line break if the value holds one, and otherwise the first character held;
    • _held_character builds the finding.
  • The remedy follows the kind: Write it on one line. when the kind is LINE_BREAK, and Write it without that character. for anything else.
  • The conftest helper: scalar_lines_not_refused with SCALAR_LINE is the two old loops merged exactly; only validate(project) or validate(holder) became validate(). The two SCALAR_LINE patterns were identical.
  • S9073: the four composite asserts are split.
  • Imports: import re left tests/test_manifest_validator.py, which has no re. use left. tests/test_family.py still uses re.
  • The new row: see 4.

2. Equivalence. I ran RV1282's equiv.py with only the names it calls changed (c/equiv-c.py, built by a script from the original). It covers all 0x110000 code points in the five contexts, on Python 3.12.3 with Unicode 15.0.0.

3. The behaviour change FX1282 reports is right, and it changes no outcome the ruling fixes.

  • Sweep, f71c2897's copies against the head's (c/delta.py): all code points in seven contexts, 7,798,784 values a copy, each asked typed and not typed.
    • Typed values: 0 differ in verdict, in the character named, or in the words. Only the remedy changed, and it follows the kind in every case.
    • Values held to isprintable: 0 differ in verdict. 965,124 name a different character. In every one, the head names a line break (U+000A to U+000D, U+001C to U+001E, U+0085, U+2028 or U+2029) where f71c2897 named an earlier character that does not print.
  • End to end (c/e2e.py, on a copy of RV1282's scaffold and family holder):
  • Pinned by a row: the new row's "a line break first" check. Run on f71c2897's copies through a shim with the new name, it reports 1294 of 24240 answers differ, all of them "a line break first". The head's copies give 0.

4. The new row.

5. Mutants. Each ran over the 106-row selection (FX1282's rows-k.txt) through my c/mutate-c.py. Each was restored, checked with cmp, and the tree was clean after every one. All are killed.

Mutant What changes Result Killed by
M6 (RV1282's) member-pin loop if False: 6 failed member-pin-digest-algorithm x LF, LF --no-members, CR, NBSP, ESC; the holder guard
M7 (RV1282's) family name typed=False 2 failed [name-tab], [name-bidi-override] (as FX1282 says)
M8 (RV1282's), validate-manifest bidi set without U+2066-U+2069 1 failed new row [validate-manifest], "8 answers differ"
M8f, validate-family the same 1 failed new row [validate-family]
M11 (mine), validate-manifest {"Cs"} emptied in UNWRITABLE 1 failed new row only, "8 answers differ" (\ud800)
M12 (mine), validate-family UNWRITABLE order: lone surrogate before not-UTF-8 1 failed new row only, "4 answers differ" (\udc80)
M13 (mine), validate-family a typed line break is not asked first (UNWRITABLE calls it a control character) 7 failed new row, and the 6 name/created_by line-break rows
M14 (mine), validate-manifest with no line break, the last character held is named 1 failed new row only, "15 answers differ"

M8, M8f, M11, M12 and M14 are each killed by the new row alone, so it is what holds each copy's data to #255.

6. The rows (106 = the first round's 97, the 2 new, and 7 older rows the -k also picks up; counted from --collect-only):

  • Head: 106 passed, 210 deselected in 68.84s.
  • Main's validators swapped in: 84 failed, 22 passed, 210 deselected in 61.45s. The 84 are the 80 refuse-rows, the 2 guards and the 2 new rows.
  • f71c2897's validators swapped in: 82 failed, 24 passed, 210 deselected in 57.05s. The 82 are the 80 refuse-rows and the 2 new rows (AttributeError).
  • Both match the body. Each swap was restored, cmp ok, tree clean.

7. Gates on the head as checked out (clean, at the commit), one pytest at a time, through a stub gh, GH_TOKEN=bogus, GIT_SSH_COMMAND=false and GIT_CONFIG_GLOBAL=/dev/null:

  • Gate 1 (tests/test_manifest_validator.py tests/test_family.py): 316 passed in 200.18s. No other module uses the new helper (git grep).
  • Gate 2 (the 12 guards and neighbours): 889 passed, 3 skipped in 278.88s. The skips are test_stdout_encoding.py:289 (Windows' own default) and test_no_auto_maintenance.py:222 x2 (session started with GIT_CONFIG_GLOBAL set).
  • Gate 3 (write-path modules): 315 passed, 19 skipped in 188.02s. The skips are test_family_init_values.py:229 x16 and :301 x3, both "this template quotes...".
  • Before the gates I moved two stray templates/*/scripts/__pycache__ folders, left by RV1282's 14:46 equiv run, into my scratch. A .pyc under templates/ breaks modules that read the templates as text. I used mv, not rm; they are ignored files, not tracked ones.

8. Duplication. The two copies differ only in comments and docstrings (diff of the blocks, and the AST check). That is #610's rule working as intended: each pinned copy carries its own. Behaviour drift in either copy is caught:

  • the typed rule and "a line break first" by the new row;
  • the remedy by the refuse-rows in both modules.

The kind words' tails are not caught: see NIT 2. In the tests the duplicated loop is now one helper. SonarCloud's 0.0% (read by lane 3) is the measurement; I did not re-run cpd.py.

9. Merges. git merge-tree --write-tree of e91c57e96 is clean with everything below, and each tree equals the body's except current main, which the body predates.

Merged with Tree
main ebb87168a (current) 5cb730e1cc94046f8732ee6ccb3b0e108feb927d
main 6740776 7973917da65d49ace0667ea9ae8c68bcb3a71838
#1201 24b6a0a 45e33b5d557f84503271c526f0ce4d47dd2d3656
#1209 13a2c58 0e574daa9ee42825ca698a78fd375de46f2ca5d4
#1227 2d56c19 3bf652884076bae1d1a3073219e90e27818b0f70
#1246 0deac3a a0d3a667732b4dc40d6d155ef2fc1d1cc6996127
#1263 9ef8f0a 8e6799f2dc1f6b0e16f94730986f3ab81188fd94
#1273 0657e39 cc8d530cb66bc334fc6cd168e23b198ab268a9c4
#1278 31f9427 b244928c15c7b001a23b5b37268726d6f9540908

10. The body.

Findings

MUST: none.
SHOULD: none.

NIT 1: four line numbers in the body are f71c2897's. The round's import lines shift tests/test_manifest_validator.py by 2, so on the head:

  • :800 (the vendor/nb\xa0sp row) is now :802;
  • :420 (the name surrogate's "1 finding(s)") is now :422;
  • :46 and :57 (under Out of scope) are now :48 and :59.

The SonarCloud and S9073 numbers in the Fix round are labelled as f71c289's and are right.

NIT 2, optional: the kind words' tails are pinned by no row and not compared between the copies. The words what prints it is split in two there, cannot tell what it holds, which does not print and console can hold appear in no row of the two touched modules. The rows match only each kind's opening words, and the new row only the part before the first comma. A reword in one copy would split the two validators' findings without failing anything. Verdict, kind, the character named and the remedy are all pinned (M8 to M14).

NIT 3: the merges list names main 6740776. Main is now ebb87168a (#1122). It touches none of the PR's files, and the merge is clean, tree 5cb730e1cc94046f8732ee6ccb3b0e108feb927d. One line would bring the list up to date.

Not measured, and paths

  • Not measured:
    • the equivalence sweep under CI's Python 3.14 (Unicode 16); the new row runs there inside tests, which was still pending;
    • a Latin-1 locale (none on this host; RV1282 noted the same);
    • FX1282's M9 and M10 (M13 and M14 cover the same functions);
    • SonarCloud's duplication, which lane 3 read rather than me re-running cpd.py.
  • Adopt is now covered on the head by Gate 2 (test_adopt_template_values.py) and Gate 3 (test_adopt_manifest_values.py).
  • Clone: /workspace/projects/openRepoShape-worktrees/_lane3-scratch/RV1282, detached at e91c57e96, clean, both validators checked with cmp.
  • Scratch: /workspace/projects/openRepoShape-worktrees/_lane3-scratch/RV1282-scratch
    • CHECKPOINT.md, updated: nothing in flight;
    • my scripts and logs in c/: equiv-c.py, delta.py, e2e.py, row-on-prev.py, mutate-c.py, mutants-c.sh, swap-c.sh, chain-c.sh, equiv-new.log, delta.log, e2e.log, mutant-*.log, swap-*.log, each-copy.log, gate-*.log, chain.log;
    • the moved __pycache__ folders in c/pycache-aside/.

I pushed, commented, approved and set nothing, and I wrote nothing outside my clone and scratch.

@brettheap
brettheap marked this pull request as ready for review November 9, 2026 18:40
@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 5 days and 19 hours by commenting @sourcery-ai review. Upgrade to get a review now.

brettheap added a commit that referenced this pull request Nov 10, 2026
…r own premise or read their UTF-8 file as UTF-8, and the 13th, the assembly root bootstrap.py saying it could not create a branch it made, is left failing for its own issue (#1259) (#1278)

 This PR settles 12 of its 13 rows. The 13th row is a tool defect (kind c below), left failing on purpose, and it is now #1283, the issue of its own that #1259's first "Done when" box asks for, so nothing in #1259 is left open.

## Goal

#1259 counts 8 rows of `tests/test_pinned_copy_text.py` and `tests/test_family.py`, and its comment 5 rows of `tests/test_bootstrap_spelling.py`, that fail under a Latin-1 locale and pass under UTF-8. None had a kind. Each is measured here, by test id, into #1214's kinds:

- **a, cannot judge under a one-byte locale (11 rows):** each skips there on its own premise, which the skip reason states.
- **b, the test reads wrongly (1 row):** corrected; it now runs and passes under Latin-1.
- **c, a tool defect a Latin-1 user would meet (1 row):** not fixed, and the row is untouched. The evidence is under "The tool defect".

Main is `42308f26b`, which holds #1258 (the helper `skip_where_the_locale_does_not_spell_it_as_utf_8` and its premise sentences). This branch is one commit on it. It changes three test files and no tool.

## The 13 rows

| # | Test id | Kind | Measured under Latin-1 | Change |
|---|---|---|---|---|
| 1 | `test_pinned_copy_text.py::test_the_variable_the_warning_offers_reads_the_later_link` | a | Exit 0 and no WARNING, as the row asserts. Stdout reads `openXdox \u2192 openYdox \u2192 openInk`: `scaffold-project.py` calls `escape_what_stdout_cannot_encode()` (#214) at the start of `main`, so the arrow is printed escaped by design. | `skip_where_the_locale_does_not_spell_it_as_utf_8("\u2192", PRINTED_AS_ITSELF)`, after the exit and WARNING asserts |
| 2, 3 | `test_pinned_copy_text.py::test_an_unused_pin_source_is_named_spelled[esc]`, `[forged-line]` | a | Exit 0 and no ESC, as asserted. The note reads `not used \u2014 each declared pin ...`. The root's `validate-pins.py` makes a `strict` or `surrogateescape` stdout `backslashreplace` in `_emit_report` (#295), the reconfigure `escape_unencodable_stdout` does, written there because that file imports nothing but `repo_shape`. | the same guard on `"\u2014"`, after the ESC assert |
| 4 | `test_pinned_copy_text.py::test_a_replaced_pin_source_and_its_replacement_are_spelled` | a | The same: both notes read `not used \u2014 the later ...`. | the same |
| 5 | `test_pinned_copy_text.py::test_a_key_read_as_a_path_is_spelled` | a | The same. | the same |
| 6 | `test_pinned_copy_text.py::test_a_printable_pin_source_is_named_as_typed` | a | The same. | the same, after the exit assert |
| 7 | `test_family.py::test_init_writes_the_holders_agent_files` | **b** | `init` writes the holder's `AGENTS.md` as UTF-8 under Latin-1 too: its first line holds `e2 80 94` for U+2014. The row read it with `read_text()`, in the locale's codec, so U+2014 came back as three characters. | its four `read_text()` calls take `encoding="utf-8"` |
| 8 | `test_family.py::test_commit_one_refuses_a_trailer_that_is_no_text_before_it_stages` | a | `os.fsdecode(b"Co-Authored-By: Jos\xe9")` is `...Jos\xe9` (U+00E9), and `_commit_one` commits the trailer as `Co-Authored-By: Jos\xc3\xa9`, the text a Latin-1 terminal typed. Under UTF-8 the same bytes read as `...Jos\udce9`, and `_commit_one` refuses `trailer-not-utf8` with `a.txt` still untracked. The tool is right in both. | `skip_where_the_locale_does_not_spell_it_as_utf_8("Co-Authored-By: Jos\udce9", A_BYTE_READ_AS_A_SURROGATE)`, before the `pytest.raises` |
| 9 | `test_bootstrap_spelling.py::test_a_register_and_its_path_are_spelled_when_it_cannot_be_read` | a | The TEST raises `UnicodeEncodeError` on U+2028 in `os.mkdir`, before any tool runs. | `skip_where_the_environment_cannot_carry("sp\u2028ec")` |
| 10 | `test_bootstrap_spelling.py::test_a_roots_own_directory_name_is_spelled` | a | The test raises in `os.rename` (`shutil.move`). | `skip_where_the_environment_cannot_carry(renamed.name)` |
| 11 | `test_bootstrap_spelling.py::test_a_family_roots_own_directory_name_is_spelled` | a | The same. | the same |
| 12 | `test_bootstrap_spelling.py::test_a_members_row_and_the_make_target_are_spelled` | a | The test raises in `open` (`write_bytes`) of `ta\u2028rget.py`. | `skip_where_the_environment_cannot_carry(target)` |
| 13 | `test_bootstrap_spelling.py::test_a_branch_name_is_spelled_in_every_line_that_names_it` | **c** | The assembly root's `bootstrap.py` makes the branch and then says it could not. See "The tool defect". | none |

**Why rows 9 to 12 take `skip_where_the_environment_cannot_carry`.** The four `UnicodeEncodeError`s that #1259's comment reads are the test's own: `os.mkdir`, `os.rename` and `open` of a name holding U+2028, which Latin-1 cannot encode. The docstring of #1258's helper gives such a row to that guard ("A name the TEST cannot make or pass at all is `skip_where_the_environment_cannot_carry`'s"), as #1258 did for its 18 "a1" rows. Its reason names the encoding and the name, for example `this system's file name encoding (iso8859-1) cannot spell 'At\u2028las'`.

**No tool traceback hides behind them.** I ran both roots' `bootstrap.py` under Latin-1, with the row's `PYTHONIOENCODING=utf-8:strict`, on the manifests those rows had written before they raised: the leg path `"sp\u2028ec"`, the member path `"members/Ir\u2028s"` and the project `"Bo\u2028x"`. Neither printed a traceback. The assembly root printed `[spec] sp\u2028ec: NOT INITIALIZED ...` and `bootstrap ok`, exit 0. The family root spelled both members and ended at its own `family bootstrap FAILED` for the two members whose `make` the probe ran, exit 1.

**The guards ask only of the text their premise is about,** just before the first line that needs it, as #1258's do. The asserts before each guard still judge under Latin-1 (exit code, no ESC, no WARNING). Under UTF-8 no guard skips. Every skip reason states its premise, for example `this locale's encoding (iso8859-1) cannot spell '\u2014': the row reads this character as itself in what the tool prints, and a stdout in this encoding writes it as an escape (#214)`.

## The tool defect (row 13, kind c): not fixed here

**This defect is #1283.** Lane 4 filed it from the evidence below, as #1259's first "Done when" box asks. This PR changes no tool, and row 13 stays failing and untouched until #1283 is mended.

**What a Latin-1 user meets.** Take a project whose `project.yaml` says `tracking_branch: "tb\udcffx"`, the spelling `bootstrap.py` takes for a branch holding the byte 0xFF (#715). Under Latin-1, `make bootstrap` makes that branch in each leg, with HEAD on it at the pin, then prints:

```
  [spec] spec: could not create branch 'tb\udcffx' at the pin f6d8ff445a2d; leaving detached
          `git checkout -b` exited 0, and HEAD is not on the branch at the pin
          nothing else is tried; the recorded pin is authoritative. Deal with what git said and run bootstrap again.
```

Every later run prints `branch tb\udcffx is at the pin f6d8ff445a2d, and git refused to check it out:` with the same two lines, and exits 0. Both claims are false.

**Measured** in the tree the failed Latin-1 run kept, before and after a second run:
- `git symbolic-ref HEAD` in `spec` and in `code` gives `refs/heads/tb\377x`;
- `git rev-parse HEAD` gives the pin, `f6d8ff44...` and `ce229835...`, which equal `git rev-parse HEAD:spec HEAD:code` in the root.

Under UTF-8 and ASCII the same manifest gives `branch tb\udcffx created at <pin>` and, on the next run, `on tb\udcffx at <pin> (branch tip == pin)`. The row passes in both.

**The code at fault** (`templates/assembly-root/scripts/bootstrap.py`, at main `42308f26b`; on `2fde6c3d0` the same lines are :841, :857, :922, :1505 and :1755):
- `_head_of` (:782) returns HEAD's ref as `os.fsdecode(ref.rstrip(b"\r\n"))` (:798). Its docstring says such a name "reads back as the `refs/heads/<branch>` built from the same name". That holds only where `os.fsdecode(os.fsencode(name)) == name`.
- Under Latin-1, `os.fsencode("tb\udcffx")` is `b"tb\xffx"` (surrogateescape), which is what git is handed. `os.fsdecode(b"tb\xffx")` is `"tb\xffx"` (U+00FF), not `"tb\udcffx"`.
- So the text comparisons of `(pin, f"refs/heads/{branch}")` with `_head_of(sub)` fail with HEAD on the branch:
  - the creation step, `if _head_of(sub) != (pin, f"refs/heads/{branch}")` (:1696), which prints `could not create branch` (:1698);
  - `_check_out`, `if _head_of(sub) == (pin, f"refs/heads/{branch}")` (:863), which returns "`git checkout` exited 0, and HEAD is not on the branch at the pin" (:866), and its caller prints "git refused to check it out" (:1446).

## Runs

The commands, the environment and the logs are W1259's. Pytest is `/usr/bin/python3 -m pytest -p no:cacheprovider` on Python 3.12.3. The environment for every run:
- a stub `gh` first on PATH, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`;
- `GIT_CONFIG_GLOBAL` an empty file, `GIT_CONFIG_NOSYSTEM=1`, the test identity, `EMAIL` set;
- `GIT_ALLOW_PROTOCOL`, `GIT_SSH_COMMAND` and `LANES_*` unset;
- git-filter-repo 2.47.0 (`a40bce548d2c`, pip launcher) first on PATH.

The locales:
- UTF-8 is `LC_ALL=C.UTF-8`.
- Latin-1 is built with `localedef -c` as #1153's `test_adopt_one_byte_locale.py` builds one, then `LOCPATH`, `LC_ALL=en_US.ISO-8859-1`, `PYTHONUTF8=0`. Python reports `iso8859-1`.
- ASCII is `LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0`.

**The gate: 22 test files, on main `42308f26b` and on this head.** They are:
- the three files of the 13 rows;
- the other 14 test files #1258 changed;
- `tests/test_adopt_one_byte_locale.py`;
- the 4 more test files that use a name this PR calls (`skip_where_the_locale_does_not_spell_it_as_utf_8`, `PRINTED_AS_ITSELF`, `A_BYTE_READ_AS_A_SURROGATE`, `skip_where_the_environment_cannot_carry`): `test_adopt_git_reads.py`, `test_non_utf8_git_failures.py`, `test_non_utf8_git_reads.py`, `test_non_utf8_oserror_sites.py`.

The 71 other test files that import from one of the three changed files were collected in each locale, on main and on the head. Each run collects 3782 tests with no error, and the per-file counts are identical.

| Run | main `42308f26b` | this head |
|---|---|---|
| 22 files, Latin-1 | 35 failed, 1144 passed, 87 skipped | 23 failed, 1145 passed, 98 skipped |
| 22 files, UTF-8 | 1265 passed, 1 skipped | 1265 passed, 1 skipped |
| 22 files, ASCII | 52 failed, 1120 passed, 94 skipped | 41 failed, 1121 passed, 104 skipped |
| the three files, Latin-1 | 13 failed, 394 passed | 1 failed (row 13), 395 passed, 11 skipped |
| the three files, UTF-8 | 407 passed | 407 passed |
| the three files, ASCII | 27 failed, 380 passed | 16 failed, 381 passed, 10 skipped |

**By test id, from main to the head:**
- **Latin-1:** 12 rows change, and nothing else: rows 1 to 6 and 8 to 12 go from failed to skipped, and row 7 from failed to passed. No row goes from passed to failed or to skipped. Each of the head's 23 failures fails on main too: row 13, and 22 rows in other files of the gate, which are not among #1259's 13 (see "Left").
- **UTF-8:** nothing changes. The one skip is `test_stdout_encoding.py`'s Windows default-stdout row, on both.
- **ASCII:** 11 rows change, and nothing else: 10 go from failed to skipped and row 7 from failed to passed. Rows 8 and 13 pass under ASCII on main and still do. No row goes from passed to failed or to skipped.

**#1259's "Done when", on a scratch merge.** The merges are main `42308f26b` with #1209's head `13a2c58cb` (`bad3de928`), then with this head (`20fcb11e1`). Both are local, never pushed, and both merged clean.

| Run | main + #1209 | main + #1209 + this head |
|---|---|---|
| `test_pinned_copy_text.py` and `test_family.py`, Latin-1 | 8 failed, 192 passed | **0 failed**, 193 passed, 7 skipped |
| the same two, UTF-8 | 200 passed | 200 passed |
| the same two, ASCII | 23 failed, 177 passed | 16 failed, 178 passed, 6 skipped |
| with `test_bootstrap_spelling.py`, Latin-1 | 13 failed, 394 passed | 1 failed (row 13), 395 passed, 11 skipped |
| with `test_bootstrap_spelling.py`, UTF-8 | 407 passed | 407 passed |
| with `test_bootstrap_spelling.py`, ASCII | 27 failed, 380 passed | 16 failed, 381 passed, 10 skipped |

By test id on the merges: UTF-8 changes nothing; Latin-1 and ASCII change exactly the rows above. The 16 ASCII failures are not among the 13, and fail on main + #1209 as well (see "Left").

**Main moved after these runs**, to `2fde6c3d0`. That commit makes both roots' `bootstrap.py`, `validate-family.py` and `siblings.py` refuse `git-repo-unreadable` where the root's `.git` cannot be read, and changes `tests/test_validate_family_unreadable.py` (one of the 71 files collected above) and adds `tests/test_pinned_root_git_unreadable.py`. It touches none of this PR's three files, and `git merge-tree` of this head with it is clean. The runs above were not repeated on it. Main then moved again, to `674077657` (#1120, `adopt-project.py`). RV1278 re-ran a 20-file gate (the three files, #1258's other 14 test files, `test_adopt_one_byte_locale.py` and #1172's two test files) on a scratch merge of this head with `674077657`: Latin-1 20 failed, 1142 passed, 84 skipped (main: 32 failed, 1141 passed, 73 skipped); UTF-8 1245 passed, 1 skipped on both; ASCII 41 failed, 1124 passed, 81 skipped (main: 52 failed, 1123 passed, 71 skipped). By test id only the rows above change, and every remaining failure fails on main too.

## Mutants

Each mutant was applied in a scratch worktree at the head, inside the one test function named. Its row ran under Latin-1 and ASCII. The file was then restored from HEAD and its sha256 checked equal; all 14 were.

| Mutant | Row | Latin-1 | ASCII |
|---|---|---|---|
| M1: the `PRINTED_AS_ITSELF` guard dropped | 1 | **1 failed** | 1 failed |
| M2: the same | 2, 3 | **2 failed** | 2 failed |
| M3: the same | 4 | **1 failed** | 1 failed |
| M4: the same | 5 | **1 failed** | 1 failed |
| M5: the same | 6 | **1 failed** | 1 failed |
| M6: the `A_BYTE_READ_AS_A_SURROGATE` guard dropped | 8 | **1 failed** | 1 passed: ASCII reads 0xE9 as U+DCE9, so the guard does not skip there and the row judges |
| M7: `AGENTS.md` read in the locale's codec again | 7 | **1 failed** | 1 failed |
| M8: the first read of `AGENTS-shape.md` in the locale's codec | 7 | 1 passed | **1 failed** (`UnicodeDecodeError`) |
| M9: the second read of `AGENTS-shape.md` the same | 7 | 1 passed | **1 failed** |
| M10: the read of `CLAUDE.md` the same | 7 | 1 passed | 1 passed |
| M11: the `skip_where_the_environment_cannot_carry` guard dropped | 9 | **1 failed** | 1 failed |
| M12: the same | 10 | **1 failed** | 1 failed |
| M13: the same | 11 | **1 failed** | 1 failed |
| M14: the same | 12 | **1 failed** | 1 failed |

- **M8 and M9 survive under Latin-1, as expected.** Latin-1 decodes every byte, and the text those two reads are checked for is ASCII. They are killed under ASCII, where #1259 asks the run to be looked at, and where the row now passes.
- **M10 is equivalent in every locale.** `CLAUDE.md` is the 16 ASCII bytes `Read AGENTS.md.\n`, which every codec reads alike. It is changed with the other three, so the row reads every file `init` wrote in one way.

## Merge-trees

`git merge-tree --write-tree` of this head is clean against:
- `origin/main` `42308f26b`;
- #1209 `13a2c58cb`;
- #1282 `f71c28978` (checked by RV1278 on 2026-11-09);
- the two open PRs that touch these files: #1201 `24b6a0af6` (`tests/test_family.py`) and #1171 `8162b874e` (`tests/test_pinned_copy_text.py`).

Neither of those two changes a row this PR touches. #1201's hunks are at an import and `test_add_refuses_a_spelling_of_a_member_the_family_already_pins`; #1171's are at `PINNED_IMPORTERS`.

## Left, and outside this issue

- **Row 13's tool defect**, above. It is #1283, the issue of its own that lane 4 filed for it. Once #1283 is mended, the row passes under Latin-1 as it is written.
- **Under ASCII, 16 rows of the two files still fail,** on main and here alike. #1259 asked that this run be looked at. None of these rows is among the 13, and each passes under Latin-1 and UTF-8. Read from their failure messages only:
  - 15 rows of `tests/test_family.py` read a UTF-8 file the tool wrote (`family.yaml` and others) with `read_text()` and no encoding, and end in `UnicodeDecodeError`: row 7's kind b. They are `test_init_copies_the_siblings_utility_and_the_makefile_target`, `test_the_holder_says_what_its_bytes_are`, the five `test_validate_finds_*` and `test_validate_accepts_*` rows, three `test_bump_*` rows, three `test_update_shape_*` rows, `test_no_members_still_finds_an_edited_copy` and `test_siblings_skips_a_clone_whose_project_id_is_not_the_rows`.
  - `tests/test_pinned_copy_text.py::test_a_printable_pin_source_that_is_not_a_repository_is_named_as_typed[caf\xe9]`: the test itself cannot make `caf\u00e9` under ASCII (`os.mkdir` raises `UnicodeEncodeError`), rows 9 to 12's kind.
- **22 other Latin-1 failures in the gate's other files** fail on main and here alike, and are not #1259's. They are 12 rows of `test_clone_url_bytes.py`, 2 each of `test_family_member_branch_not_utf8.py`, `test_non_utf8_git_reads.py` and `test_stdout_encoding.py`, and one each of `test_adopt_git_reads.py`, `test_adopt_pins.py` (`[not-utf-8]`), `test_adopt_template_values.py` and `test_bootstrap_leg_moves.py`. They were not run on the merge with #1209.

Closes #1259

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap merged commit b607223 into main Nov 10, 2026
5 checks passed
@brettheap
brettheap deleted the l3-1205-unpatterned-values-line-feed branch November 10, 2026 10:22
brettheap added a commit that referenced this pull request Nov 10, 2026
…git` this user cannot read is pinned `source-unreadable` in `check` and `execute`, never `source-partial-clone`, with no `gh` call and no `upload-pack` run (#1262) (#1289)

Pin, in `tests/test_adopt_partial_clone_source.py`, that a partial clone whose recorded `.git` this user cannot read is refused `source-unreadable`, naming that `.git`, and never `source-partial-clone`, in `check` and `execute` alike, with no `gh` call, no `upload-pack` run and no remotes directory made. RD1141's NIT-1 on #1141 (for #1099) asked for it, and #1262 is that follow-up.

**This is a test gap only, and the behaviour is right.** The PR changes one file, `tests/test_adopt_partial_clone_source.py` (+117 -15). No production file, refusal code, remediation or doc changes. Milestone v1.2.1, as #1262.

`Plan._recorded_source` (reached through `open_source`) asks `_git_refused(path)` ahead of everything that reads the clone (`adopt-project.py:7064` at `4552efa6a`), in `check` and `execute` alike, and `_refuse_a_partial_clone_short` runs after the source is opened. #1141's 9 refused-by-name rows (`tests/test_adopt_unreadable_clone_git.py`) build a plain clone, and this file's rows build partial clones with a readable `.git`: no row built a partial clone whose `.git` is at mode 000. RD1141's probe (not in the repository) measured 16 such rows at `0b8fb320`, all `REFUSED source-unreadable` naming `<it>/.git`, none `source-partial-clone`, with 0 `gh` calls and 0 `upload-pack` runs. RD1141 measured why a reorder cannot flip that answer: through a `.git` at mode 000 `_promisor_remotes` is `[]` and `_objects_lacking` is `None`, where they are `['origin']` and 28 while it is readable, so the partial-clone rule's own questions see nothing there. What no row pinned is a change that left such a clone to that rule.

In `tests/test_adopt_partial_clone_source.py`, reusing `Source`, `made` and `planned_once`, and `needs_a_mode`, `recording_gh`, `at_mode_000`, `the_refusal` and `CURES` from the files that own them (functions only, no fixture is imported):

- `test_a_partial_clone_whose_recorded_git_is_unreadable_is_source_unreadable`: **16 rows**, `[nocheckout|checkout]-[check|execute]-[given|cloned]-[directory|file]`. Each makes a `--filter=blob:none` clone (with a checkout, and with `--no-checkout`; `source.lacking() > 0` is asserted), records it as the plan's `source.local_path` (`cloned` false, or `source.cloned: true` with a `source.repository`), makes its `.git` a directory or a `gitdir:` file (`git clone --separate-git-dir`), and puts that `.git` at mode 000 for the `with` (`at_mode_000`: the mode is asserted to bite and is given back in a `finally`). It skips as root and on Windows (`needs_a_mode`). It asserts:
  - exit 2 and `the_refusal(...)` in stderr: `REFUSED source-unreadable: the .git in the plan's source.local_path, <path>/.git: cannot be read (Permission denied), so ... cannot be told`, with the cure for a directory or for a file (`CURES[kind]`);
  - `source-partial-clone` in neither stream, and no `plan ok`;
  - the `gh` log from `recording_gh` empty (no `gh` call);
  - no remotes directory;
  - `source.untouched()`: no `upload-pack` ran, and `objects/` hashes as it did before.
- `test_the_same_partial_clones_with_a_readable_git_are_source_partial_clone`: **8 control rows**, `[nocheckout|checkout]-[given|cloned]-[directory|file]`, `check` only. The same clones with a readable `.git` are refused `source-partial-clone` with its cure, never `source-unreadable`, with no `gh` call and nothing fetched. They show the 16 rows read the `.git`'s mode and not a clone the rule would let by. They run as root and on Windows too.

The helpers, none of which changes an existing row: `Source` takes `apart` (the git directory beside a `.git` file); `objects_dir(path)` finds `objects/` through that file (a function of the path alone, because `tests/test_adopt_plan_partial_clone.py` calls `Source.store(SimpleNamespace(path=...))`); `check` and `execute` take an `env`; `recorded_as_a_clone` is the `cloned` edit `at_the_side_commit` made inline, made alone and called from there. `tests/test_adopt_plan_partial_clone.py` reuses `Source`, `made` and `planned_once`, and keeps its outcomes (run G below). No assert joins conditions with `and` or `or`.

The detached tree `n1262-mut` at main `4552efa6a`, this branch's test file, `adopt-project.py` and `docs/cli.md` (#1141's two production files) taken from `26cc80bd2^`, then restored and compared by sha256 (`adopt-project.py` `eb5f181b...` at the base, `a8f76e66...` before #1141). `-k "unreadable or readable_git"`, git 2.43.0: **16 failed, 8 passed.**

| rows | before #1141 | at the head |
|---|---|---|
| the 8 `given` rows (2 clones x 2 verbs x 2 kinds) | 8 fail: `REFUSED git-failed` (`git rev-parse --is-inside-git-dir` says not a git repository), no `gh` call | pass |
| the 8 `cloned` rows (the same 8) | 8 fail: `gh repo clone testorg/Elsewhere` asked, `REFUSED source-unclonable` | pass |
| the 8 control rows (readable `.git`) | pass | pass |

This is what RD1141 measured for the same 16 rows on main `b66d8f0cc`.

Each applied alone to `adopt-project.py` in `n1262-mut` at `4552efa6a`, the 24 rows run, and the file restored and compared by sha256 each time (script `mutate.py`; the control rows pass in every run).

| mutant | the change | rows failed |
|---|---|---|
| RD1141's MR4 | `refused = _git_refused(path) if there else None` becomes `refused = None` | **16 of 16** |
| the guard asked after the `cloned: false` branch has read the clone | the three guard lines moved below that branch, before `_not_a_whole_clone` | **8**: the 8 `given` rows (`git-failed` from `_top_level`); the `cloned` rows still reach the guard |
| extra: a `.git` file left unguarded | `a_file = False` in `_git_refused` | 8: every `file` row |
| extra: a recorded clone left unguarded | the guard asked only where `source.cloned` is not `true` | 8: every `cloned` row |

No survivor. The two named in #1262 are killed, and each axis of the 16 rows (directory or file, given or cloned) carries a mutant of its own.

Head `2e0d2d237`, Python 3.12.3, git-filter-repo 2.47.0 (`tools/venv247`), through `run10.sh` (a stub `gh` first on PATH that refuses and logs every call, `GH_TOKEN=bogus-l5`, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null`), at most 100 tests a run, `-rs` alone. Each ran on git 2.43.0 and on git 2.47.1 (`tools/git247/bin/git`, `git --version` printed first in each log):

| run | files | rows | 2.43.0 | 2.47.1 |
|---|---|---|---|---|
| A | `test_adopt_partial_clone_source.py`, `test_adopt_unreadable_clone_git.py`, `test_adopt_unenterable_source_and_locale.py` | 93 | 93 passed | 93 passed |
| G | `test_adopt_partial_clone_source.py` and `test_adopt_plan_partial_clone.py` in one pytest (the second imports the first's fixtures) | 77 | 77 passed | 77 passed |
| B | `test_agents_md_codes.py`, `test_cli_reference.py` | 70 | 70 passed | 70 passed |
| C | `test_pinned_copy_text.py` | 87 | 87 passed | 87 passed |
| D | `test_no_auto_maintenance.py` | 60 | 58 passed, 2 skipped | 58 passed, 2 skipped |
| E1, E2 | `test_path_guard_hygiene.py` in two halves | 61 + 60 | all passed | all passed |
| F1, F2 | `test_repo_hygiene.py` in two halves | 51 + 50 | all passed | all passed |

The only skips, named: `tests/test_no_auto_maintenance.py:222` x2 on each git, "the session began with GIT_CONFIG_GLOBAL set, and its file includes that one". Run G first failed 10 rows on an earlier head `cd8b4f3fe` (a `git_dir` attribute `Source.store(SimpleNamespace(path=...))` does not have); `objects_dir` replaced it and every run above was repeated at `2e0d2d237`.

Pre-test of the merge: the predicted merge of the head into main `9cb156a98` (`85f8744b4`, a local commit never pushed), git 2.43.0: G 77 passed, and `test_adopt_unreadable_clone_git.py` with `test_adopt_unenterable_source_and_locale.py` 31 passed.

**Refreshed on 2026-11-10 at 12:19Z as `305021ef3`**: one merge of main `3add78e1c` into the reviewed head `2e0d2d237`, made by `gh pr update-branch`. The old head's `tests` run had failed only on #1189's 13 rows in `tests/test_adopt_symlink_target_bytes.py`, which #1293 fixed on main. A re-run would have tested the stale merge again. CI's `tests` runs on the refreshed head, and lane 5's pilot gates the predicted squash again at this PR's turn.

`git merge-tree --write-tree` at the refreshed head `305021ef3`, heads read fresh at 12:23Z (27 open PRs). No other open PR touches `tests/test_adopt_partial_clone_source.py` or `tests/test_adopt_plan_partial_clone.py`. Against the PR's base the head changes one file, `tests/test_adopt_partial_clone_source.py` (+117/-15).

| against | result |
|---|---|
| main `3add78e1c` | clean, tree `8327064c7`, the head's own tree (the head holds main) |
| #1210 (`791106c2b`, 16th) | clean, tree `00f6a02ac` |
| #1194 (`fix/1129-github-name-limits`, `906172b41`, 17th) | clean, tree `b0eac8e04` |
| #1209 (`fix/1196-paths-spelled-locale-and-env`, `13a2c58cb`) | add/add conflict in `tests/test_adopt_plan_paths_spelled.py`, a file this PR does not touch; the same conflict arises between #1209 and main alone |

The earlier rows (main `3ee5bb4d9` and `9cb156a98`, and #1282, which has landed as `b607223b4`) are superseded by this table (rv1289's NIT 1).

Review: rv1289, lane 5's independent opus reviewer, which wrote none of #1289: READY at `2e0d2d23`, with no MUST or SHOULD (issuecomment-6752563658); its NIT 1 (stale merge lines in the body) was taken by the coordinator at 12:24Z, and NIT 2 is optional. Refreshed on 2026-11-10 at 12:19Z as `305021ef` (one merge of main `3add78e1` into H0 `2e0d2d23`), because H0's `tests` failed only on #1189's 13 rows that #1293 fixed; `305021ef` is H0 of this landing once its checks pass. CI (Brett Heap's ruling 27): H0 is the head 305021e itself, which passed tests, tests-git-bash and SonarCloud; main has touched none of its files since its base 3add78e; and the local gate passed on its predicted squash tree 54e3742 over main 3ffe75b: the adopt_partial_clone_source, path_guard_hygiene, pinned_copy_text, no_auto_maintenance, repo_hygiene, agents_md_codes, cli_reference sets, 499 passed, 2 skipped. Landed on Brett Heap's word of 2026-10-23T13:10:26Z, relayed to every lane by lane 3 (#473 issuecomment-6365697123): "merge v1.2.1 PRs once reviewed and green".

Closes #1262

Lane: openreposhape-5 (openRepoShape-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant