Repository navigation
adopt-project.py: check finds, and execute refuses before any leg exists, a kept root path where the shape writes a directory or its shape/ copy, whether the disk keeps case or not; the materializer never writes over a copy (#262, #263) - #313
Conversation
… exists, a path the plan keeps in the root where the shape writes, a plain file at `.github`, `contracts` or `scripts` or the source's own path at a copy under `shape/`, and the materializer never writes a copy over what is there, so a real `shape/README.md` is no longer overwritten under "nothing was overwritten" and neither case ends in a traceback after both legs are pushed (#262) (#263) `check` said `plan ok` to a plan that keeps, in the assembly root, a FILE where the shape needs a directory (#263: a source file named `.github`, `contracts` or `scripts`) or the source's own `shape/` (#262), where the shape writes its copy of each file the root already holds. `execute` then made and pushed both legs and `place` died in `NotADirectoryError`, `FileExistsError` or `IsADirectoryError`, or wrote the shape's README over a real `shape/README.md` on the line after it said nothing was overwritten, and the verification ended `adopt-lost`. A corrected re-run met `leg-remote-exists`. `_root_shape_findings` plays `place` over the paths the plan keeps (`_kept_in_root`, which #172's mount rule reads) in the order `assembly_root_paths` lists what the shape writes: a kept file on the way to a shape path is `plan-root-blocks-shape`; where the root holds a shape path, its copy at `shape/<path>` must be free of a kept path at it, a kept directory there and a kept file on the way, or it is `plan-root-blocks-shape-copy`. It is asked of a disk that keeps case and of one that ignores it, as #172 asks its mount paths. It sits in `_leg_findings`, so `check` and `execute`'s `_refuse_what_check_finds` (#168) read one list and `execute` refuses before any leg exists. A symlink or a submodule on the way is another rule's (#183, `shape_materialize.copy_in_the_way` asks the disk the same question where `place` writes a copy, and `place` raises `materialize-copy-blocked` instead of writing over a file or into a directory, for a caller that skipped `check`. `tests/test_adopt_root_shape_paths.py` holds the six reproductions of the issues, each failing on c3f4987 and refused before any leg exists on this head, with the rule, its boundaries, case, the refusals end to end and the materializer's own refusal. A fuzz of random kept trees against the unchanged materializer agrees with `check` on every case. Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the shape writes a copy at all, so a kept `readme.md` beside a kept `shape/README.md` is a finding and no longer `plan ok` followed by a stop after both legs on macOS and Windows; a submodule at the copy is said once, by #166's rule; and the materializer's copy refusal names its paths between backticks (#262) (#263) Review of f84fc0f (CHANGES NEEDED, 1 should and 5 nits), fixed: - `_shape_blocks` read "does the root hold this path, so is a copy written" with case kept, and "is the copy's place free" with case ignored. On a macOS or Windows disk `place`'s `path.exists()` ignores case too, so a kept `readme.md` is `README.md` there: the shape's README collides with it, its copy goes to `shape/README.md`, and anything the plan keeps there (a file, a file named `shape`, a directory) blocks it. `check` said `plan ok`; `execute` then made both legs and stopped. Each disk now answers both questions, and a copy only a disk that ignores case writes says so ("once case is ignored, as a macOS or Windows disk does"). On an emulated case-ignoring disk (the kept paths respelled the shape's way, the materializer run into a real directory) 307 of 5445 random trees were missed before this change and 0 are after; the new tests hold the same parity for nine blocked trees and five free ones. - A submodule kept at the copy (or under a directory there) drew this rule's finding as well as `plan-submodule-root`, and the finding said the copy is written over it, which is untrue: in a clone a submodule is an empty directory, and `place` stops at it. It is #166's, said once. A symlink at the copy is still found here, nothing on main finds one, and is now said to be written THROUGH, which is what `place` does. - `_KeptTree.holds` counts a symlink at a shape path without following it, though `Path.exists()` is false of one that leads nowhere: the row holds no target, and whether a link leads anywhere is #183's question. It errs towards refusing and is now stated, and tested, as that. - `materialize-copy-blocked` and `copy_in_the_way` print each path between backticks, as the findings of `check` print the same paths. - The comment, the test and the description that gave "a copy is written is read with case kept, as `place` reads it" as the reason are corrected. Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
One textual conflict, the `_entry_findings` docstring: main's #196 says the entry paths come first in what `check` prints once after the findings, and this branch says what the root keeps where the shape writes is read with the two mount paths. Both clauses are kept. Nothing else overlaps. Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
(lane openRepoShape-5, 2026-10-12T01:18Z) @codex review |
|
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 2 days and 18 hours by commenting |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Reviewer's GuideThe PR makes root-shape collisions part of the shared plan validation path, so Sequence diagram for safe execute refusal before leg creationsequenceDiagram
actor User
participant Execute as execute
participant Findings as _leg_findings
participant RootCheck as _root_shape_findings
participant Legs as Leg repositories
User->>Execute: execute(plan)
Execute->>Findings: _refuse_what_check_finds(plan)
Findings->>RootCheck: _root_shape_findings(plan, tree)
RootCheck-->>Findings: plan-root-blocks-shape or plan-root-blocks-shape-copy
Findings-->>Execute: refusal and remediation
Execute-->>User: exit 2, no legs created or pushed
Note over Execute,Legs: A valid plan proceeds to create legs only when no finding exists
Sequence diagram for materializer collision-copy refusalsequenceDiagram
participant Materializer as shape_materialize
participant Disk as Target filesystem
participant Caller as Caller that skipped check
Caller->>Materializer: place(rel, write)
Materializer->>Disk: Check root path and collision copy path
Disk-->>Materializer: copy_in_the_way(actual)
alt Collision copy is blocked
Materializer-->>Caller: Refusal materialize-copy-blocked
Materializer-->>Caller: Nothing written to shape/<path>
else Collision copy is free
Materializer->>Disk: Write shape/<path>
Materializer-->>Caller: Collision recorded for follow-up
end
Flow diagram for pre-execution root-shape collision validationflowchart TD
A["Plan with paths kept in assembly root"] --> B[_leg_findings]
B --> C[_root_shape_findings]
C --> D["_KeptTree checks case-keeping disk"]
C --> E["_KeptTree checks case-ignoring disk"]
D --> F{"Shape path or shape copy blocked?"}
E --> F
F -->|Yes| G["FINDING plan-root-blocks-shape or plan-root-blocks-shape-copy"]
F -->|No| H["plan ok"]
G --> I["check reports finding"]
G --> J["execute refuses before legs exist"]
I --> K["Send to leg, drop, or rename; rerun plan"]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
…, so adopt carries no public `CASE_ASIDE` of its own and `test_both_tools_ask_the_one_definition` passes again on Linux, macOS and Windows (#262) (#263) Fix round 1 of #313 imported `shape_materialize.CASE_ASIDE` into `adopt-project.py` under its public name, which made it a module attribute of adopt. `tests/test_scaffold_leg_path_collisions.py` guards the one-definition rule with `not hasattr(adopter, "CASE_ASIDE")`: adopt has no phrase of its own. It now follows the import list's own pattern for shared names adopt uses privately (`first_and_more as _first_and_more`, `path_overlap as _overlap`) and the one call site in `_root_shape_findings` reads `_CASE_ASIDE`. No other name fix round 1 added to that import list is public, and the test is unchanged. Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
…s `_entry_findings` order sentence composed with #255's #313 (71b58a1, #262 and #263) makes `check` find a kept root path where the shape writes a directory or its `shape/` copy, through `_root_shape_findings` called from `_leg_findings`, and makes `shape_materialize` refuse a copy whose own path is taken. This branch appends each value `execute` writes into a file that no file can hold to `_entry_findings`. The one conflict is that function's docstring, the sentence naming the order of its findings: it keeps #313's words (each entry's `leg:`, the two mount paths and what the root keeps where the shape writes, then the source's own submodules) and appends this PR's clause, ", then each value `execute` writes into a file that no file can hold (#255)". Nothing else in the file conflicts: the return still reads `(findings + submodule_findings + unwritable_findings, unsafe_remediation + remediation + unwritable_remediation)`, and `_leg_findings` carries #313's findings inside `findings`. Main's c0ed615 (#308, family.py) comes with it and touches none of this branch's files. Main has since moved on to c7c02fa (#315, family.py); this merge stops at 71b58a1. Lane: openreposhape-2 (openRepoShape-2) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ly a placeholder its table lacks, so `--elected-by '{{SPEC_PATH}}'` is no longer recorded as `spec` and `{{NOPE}}` no longer refuses after the legs are pushed (#260) (#316)
**What was wrong (#260).** `render` replaced the placeholders one key at a time, each over the whole text. The value an earlier key put in was then searched by every later key. `--elected-by` and `--reference` in both tools, the scaffold's `--name`, and `family.py init`'s `--name` and `--created-by` are free text, so each could hold another placeholder's token:
- A token for a key that came later was expanded. `adopt-project.py --elected-by '{{SPEC_PATH}}'` recorded `elected_by: "spec"` in `project.yaml` and the README, and said `adoption verified`.
- A token for a key that came earlier (`{{PROJECT}}`), or one no key names (`{{NOPE}}`), stayed in the output. `render` then refused it as `template-unsubstituted`, with a remediation that blamed the tool. By then `execute` had pushed both legs, the scaffold had created all three repositories, and `family.py init` had created the holder's bare repository.
Reproduced on b30595c with the issue's own script, and the same for `family.py init --created-by`.
**The change (`scripts/shape_materialize.py`).**
- `render` reads the template once. One regular-expression substitution looks each placeholder up in the table, so a value goes in where its placeholder stood and is never searched again. In a `.yaml`/`.yml` template the quoted form `"{{KEY}}"` is matched first and spelled by `double_quoted`, exactly as #284 made it (`YAML_PLACEHOLDER_RE`, group 1).
- The refusal asks the template, not the output: it names the placeholders the template holds that the table has no value for, and it is raised before anything is substituted. That is the defect its remediation describes, so the remediation is now true. The output now holds the person's text, so it is no longer searched. Message and code are unchanged: `REFUSED template-unsubstituted: <source>: no value for ['{{NOPE}}']`.
- `PLACEHOLDER_RE` now takes digits, `\{\{[A-Z0-9_]+\}\}`, a superset of the old `[A-Z_]+`. The four digest placeholders (`{{SPEC_TREE_SHA256}}`, `{{CODE_TREE_SHA256}}`, `{{SHAPE_TREE_SHA256}}`, `{{PIN_TREE_SHA256}}`) were substituted only because the loop replaced every key by name. The single pass replaces only what the pattern finds, so it needs the digits. A digest placeholder that a table lacked used to be left in the output with nothing said; it is now refused like any other.
**Nothing downstream renders these files again,** so a `{{` a person typed is never expanded later, and no tool needs to refuse `{{` in these values. On this head:
- `git grep -n -E '\brender\(' -- '*.py' ':!tests'` lists `scripts/shape_materialize.py` alone: `copy_tree` and the three calls in `_materialize`. (`scripts/render-cli-reference.py` has its own unrelated `render`.)
- `copy_tree`, `materialize_assembly_root` and `materialize_family_root` are called only from `adopt-project.py execute` (`:2549`, `:3101`), `scaffold-project.py` (`:1013`, `:1054`) and `family.py init` (`:712`). Every one of those calls runs while the tool is creating the repositories.
- `update-shape.py` imports no renderer and no `TEMPLATED` list. In `project.yaml` / `family.yaml` it rewrites only the `shape:` block's `commit:` and `tree_sha256:` lines (`rewrite_manifest`, `:869`). The README's trailing `Shape:` line is a span rewrite of the commit.
- `bump-leg.py` rewrites only a leg's two pin lines.
- `shape-doctor.py` imports only `escape_what_stdout_cannot_encode` and `lane_trailer_argument` from the materializer. It reports a leg's `AGENTS.md`/`README.md` as `rendered` and compares nothing.
- Neither `bootstrap.py` nor any shipped validator holds `{{`: `git grep -n -F '{{' -- 'templates/*.py'` finds only `^{{commit}}` in two f-strings.
- `shape_advisory.py`'s own `PLACEHOLDER_RE` is asked only of `single-repository.yaml` (`field_problems`, called only from `read_record`). That is a record a person writes by hand, never `project.yaml`.
**Every caller, and what it relies on.**
- `adopt-project.py`: `_template_values` (`ORG`, `REFERENCE`, `ELECTED_BY`, and so on) is rendered into seeded legs and the assembly root. It relies on every key a template names being in the table (it is: the four leg commit/digest keys are `""` until the legs exist). Its free text is now written as typed.
- `scaffold-project.py`: the `values` table, plus `_seed_legs`' four leg values and `--pin`'s `PIN_*` values for neutral pins. Same reliance; the probe after this list names the keys.
- `scripts/family.py`: `_template_values`. `FAMILY` is a key no template names, and that is harmless.
- `setup-project.py` renders nothing. It forwards `--elected-by` and `--name` to the scaffold, and its own `NAME_RE` already refuses `{`.
- `update-shape.py` and `shape-doctor.py` render nothing (above).
- Tests: `test_adopt_leg_path_collisions.py` and `test_scaffold_leg_path_collisions.py` build a table from `PLACEHOLDER_RE.findall` over `templates/assembly-root/`. They now include the digest keys and still pass. `test_shape_advisory.py` renders leg `AGENTS.md` and the record template, which have no digest keys. `test_scaffold_ignored_shape_files.py` calls `copy_tree`. `tests/test_template_quoted_values.py` built its tables with its own `[A-Z_]+`, so its tables lacked the digest keys and its own `"SHA256" in key` branch never ran. It now uses `[A-Z0-9_]+`, and #284's behaviour is otherwise held unchanged.
A probe (`ast` over each tool's dict literals, against every placeholder under `templates/`) finds that every capitals key of the scaffold's and adopt's tables is named by a template, except `ORG`, which only `family-root` and `workspace-root` name. Every key of family's table is named by a template, except `FAMILY`.
**Byte-for-byte for ordinary values.** Every text file under `templates/` (49) was rendered with b30595c's `render` and with this head's, over two tables: plain values, and values holding `"`, `'`, `\`, `#`, `[x]`, `{y}`, U+3000 and a tab. That is 0 differences in 2 x 49 files. `test_an_ordinary_value_renders_as_a_plain_substitution` keeps this as a test for the 19 templates that hold a placeholder.
**Tests (`tests/test_template_values_single_pass.py`, 133).**
- `render`: each key's token (every key of the three tools' tables and every key a template names, 49 keys) and `{{NOPE}}`, bare and between double quotes, as every free-text value. Each reads back unchanged from `project.yaml` and `family.yaml`. Every README and `AGENTS.md` holds it exactly where it holds an ordinary value. Neither of two keys reads the other's value, in either order. A placeholder the template lacks is still refused, naming only the template's missing tokens and never a value's; this includes a digit key. `${{ github.x }}` and an f-string's `{{commit}}` are left alone.
- End to end, into local bare remotes, with a `gh` on PATH that records any call (none is made). What was pushed is read back with `git show`, so no checkout's line endings are compared:
- `scaffold-project.py --name/--elected-by/--reference`, each holding every key's token (bare and quoted), and each as `{{NOPE}}`. The run exits 0. The pushed `project.yaml`, README and both legs' `AGENTS.md` hold the values as typed, and the project's own `validate-manifest.py` passes.
- `adopt-project.py plan` / `check` / `execute` with `--elected-by` and `--reference` the same way. All three pass, with `adoption verified`. The split commit's `project.yaml` and README hold the values as typed. This test is skipped at its decorator without `git filter-repo`.
- `family.py init --created-by` the same way. `family.yaml` holds the value, and `validate-family.py` passes. (The family's `--name` is held by the unit tests only. Its validator requires the holder's name to be one CamelCase token, so a free-text name is refused there whatever `render` does. See the last item under Left out.)
On b30595c this file is 113 failed, 20 passed. The 20 are the byte-for-byte guard (19), which describes base behaviour by design, and the sanity test that the templates are found.
Mutation probes, each a revert of one part of the fix: the sequential loop with the template check (98 failed); single pass with the output check (109 failed); `PLACEHOLDER_RE` without digits (69 failed, the scaffold e2e among them, because the pins keep `{{SHAPE_TREE_SHA256}}`); no quoted branch (94 failed, #284's tests among them); no template check (4 failed).
Targeted runs on this head: `tests/test_template_values_single_pass.py tests/test_template_quoted_values.py tests/test_scaffold_e2e.py tests/test_scaffold_pin_and_reuse.py tests/test_adopt_plan.py tests/test_adopt_execute_refusals.py tests/test_adopt_e2e.py tests/test_family.py tests/test_repo_hygiene.py tests/test_cli_reference.py tests/test_adopt_leg_path_collisions.py tests/test_scaffold_leg_path_collisions.py tests/test_shape_advisory.py tests/test_scaffold_ignored_shape_files.py`, with `git-filter-repo` 2.47.0 on PATH: 792 passed, 1 skipped (`test_adopt_plan.py:393`, `SHAPE_MEDXEHR_CLONE` unset). `tests/test_shape_doctor.py`: 208 passed.
**Composition** (`git merge-tree --write-tree` against the current tips; each merged tree ran the sibling's own test files plus this PR's two):
| Branch | Tip | Merge | Merged-tree tests |
|---|---|---|---|
| `origin/main` | c0ed615 | clean | 680 passed |
| `fix/scaffold-manifest-values` (lane 5's #258/#261, PR #314) | 7defac7 | clean | 370 passed |
| `fix/adopt-template-values-utf8` (lane 2's #270) | edfa7c6 | clean | 278 passed |
| `fix/leg-path-yaml-scalars` (lane 2's #266) | b2b42f8 | clean | 409 passed |
| `fix/adopt-check-shape-paths` (lane 5's #262/#263, PR #313) | 65a9262 | clean | 320 passed |
- #314 calls `render` in `manifest_misreads` and `manifest_invalid` with the complete table, so the template-side refusal never fires there. It now finds placeholders with this `PLACEHOLDER_RE`.
- #266 has merged main, so the import-line conflict an earlier tip had is gone.
- **Lane 1's #181 (`fix/adopt-plan-quote-yaml-keywords`, e337f44): a clean merge, one failing test, and the fix belongs to whichever lands second.** #181 alone passes (841). On the merged tree, 1 of 974 fails: `test_adopt_records_each_free_text_value_as_typed[every-key]`, refused `adopt-manifest-misread` at `plan`. #181's gate `_written` (e337f44 `adopt-project.py:1668-1669`) spells the value with `double_quoted` (lane 1's 4bf2cc4), then runs `.replace(token, value)`, which re-reads the value it just put in. That is the per-key re-scan this PR removes. So with both, the gate refuses values `execute` now writes as typed: `--elected-by 'x{{ELECTED_BY}}'` (the gate claims `"xx{{ELECTED_BY}}"`), `'"{{ELECTED_BY}}"'`, and `--reference 'see {{REFERENCE}}'` (it claims `"see see {{REFERENCE}}"`). On this PR alone all three pass `plan` and are written as typed. Neither branch is wrong against main, where `render` really would expand them. Whichever lands second makes `_written` one pass for its key: one `re.sub` over `"(\{\{KEY\}\})"|\{\{KEY\}\}`, or `render` on the line, as #314's `_misread_rows` does. Tokens of other keys (`{{SPEC_PATH}} {{NOPE}}`) pass on every tree.
**Left out.**
- No template placeholder is quoted (#259 waits on Brett), and no free-text value is refused for holding `{{`, since nothing renders it again.
- `family.py init --name` takes a display name (its help says so) that the holder's own `validate-family.py` refuses. On b30595c, `--name 'Contoso Group'` exits 0 and pushes the holder, and `validate-family.py` then exits 1 with `naming-unclassified: 'Contoso Group' matches no family in the naming policy`. This is pre-existing and not touched here; it is filed as #307, with `family.py init`'s other values.
**Review.** The first reviewer stalled at its first checkpoint and was replaced. The second review of 552763d found the code sound and asked only that this body's composition be corrected (above). Its #181 paragraph described an earlier #181 tip, and every other tip had moved.
What the review checked:
- #260's rows reproduced on b30595c and pass on the head, for adopt, scaffold and `family.py init`.
- All 49 templates render byte-identically between base and head over 25 tables of awkward values, in both key orders, and 69 files pushed by the real tools are byte-identical.
- A 40,000-case fuzz of `render` against an independent single-pass reference found 0 mismatches.
- 322 hostile values round-trip through `project.yaml` and `family.yaml` under both this repository's reader and PyYAML.
- Every table holds every digest key its templates name, so the widened refusal cannot fire on a run that used to succeed.
Nits kept:
- Three mutants survived the first head. Fix round 1 (321e511, tests only, with main c0ed615 merged as 7d6c66c) gives each a test that fails on it:
- a `.yml` source gets the quoted spelling as a `.yaml` one does;
- the `template-unsubstituted` list is the sorted set of what the template lacks, each token once;
- an empty string in the table is a value that renders as empty text and is never refused.
The seven targeted files pass on the merged tree, 541 tests.
- The `gh` stub proves nothing on Windows, where no test calls `gh`.
Reviewed adversarially: the first reviewer stalled and was replaced; the second found the code sound and asked only for this body's composition to be corrected, which it is. Fix round 1 adds tests for the three mutants that survived. After #313 landed, the branch was updated onto main 71b58a1 (9469148), and CI re-ran green on Linux, macOS and Windows, with SonarCloud passing.
Closes #260
Lane: openreposhape-5 (openRepoShape-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…263's root-shape findings join `_leg_findings`, so the one list reads #196's unsafe paths first, the root's shape paths with the legs, and #190's relative urls last Main since b421e6b: c0ed615 (#242 via #308, family.py `add --force`: family.py and its own test only) and 71b58a1 (#262, #263 via #313: a path kept in the root where the shape writes a directory or its `shape/` copy is a `check` finding and an `execute` refusal before any leg exists). The one file changed on both sides is adopt-project.py. TWO CONFLICT HUNKS, both docstrings, each the union of both sides: 1. The module docstring's `check` paragraph: 71b58a1's "no path kept in the root where the shape writes (...)", then the submodules clause with #190's "each relative url naming the same repository from the leg as from the source". 2. `_entry_findings`' first paragraph: #190's "and the NOTEs it prints beside them", and 71b58a1's "the two mount paths and what the root keeps where the shape writes". Auto-merged, 71b58a1's: the `shape_materialize` import (`CASE_ASIDE as _CASE_ASIDE`); `_leg_findings`' docstring and its `_root_shape_findings(plan, tree)` call; the root-shape block from `ROOT_BLOCKS_SHAPE` to `_root_shape_findings`; and `_refuse_what_check_finds`' remediation sentence. scripts/shape_materialize.py and tests/test_adopt_root_shape_paths.py are main's blobs. Proofs: - Each side's +/- lines are unchanged by the merge except at the two unioned docstrings. - `_leg_findings(plan, tree)` keeps `tree`. - `_entry_findings` reads #196's unsafe paths, then coverage, then `_leg_findings` (the root-shape findings among them), then `_submodule_findings`, whose #190 relative urls come last. It returns `(findings, unsafe_remediation + remediation, notes)`. - No top-level name is bound twice, and no line over 79 columns is added (42 on main, 42 merged). Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, #242 via #308, #262 and #263 via #313) into fix/adopt-record-submodule-placement Brings in ede15ce (#238), 6f45bf9 (#196), b421e6b (#254), c0ed615 (#242) and 71b58a1 (#262, #263) on top of 6d8d88b. No rebase. ede15ce changes shape-doctor.py. 6f45bf9 and 71b58a1 change adopt-project.py and scripts/shape_materialize.py. b421e6b changes scripts/shape_materialize.py too, giving a project's validators an explicit PYTHONIOENCODING. All of these are files this branch changes. c0ed615 changes scripts/family.py alone. No conflicts. Checked: - adopt-project.py: #196 gives `check` and `execute` one test for an entry's path, `entry_path_problem`, as the finding `plan-unsafe-path`. #262 and #263 add `_root_shape_findings` to `_leg_findings`, for a kept root path where the shape writes. Both reach `execute` through `_refuse_what_check_finds`, before any leg exists and before `_commit_the_split` appends the record. This branch's `submodule_record`, `_resolution_text`, the record's preamble, `_answered_legs`, `_kept_in_a_leg`, `_commit_the_split`, `cmd_execute`, `submodule_plan_problems`, `_submodule_findings`, `Plan`, `y`, `emit` and `walk` are unchanged by the merge. `_root_shape_findings` is asked only beside a `legs:` mapping, so the doctor's placement plan, whose `legs:` is a list, still goes through `_leg_findings(plan, None)`. - shape-doctor.py: #238 changes `validator_row` and `run_validator`. This branch's `check_placement`, `recorded_submodules`, `audit_leg`, `placement_row`, `placement_verdict` and `Context` are unchanged by the merge. - scripts/repo_shape.py is untouched by these commits, so the record's writer and reader, and `double_quoted` in `submodule_record`, are 3e86200's. - Both sides added lines to the module docstrings of adopt-project.py and shape-doctor.py. Every line either side added is in the merge. - No top-level name is bound twice in adopt-project.py, scaffold-project.py, scripts/repo_shape.py, scripts/shape_materialize.py, shape-doctor.py, validate-manifest.py, update-shape.py, scripts/family.py or scripts/bump-leg.py. Each merged module's names are the base's plus what either side added. Every definition only one side changed is that side's text. - AGENTS.md is untouched: 472 lines, under the cap of 472. - The branch's diff against main is still #189 alone: 12 files, +1670 -157, file by file the same as against 6d8d88b. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Main brings five commits since 6d8d88b: - ede15ce (#238 via #287): shape-doctor.py's validator rows; - 6f45bf9 (#196 via #231): `entry_path_problem`, one test of an entry's path for `check` and `execute`; - b421e6b (#254 via #281): bump-leg.py and update-shape.py give the validators an explicit PYTHONIOENCODING (scripts/shape_materialize.py gains `captured_child_environment` and `inherited_child_environment`); - c0ed615 (#242 via #308): family.py's `add` and `bump` under excludes; - 71b58a1 (#262, #263 via #313): `check` finds, and `execute` refuses, a kept root path where the shape writes a directory or its `shape/` copy, and the materializer never writes over a copy. It merged with no conflict. Only adopt-project.py changed on both sides. Every other file the merge changes against this branch is main's, and every file it changes against main is this branch's. In adopt-project.py the merge's diff against this branch is main's own diff (559 lines), and its diff against main is this branch's own diff (784 lines). Main's twenty hunks there, by where they land: 1-2. the module docstring: `check` validates each entry's path and keeps no path in the root where the shape writes (6f45bf9, 71b58a1); 3. the `from shape_materialize import` block: `CASE_ASIDE`, `MOVE_THE_LEG`, `first_and_more` (71b58a1); 4-6. `_leg_findings`: a docstring line, the call to `_root_shape_findings`, and the new block after it (`ROOT_BLOCKS_SHAPE`, `ROOT_BLOCKS_COPY`, `_KeptTree`, `_shape_blocks`, `_blocked_sentence`, `_fix_the_kept_path`, `_root_shape_findings`) (71b58a1); 7. after `_submodule_findings`: `NOT_EXTRACTED`, `entry_path_problem`, `_misread`, `_refused_by_policy` and `_unsafe_path_findings` (6f45bf9); 8-11. `_entry_findings`: its docstring, and the entries' path findings first (6f45bf9); 12-13. `_extract_leg`: `literal:` on every `--paths-from-file` line (6f45bf9). This branch changed `_extract_leg` as well, further down: it reads the commit count and the digest before `_push_the_leg`. The two sets of lines do not touch, and the merged function has both; 14-15. `_mount_the_legs`: `git --literal-pathspecs rm` (6f45bf9); 16-17. `_leg_paths`: collected, not judged (6f45bf9); 18-20. `_refuse_what_check_finds`: its docstring and remediation (6f45bf9, 71b58a1). The new findings of 6f45bf9 and 71b58a1 are `_entry_findings`, which `cmd_execute` reaches only through `_refuse_what_check_finds`, before `_create_leg_remotes`. So they are refused before any leg exists, and no notice is due. The materializer's new `materialize-copy-blocked` is raised after both legs are pushed, inside `_commit_the_split`, when a run reaches the materializer without `check`'s finding. That makes it a late failure, which this branch reports with the notice and exit 2. Main's `test_with_check_skipped_execute_stops_at_the_copy_and_overwrites_nothing` expects it to escape `cmd_execute`, so this merge breaks that test, as 9092fda's merge of #200 broke the mount-guard tests. The next commit makes the test read the reported refusal. No top-level name is bound twice in adopt-project.py, scaffold-project.py, scripts/repo_shape.py, scripts/shape_materialize.py or tests/conftest.py. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, #238, #196, #254, #242 and #262/#263 merge with three adopt-project.py hunks kept on both sides, and #262's `_CASE_ASIDE` import kept as the name's one binding origin/main moved b30595c -> 71b58a1: - be2790e (#204 via #227), update-shape.py; - 6d8d88b (#203 via #236), family.py; - ede15ce (#238 via #287), shape-doctor.py; - 6f45bf9 (#196 via #231): adopt-project.py `entry_path_problem`, scripts/shape_materialize.py; - b421e6b (#254 via #281): scripts/shape_materialize.py, bump-leg.py, update-shape.py; - c0ed615 (#242 via #308), family.py; - 71b58a1 (#262 and #263 via #313): adopt-project.py `_root_shape_findings` and scripts/shape_materialize.py `copy_in_the_way`. It fixes what this branch's pull request listed as follow-ups (i) and (ii): a source's own `shape/` where the shape writes its copy, and a plain FILE where the shape needs a directory. Conflicts, all in adopt-project.py, each resolved by keeping both sides: - The module docstring's `check` paragraph. 71b58a1 adds "no path kept in the root where the shape writes ..." before the submodule clause, and this branch adds the symlink clause after it. Both are kept, in that order. - `_entry_findings`' docstring. 6f45bf9 and 71b58a1 give the order "each entry's path, then coverage, then each entry's `leg:`, the two mount paths and what the root keeps where the shape writes, then the source's own submodules". This branch adds "then each symlink the plan keeps in the root that a shape file cannot be written through". - `_entry_findings`' return line. 6f45bf9 returns `unsafe_remediation + remediation`, and this branch appends `_root_symlink_findings(plan, source, tree)` to the findings. The merge returns both. Found after the textual merge, and resolved here so that no commit binds a name twice: 71b58a1 (through 65a9262) imports #198's phrase as `_CASE_ASIDE` in the "#172's shape half" import block, and b37159a had imported it on a line of its own. Main's import is kept; this branch's line and its five-line comment go. scripts/shape_materialize.py merges with no conflict. `place` gets 71b58a1's `copy_in_the_way` inside its collision block and this branch's `_refuse_unwritable` after it, as 71b58a1's message foresaw. Checked on the merged tree: - `_entry_findings` still hands `_leg_findings` the tree, and the symlink findings still come last in its list. - AST: no top-level name is bound twice in adopt-project.py, scaffold-project.py, scripts/repo_shape.py or scripts/shape_materialize.py, and none is loaded but bound nowhere. Main changed the signature of no function this branch calls. - Both sides are intact by +/- line sets, apart from the three hunks and the import above. The next two commits fix what this merge breaks, each with a revert line. #262's rule and this branch's both name a symlink kept AT the copy under `shape/`. And where the shape's copy lands is now `copy_in_the_way`'s question, asked before this branch's own check of it. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… exists, a source symlink with an empty target and the source's own `project.yaml` kept in the root, and `plan` no longer offers `root` for that file (#303, #305) (#387) Two ways `check` said `plan ok` to a source `execute` could not adopt, both reproduced on c7c02fa with the issues' own scripts. **#303, a symlink whose target is empty.** A `120000` entry whose blob is the empty blob passed `check`, which never reads a link's target. - With symlinks on (git's default where the disk can hold one), `execute` created both leg repositories, then failed in its first clone of the source: exit 2, nothing on stderr, two empty legs left behind. Linux refuses a symlink to nothing. This happened whatever the plan answered: `docs/empty-link` sent to spec, and a top-level `empty-link` answered `root` or `drop`. - With `core.symlinks=false`, it said `adoption verified`. The spec leg held the empty link, a clone of that leg exited 128, and the assembly's recursive clone exited 1. The top-level link answered `root` or `code` verified the same way. Only `drop` gave an assembly that clones. **#305, the source's own `project.yaml` answered `root`.** `plan` asked about it under `ambiguous-top-level-yaml`, whose question offers `root`. Answered `root`, `check` said `plan ok`. `execute` wrote the shape's manifest beside the source's file as `shape/project.yaml`, said "nothing was overwritten" and `adoption verified`. `shape-doctor.py` then said NOT A SHAPE ROOT (exit 2) and pointed at `adopt-project.py plan`. `make bootstrap` failed `naming (exit 2), manifest (exit 1), pins (exit 2)`. Answered `code` or `spec`, the doctor said COMPLIANT and `bootstrap ok`. **What changed.** - **`plan-empty-symlink` (#303).** `_empty_symlink_findings` reports each `120000` row of size 0 in `Source.tree()`. The size `ls-tree -l` gives a symlink is the length of its target, so no target is read; a SHA-256 repository reports size 0 too. - It is listed right after #196's `plan-unsafe-path`, through `_source_path_findings`, on the line `_entry_findings` already had. So `check` prints it, and `execute` refuses it through `_refuse_what_check_finds` before any leg exists (#168). - `EMPTY_SYMLINK_REMEDIATION` is said once after the findings, in `check` and in `execute`'s refusal. The fix is in the source: give the link a target, or remove it, commit, and re-run `plan`. - `plan` notes each such link in `check`'s words, and still writes the plan. - **`ambiguous-project-yaml` (#305).** A new rule in `contracts/path-classification.yaml`, above `ambiguous-top-level-yaml`, for the file `project.yaml`. Its question asks spec, code or drop, and says `root` is not an answer for this file. `release.yaml` keeps the old question. - **`plan-root-blocks-manifest` (#305).** #313's machinery is extended, not copied: `_shape_blocks`, which `_root_shape_findings` runs over each disk, now refuses the root holding `project.yaml` outright, with no copy question after it. It fires for a kept row at that path (file or symlink), or a kept directory there, on a disk that keeps case or one that ignores it. The finding's remediation is #313's `_fix_the_kept_path`. - A submodule there stays `plan-submodule-root`'s, said once. - `_kept_there` is the at-or-under lookup the copy branch already did, factored out for both. - `execute` refuses it before any leg exists, through the same list. - **Files.** `adopt-project.py` (+205/-13), `contracts/path-classification.yaml` (+28), the two new test files (399 and 366 lines) and `tests/test_adopt_root_shape_paths.py` (+6/-2). **Decisions.** - **#303 is refused whatever the plan answers, and whatever `core.symlinks` says.** - Where symlinks are made, no answer adopts. The run fails at the first clone of the source, which checks the whole tree out before anything is taken out. Measured with the link in `docs/` (sent to spec), at the top level answered `root` and `drop`, and with every path rooted or dropped and both legs seeded: there the seeded legs were pushed and the assembly's clone exited 128. - `check` cannot know where `execute` will run. A check that passed `drop` with symlinks off would pass a plan the next Linux machine cannot adopt, and the root's own `validate` workflow runs on `ubuntu-latest`. - The remediation costs one commit in the source. - **#305 covers the manifest only.** The issue asked whether other rendered root paths need the same rule. Measured on c7c02fa, with the source's own file kept in the root at each of the 18 `assembly_root_paths()`: - `check` passes all 18. - These verify over a broken assembly: `contracts/spec-pin.yaml` and `contracts/code-pin.yaml` (DRIFTED, pins fail); `scripts/validate-pins.py`, `scripts/validate-manifest.py`, `scripts/repo_shape.py` and `contracts/repository-naming.yaml` (INVALID); `scripts/validate-repository-naming.py` (COMPLIANT, naming fails); `scripts/bootstrap.py` (COMPLIANT, and `make bootstrap` runs the source's own script). - `contracts/shape-pin.yaml` fails verification after both legs exist. - README.md, AGENTS.md, CLAUDE.md, .gitignore, .gitattributes, AGENTS-shape.md and the workflow come out COMPLIANT with the copy beside them. `Makefile` is rooted by default, and the follow-up merge is its designed exit. - `project.yaml` is the one path `plan`'s own question offered `root` for. The others are reached only by hand-editing a `contracts/` or `scripts/` answer to `root`. They are left for a follow-up issue (under Left out), not folded in here. - **A symlink at `project.yaml` is refused too.** On c7c02fa: - a link to the source's own file verified and was NOT A SHAPE ROOT; - a link to nothing had the manifest written through it, and came out COMPLIANT on Linux. A clone that makes no symlinks holds that link as a file naming its target, so it is refused anyway, and #183 refuses a link to nothing at a shape path regardless; - a directory `project.yaml/` verified and was NOT A SHAPE ROOT. - **A case twin `Project.yaml` kept in the root is refused, with the case aside.** It adopts COMPLIANT on Linux. On a disk that ignores case, `place` writes the manifest beside it. This is the trade #172 and #313 already make. **Evidence.** In this section and in the two below it, "this head" is 69c54c9, the branch's own commit and the one the review approved; main and #314 were merged into the branch afterwards (last paragraphs). - **Reproductions, on this head** (exits as printed): - #303 run 1: `check exit 1`, one `plan-empty-symlink` finding; `execute exit 2`, `REFUSED plan-empty-symlink`, `leg repositories left:` empty. - #303 run 2 (`core.symlinks=false`): the same finding and refusal; no leg, no verification. - Top-level `empty-link`, symlinks off and answered root, code or drop, and symlinks on and answered root or drop: each `check exit 1`, `execute exit 2`, no leg. - #305 root: `check exit 1`, one `plan-root-blocks-manifest` finding; `execute exit 2`, `leg repositories:` empty. - #305 code, spec and drop: `plan ok`, `adoption verified`, the root's `project.yaml` begins `schema_version: 1`, doctor COMPLIANT, `bootstrap ok`. - The plan's entry for `project.yaml` now reads `rule: ambiguous-project-yaml`, with no `(root)` in its question. - `project.yaml` as a link to a file, a link to nothing, a directory, and the twin `Project.yaml`: each `check exit 1` and `REFUSED plan-root-blocks-manifest`. - No row needs real GitHub or a cloud tool. - **New tests.** `tests/test_adopt_empty_symlinks.py` (28) and `tests/test_adopt_root_manifest.py` (27). - The symlinks are made with `git update-index --cacheinfo`, so no disk symlink is needed. The one test that checks a link out (a link given a target, end to end) is skipped on Windows by its marker, before it runs. - On c7c02fa: 37 failed, 18 passed. The 18 are the controls that must pass on both sides: a symlink with a target, the remediations adopting, `project.yaml` sent to a leg or dropped, a submodule there, other shape paths keeping their copy, and `release.yaml`'s question. - **One existing test changed.** `test_a_file_kept_at_a_path_the_shape_writes_is_not_a_finding` in `tests/test_adopt_root_shape_paths.py` held that a kept file at any shape path is no finding. It now holds that for every path but the manifest, which is `plan-root-blocks-manifest`. - **Mutation probes:** 14 of 14 hunks reverted one at a time, each killed by at least one new test. - **Targeted runs.** The adopt list and the doctor ran on a local state of this branch (7a22a21) whose files were this head's but for `tests/test_adopt_root_shape_paths.py`. That file was re-run on this head, so the adopt list is two runs, not one sum. - The 15 adopt files (`test_adopt_empty_symlinks`, `_root_manifest`, `_root_shape_paths`, `_leg_path_collisions`, `_execute_refusals`, `_plan`, `_e2e`, `_submodules`, `_verify`, `_mount_ignored`, `_ignored_shape_files`, `_entry_paths`, `_finding_spelling`, `_history_gitlinks`, `_spec_only`) on 7a22a21: 837 passed, 1 failed, 1 skipped (a MedxEHR clone the plan test needs). The one failure is the #313 test this head changes. - `tests/test_adopt_root_shape_paths.py` alone, on this head: 120 passed. - `tests/test_shape_doctor.py`, as its own stream: 242 passed, 3 skipped (PowerShell lines only a Windows host prints). - `tests/test_scaffold_leg_path_collisions.py`, `tests/test_repo_hygiene.py` and `tests/test_cli_reference.py`: 167 passed. - This head merged with origin/main at 87373a6, which brings `tests/conftest.py`'s new `git()` identity: the two new files, `tests/test_adopt_root_shape_paths.py` and the three above, 342 passed. **The review.** An independent opus review at 69c54c9 approved with nits: 0 blocker, 0 should, 8 nit. It reproduced every row of both issues on c7c02fa and on this head, and killed 6 of 6 mutants: two of the author's, re-run, and four of its own. Its targeted runs on this head merged with origin/main ab623dd (`git merge-tree` clean, with #349's session `gh` guard in place): - the new files, `tests/test_adopt_root_shape_paths.py`, `tests/test_scaffold_leg_path_collisions.py`, `tests/test_adopt_execute_refusals.py`, `tests/test_repo_hygiene.py` and `tests/test_cli_reference.py`: 379 passed; - the other adopt files, in two streams: 303 passed, 1 skipped (the MedxEHR clone), and 323 passed; - the clone-template, literal-names, template-values, plan-escapes, stdout-encoding and Windows-path tests, which cover #268 and #270: 266 passed, 2 skipped (an operator `user.name` set; Windows only); - `tests/test_shape_doctor.py`: 254 passed, 3 skipped (PowerShell lines only a Windows host prints). c7c02fa's own `tests/test_adopt_root_shape_paths.py` against this head's code gave 1 failed (the `project.yaml` row, `:191`) and 119 passed, so no other #313 behaviour changed. - **A cross-lane composition, with lane 1's #183.** On the tree merged with lane 1's `fix/adopt-root-kept-symlinks` (#183, 6c44591), `tests/test_adopt_root_symlinks.py::test_a_link_with_an_empty_target_is_fixed_in_the_source` fails: `AssertionError: assert 'plan-empty-symlink' == 'plan-root-symlink'`. An empty link at or above a shape path is reported by both findings, and `execute` refuses with the first, which is this branch's. The two remediations agree (fix it in the source). Whichever of the two lands second removes the duplicate report. The same file also fails 3 other tests on origin/main with #183 and without this branch (`[a-link-at-the-copy-itself]` and `test_the_materializer_refuses_before_it_writes`, two cases), because #313's `plan-root-blocks-shape-copy` and `materialize-copy-blocked` answer first; those are not this branch's. - **Two known nits, left for a later round.** - An empty link AT `project.yaml` (or at a #313 copy path) gets `plan-root-blocks-manifest`, whose fix offers `drop`, and `plan-empty-symlink`, which says `drop` is no fix. - `plan` notes every empty link (25 links print 25 NOTEs), where `check` names 20 and counts the rest. - The other nits are smaller. A symlink target that begins with a NUL byte passes `check` and fails like #303, and the issue's `_verify` bullet, are follow-up issues; the case twin `Project.yaml` is under Left out. The new tests' `SYMLINKS_OFF` replaces the Windows job's own `GIT_CONFIG_COUNT` settings (`core.autocrlf=false`, `core.longpaths=true`) for those child processes, which is harmless while none of them checks anything out. **Merge-tree, as of 2026-10-12T15:14Z.** `git merge-tree --write-tree --name-only` of this head (69c54c9), against heads fetched then; every sha below is the one it had then, and main has moved since (see the merge paragraph below). It is a textual merge only; the semantic meeting with #183 was tested by the review (the first item above). - origin/main: clean at 0f67f7b. That includes #316 (34ecbc2), #268 (e43fa95), #270 (f795cf7) and #245 (161c6c9), which have landed since this branch was cut. It was clean at 161c6c9 and at ab623dd, the review's merge, too. - Open PRs touching `adopt-project.py`: #184 (f416e13), #353 (dcbc37b), #356 (5a5011d), #371 (34b9500), #373 (5ac03de), #377 (c35c896), #378 (2da8691), #382 (7e55d00) and #384 (a96297e) are all clean. #356 and #382 conflict with origin/main alone (2 and 5 blocks, from #245's landing), not with this head. - #314 (4b8da3d) was NOT clean: one block, in `_entry_findings`' docstring, where each side adds a paragraph after the same one (this head's "THEN THE SOURCE'S EMPTY SYMLINKS (#303)" and #314's "A VALUE NO FILE CAN HOLD"). Keep both. It had been clean at f45edf4, and it had 3 blocks against origin/main alone since #245 landed, so it needed a merge of main in any case. - Lane 1's branches without a PR: `fix/adopt-late-failure-notice` (9f1778d), `fix/adopt-record-submodule-placement` (70f4d29) and `fix/adopt-plan-quote-yaml-keywords` (d38e143) were clean. `fix/adopt-plan-quote-yaml-keywords` was 3 blocks against this head at e337f44, and conflicts with origin/main alone in 4. - `fix/adopt-root-kept-symlinks` (6c44591, #183) conflicts in 3 blocks of `adopt-project.py`: the module docstring's `check` paragraph, `_entry_findings`' docstring and its return line. They are the same 3 that c7c02fa itself has with that branch, and this branch's one added docstring line sits inside the first. It has 5 blocks against origin/main alone. - Lane 5's `fix/adopt-pin-writes-pin-file` (d806e8f): clean. `docs/adopt-execute-exits` is #371, above. - When #183 lands, an empty symlink kept at or above a shape path is reported twice, by `plan-empty-symlink` and by #183's `plan-root-symlink` (the first review item above). A dangling link kept at `project.yaml` is reported twice too, by `plan-root-blocks-manifest` and `plan-root-symlink`, and an empty one three times. Whichever lands second should keep one. **Brought onto main past #314 (bbbb541).** Since this branch was cut from c7c02fa, main took #245 (relative `.gitmodules` urls), #270 (`plan-unwritable-value`), #371 (`execute` verifies before it exits on a refused `gh pr create`), #377 (`plan` asks about every path `execute` will not extract) and #314 (`plan-manifest-invalid`, 3ef059c), all in `adopt-project.py`. The merge of origin/main 3ef059c has ONE conflict, in `_entry_findings`' docstring, where this branch adds "THEN THE SOURCE'S EMPTY SYMLINKS (#303)" and #314 adds "A VALUE NO FILE CAN HOLD IS SAID BEFORE THE VALIDATOR'S WORD ON IT (#255 before #261)" after the same paragraph: both are kept, this branch's first, because it describes the head of the list and #314's its tail. Nothing in code conflicted. `check` and `execute` read one list, and it composes as each feature says: a source's unsafe paths (#196), its empty symlinks (#303), coverage, `_leg_findings` with `plan-root-blocks-manifest` (#305), #166's split, #270's `plan-unwritable-value`, #314's `plan-manifest-invalid`, then #245's relative urls last. So an empty symlink beside an invalid value is still refused wearing `plan-empty-symlink`, with no leg created; probed on the merged tree with an empty link plus `visibility: secret`, plus a line break in `visibility`, and with `project.yaml` answered `root` plus `visibility: secret`, each listing the findings in that order. No test expectation or order changed: the merged tree was rehearsed before #314 landed (69c54c9 + 45e01f4 + c6f441b) and is the same tree object as the pushed merge, and `git diff 3ef059c bbbb541` is this PR's five files and nothing else (+1004/-15). Targeted runs on bbbb541: the new files, `test_adopt_root_shape_paths`, `test_adopt_manifest_values`, `test_scaffold_leg_path_collisions`, `test_agents_md_codes` and `test_cli_reference` 418 passed; `test_shape_doctor` and #377's, #245's and #270's adopt tests 595 passed, 4 skipped (PowerShell lines only a Windows host prints; one operator `user.name`); the other adopt files 234 passed, 1 skipped (the MedxEHR clone) and the guards, literal-names, clone-template, plan-escapes, gitmodules, leg-paths, stdout and Windows-path tests 1101 passed, 1 skipped. **Left out.** - `_verify` and the materializer do not themselves refuse a root `project.yaml` that is not the shape's manifest. This is the issue's second bullet. Once `execute` refuses the plan before any leg, through the same list `check` prints, nothing reaches them with one. It is a follow-up issue. - A top-level file named `project.yaml` only once case is ignored (`Project.yaml`) is still asked `ambiguous-top-level-yaml`'s question, which offers `root`. `check` refuses that answer with the case aside, before any leg. - #171 (a failed clone exits 2 silently) is lane 1's PR #184. This PR only keeps the empty-symlink run from reaching that clone. - Follow-up issues proposed by this PR (two since filed): - the source's own file kept in the root at one of the other shape paths the root's tools read (the pins, the validators, `scripts/repo_shape.py`, the naming policy, `scripts/bootstrap.py`, `contracts/shape-pin.yaml`), each measured above; - a symlink whose target begins with a NUL byte (`\0spec.md`, size 8), which `plan-empty-symlink`'s size test does not see: it fails like #303 (filed as #388); - `_verify` asking whether the split's root `project.yaml` is the shape's manifest (filed as #389); - an entry git cannot check out where `execute` runs, other than an empty symlink or a NUL-led one (a target longer than the platform allows, say), which is still found only by the first clone, after both legs exist. #303 leaves this as a note. Reviewed adversarially at 69c54c9 (APPROVE WITH NITS: 0 blockers, 0 should-fixes, 8 nits). The review reproduced every row of both issues on c7c02fa and on that head, and killed 6 of 6 mutants. No fix round followed: the branch's own commit is as reviewed, and what was added after it is the merge described above. CI is green on Linux, macOS and Windows, with SonarCloud passing, at fce86fa (main 7a8b981 merged in). Its merge with main a73b4e9 passed the targeted set (the three adopt test files, `tests/test_shape_doctor.py` and `tests/test_scaffold_leg_path_collisions.py`): 597 passed, 3 skipped. Closes #303 Closes #305 Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>



Lane: openreposhape-5 (openRepoShape-5)
Claim: #262 (comment)
Claim: #263 (comment)
What was wrong
checksaidplan okto a plan that keeps, in the assembly root,checkpasses a plan that keeps a plain file at a directory the shape writes into (.github,contracts,scripts), andexecutedies in aNotADirectoryErrororFileExistsErrortraceback after both legs are pushed #263): the source's own file named.github,contractsorscripts.executemade and pushed both legs, thenplacedied inNotADirectoryError(.github) orFileExistsError(contracts,scripts);shape/(adopt-project.pycheckpasses a plan that keeps the source's ownshape/in the root, andplace()then writes the shape's collision copy onto it after both legs are pushed: a realshape/README.mdis overwritten whileexecuteprints "nothing was overwritten" and endsadopt-lost, and ashape/Makefile/directory or a file namedshapeis a traceback #262), where the shape writes its copy of each file the root already holds. A realshape/README.mdwas overwritten by the shape's README, on the line afterexecuteprinted "nothing was overwritten", and the verification endedadopt-lost; a directoryshape/Makefile/died inIsADirectoryError, and a file namedshapeinFileExistsError.Both legs were pushed each time, so a corrected re-run met
leg-remote-exists.What this changes
_root_shape_findings(in_leg_findings, socheckandexecute's_refuse_what_check_finds(adopt-project.pyexecuterefuses onlyplan-unresolvedandplan-stale, so a plancheckrejects as uncovered or with a bad leg creates and pushes both legs before it fails verification #168) read one list) playsplaceover the paths the plan keeps (_kept_in_root, the list adopt-project.py accepts a leg mount path that collides with a directory the shape writes, such as--spec-path contracts, so the adoption fails after both legs are pushed (main: at the first bootstrap) #172's mount rule reads) in the orderassembly_root_pathslists what the shape writes:plan-root-blocks-shape(adopt-project.pycheckpasses a plan that keeps a plain file at a directory the shape writes into (.github,contracts,scripts), andexecutedies in aNotADirectoryErrororFileExistsErrortraceback after both legs are pushed #263);shape/<path>, and a kept path at it, a kept directory there or a kept file on the way isplan-root-blocks-shape-copy(adopt-project.pycheckpasses a plan that keeps the source's ownshape/in the root, andplace()then writes the shape's collision copy onto it after both legs are pushed: a realshape/README.mdis overwritten whileexecuteprints "nothing was overwritten" and endsadopt-lost, and ashape/Makefile/directory or a file namedshapeis a traceback #262).Each finding names the first shape path (or copy) it blocks and counts the rest, says what
executewould do, and ends in the remediation the issues ask for: send the entry to a leg,dropit, or rename it in the source and re-runplan. Kept paths are spelled with_spelled(adopt-project.pycheckandexecuteprint a source path raw in a FINDING, so a\r,\n,\x85, U+2028 or ESC in a name overwrites, splits or escapes the line on a terminal, whereplan's questions spell the same path with_spelled#212).It is asked of a disk that keeps case and of one that ignores it, as adopt-project.py accepts a leg mount path that collides with a directory the shape writes, such as
--spec-path contracts, so the adoption fails after both legs are pushed (main: at the first bootstrap) #172 asks its mount paths, and EACH disk answers both questions the rule asks: whether the root holds a shape path, so that a copy is written at all, and whether the copy's place is free.placeaskspath.exists()for the first, and on a macOS or Windows disk that ignores case a keptreadme.mdEXISTS asREADME.md: the shape's README collides with it, its copy goes toshape/README.md, and whatever the source keeps there (a file, a file namedshape, a directory) blocks it. A finding only the second disk makes says so, "once case is ignored, as a macOS or Windows disk does", for the file it names or for the copy it says is written. On Linux this refuses a plan that would adopt there, the trade adopt-project.py accepts a leg mount path that collides with a directory the shape writes, such as--spec-path contracts, so the adoption fails after both legs are pushed (main: at the first bootstrap) #172 already makes for a leg path and a fileScripts.A submodule the plan keeps at the copy (or a directory there that holds nothing else) is
plan-submodule-root's (adopt-project.py: a plan that sends.gitmodulesto one leg and a submodule it registers to another passescheckandexecute, saysadoption verified, and the assembly's recursive clone then fails:planshould ask,checkshould find,executeshould refuse #166) and is said once, there: in a clone it is an empty directory, soplacestops at it and overwrites nothing. A symlink AT the copy is found here, since nothing on main finds one, and is said to be written THROUGH, which is whatplacedoes. A symlink at a shape path counts as the root holding it without being followed: a tree row holds no target, and whether a link leads anywhere is materialize_assembly_root writes the shape files through a root-kept symlink to anywhere on disk, and crashes with a traceback on a link loop, after both legs are pushed #183's question. That errs towards refusing (for a link that leads nowhere the finding describes a copyplacewould not write, in a plan materialize_assembly_root writes the shape files through a root-kept symlink to anywhere on disk, and crashes with a traceback on a link loop, after both legs are pushed #183 refuses anyway) and never passes a planplacewould stop at; a test pins it.executerefuses the same plan before any leg exists, with the same words, and its remediation now says to keep nothing in the root where the shape writes.shape_materialize.copy_in_the_wayasks the disk whereplacewrites a copy, andplaceraisesmaterialize-copy-blockedinstead of writing over a file or into a directory, for a caller that skippedcheck. Its refusal names each path between backticks, as the findings do.Evidence
plan ok, thenexecuteexit 1 after both legs; on this branch eachcheckexit 1 with one finding, eachexecuteexit 2,leg repositories:empty.tests/test_adopt_root_shape_paths.py(120 tests): the six cases throughcheck,executein process (nothing created) andexecuteas a command withgit filter-repo(the empty--local-remote-dirstays empty); the remediation, followed, makescheckpass and, end to end, adopts; the rule in memory with its boundaries (a symlink or submodule on the way is another rule's, a submodule at the copy is said once, a path sent to a leg is not kept, a copy is asked about only where the root holds the path); case, with nine trees only a case-ignoring disk stops at and five it does not, each held to what the unchanged materializer does on such a disk (the kept paths respelled the shape's way,placerun into a real directory: raised or overwrote if and only ifcheckfinds); the materializer's own refusal; and a run with the finding switched off, which stops at the materializer, pushes no split branch and leaves the source'sshape/README.mdas it was.On origin/main (6d8d88b) with the new file: 115 failed, 5 passed. The five are the controls that must pass on both sides: a
shape/with nothing at a copy adopts, the remediation adopts end to end (two), the materializer writes a free copy, and a submodule at the copy is named once by adopt-project.py: a plan that sends.gitmodulesto one leg and a submodule it registers to another passescheckandexecute, saysadoption verified, and the assembly's recursive clone then fails:planshould ask,checkshould find,executeshould refuse #166's rule._root_shape_findings), run into a real directory, on this branch, seeds 11 and 12: 3995 and 4017 trees, 3492 of them failing on main, 0 disagreements; the materializer of this branch raises wherever main raised or overwrote, and writes whatever main wrote. Its scope is narrow: a case-KEEPING disk only (its 34 names have no case variant), regular files only (mode 100644, one entry per path: no symlink, submodule or executable), and a yes/no verdict ("any finding" against "placeraised or overwrote"), which does not check the code or path a finding names.What was left out
checkrefuses no root-kept symlink at or above a path the shape writes, so a link that dangles or leaves the tree makesexecutetraceback, or write the shape's files OUTSIDE the assembly, after both leg remotes are pushed #178. Theplace()defence for a file on the way to a shape's own path (.githuba file, adopt-project.pycheckpasses a plan that keeps a plain file at a directory the shape writes into (.github,contracts,scripts), andexecutedies in aNotADirectoryErrororFileExistsErrortraceback after both legs are pushed #263) is materialize_assembly_root writes the shape files through a root-kept symlink to anywhere on disk, and crashes with a traceback on a link loop, after both legs are pushed #183's_refuse_unwritable, as adopt-project.pycheckpasses a plan that keeps a plain file at a directory the shape writes into (.github,contracts,scripts), andexecutedies in aNotADirectoryErrororFileExistsErrortraceback after both legs are pushed #263 says: this PR'splace()defence covers the collision COPY only (adopt-project.pycheckpasses a plan that keeps the source's ownshape/in the root, andplace()then writes the shape's collision copy onto it after both legs are pushed: a realshape/README.mdis overwritten whileexecuteprints "nothing was overwritten" and endsadopt-lost, and ashape/Makefile/directory or a file namedshapeis a traceback #262).plannotes nothing: no default answer ofplan's writes aleg: rootthat blocks the shape (a path it cannot place isleg: null), so there is no answer of its own to foretell, unlike adopt-project.py accepts a leg mount path that collides with a directory the shape writes, such as--spec-path contracts, so the adoption fails after both legs are pushed (main: at the first bootstrap) #172's.specify.str.casefold(), full folding where APFS and NTFS fold simply, which can only add a refusal for an odd name; Windows' trailing-dot and trailing-space aliasing is not modelled.Composition
git merge-tree --write-treeof this head, against refs that are pushed:_entry_findingskept on both sides.fix/render-single-pass(552763d): clean.fix/scaffold-manifest-values(ca21b57): one conflict inadopt-project.py, the return line of_entry_findings, which the branch has against origin/main as well (adopt-project.pycheckaccepts plan pathsexecuterefuses asunsafe-value(a space or a non-ASCII character), soplan okis followed by a refusal and #166's split instructions can name entriesexecutewill refuse #196'sunsafe_remediation): none of this PR's lines.fix/adopt-root-kept-symlinks(6c44591, materialize_assembly_root writes the shape files through a root-kept symlink to anywhere on disk, and crashes with a traceback on a link loop, after both legs are pushed #183): three conflicts inadopt-project.py: the module docstring'scheckparagraph, where each adds a clause (this PR's), and the docstring and return line of_entry_findings, which it has against origin/main as well.scripts/shape_materialize.pymerges clean:place()gets materialize_assembly_root writes the shape files through a root-kept symlink to anywhere on disk, and crashes with a traceback on a link loop, after both legs are pushed #183's_refuse_unwritableafter the collision block and this PR'scopy_in_the_wayinside it. A symlink AT the copy is found by both rules; whichever lands second keeps one, by skippingSYMLINK_MODEin_shape_blocksas it skipsGITLINK_MODE.Tests run
tests/test_adopt_root_shape_paths.py,test_adopt_leg_path_collisions,_execute_refusals,_plan,_e2e,_submodules,_verify,_mount_ignored,_ignored_shape_filesand_entry_paths,tests/test_shape_doctor.pyas its own stream,tests/test_repo_hygiene.py,tests/test_cli_reference.pyandtests/test_commit_trailers.py, all passing on this head (one skip: a MedxEHR clone the plan test needs; three: PowerShell lines only a Windows host prints). The counts and logs are in the lane's report.Review
An adversarial review of f84fc0f asked for changes. Its one should-fix:
checkdecided with case kept whether the shape writes a copy at all, so on a case-ignoring disk (macOS, Windows) a keptreadme.mdplus a keptshape/README.mdpassedcheckand failed after both legs existed. Fix round 1 (8a496d5) asks each disk both questions and handles the five nits. Its re-verification found no blocker or should-fix: 0 misses in the review's own 401 emulated trees (18 before), 0 in 1041 on a new seed, and every claim in this body checked.Two nits are left:
plan-root-symlinkand this rule's finding). Whichever PR lands second should skipSYMLINK_MODEin_shape_blocks.Fix round 2 (CI)
The first CI run of 8a496d5 failed one test on Linux, macOS and Windows alike: lane 4's one-definition guard
test_both_tools_ask_the_one_definition(tests/test_scaffold_leg_path_collisions.py:333) asserts thatadopt-project.pyhas noCASE_ASIDEof its own. Fix round 1 had imported the shared phrase under that public name. Fix round 2 (65a9262) merges main (c0ed615) and imports the shared phrase as_CASE_ASIDE, the import list's own pattern for names adopt uses privately. The test is untouched. The guard's file passes in full (104), the other scaffold files 225, the adopt files above 252, and the whole suite collects (3434).Closes #262
Closes #263
🤖 Generated with Claude Code