Repository navigation
Templates ship a .gitattributes, so a clone sees the bytes the pin describes (#51) - #58
Conversation
…scribes (#51) Git for Windows installs core.autocrlf=true by default; a colleague who did nothing but clone a scaffolded project got CRLF in the worktree and every pinned row went red for them alone. #53 covered the clone setup-project.py makes; this covers the next person. `* text=auto eol=lf` in both root templates, PINNED like every other copy (a file that says what the bytes are is worth nothing if it can be edited without the pin noticing); it joins COPIED_VERBATIM and FAMILY_COPIED_VERBATIM and nothing else in the materializer needed to change. Proof, as tests: a `git -c core.autocrlf=true clone` of a scaffolded project shows w/lf for every pinned file and its own validate-pins.py exits 0; the same clone with the file removed shows w/crlf and FINDING shape-copy-drift on every copy. Existing projects report `upstream-added: .gitattributes` on their next update-shape check and take it with `apply --add` (#29 machinery, tested). 583 tests. Lane: xfactory-2 (xFactory-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
@codex review |
There was a problem hiding this comment.
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 15 hours and 56 minutes by commenting @sourcery-ai review. Upgrade to get a review now.
|
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 Sequence diagram for LF-preserving project clone validationsequenceDiagram
participant User
participant Git
participant Project
participant Validator
User->>Git: clone --recurse-submodules
Git->>Project: Apply .gitattributes
Project-->>Git: text=auto eol=lf
Git->>Project: Checkout pinned copies with LF
User->>Validator: validate-pins.py
Validator->>Project: Read copied bytes
Project-->>Validator: LF-normalized bytes
Validator-->>User: Exit 0
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
There was a problem hiding this comment.
🟡 Changes recommended
The updated test fixture logic in tests/test_update_shape_add.py is not robust to CRLF line endings and can fail under core.autocrlf=true, which is a key scenario this PR targets.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR ensures digest-pinned “shape copy” files validate consistently across platforms by shipping a .gitattributes file in both root templates to force LF worktree checkouts regardless of core.autocrlf.
Changes:
- Add byte-identical
.gitattributestotemplates/assembly-root/andtemplates/family-root/, and include it in the materializer copy lists so it is copied + digest-pinned downstream. - Add end-to-end and hygiene tests covering autocrlf-enabled clones, “control” behavior without
.gitattributes, and “upstream-added” adoption of the new file. - Update documentation to reflect the new copied/pinned
.gitattributesand explain why it exists.
File summaries
| File | Description |
|---|---|
| tests/test_update_shape_add.py | Extends “upstream-added” coverage to include the real .gitattributes addition and adoption path. |
| tests/test_scaffold_e2e.py | Adds an end-to-end proof that core.autocrlf=true clones stay LF/green, plus a control that goes red without .gitattributes. |
| tests/test_repo_hygiene.py | Adds hygiene assertions that both templates ship LF .gitattributes with the expected rule and matching bytes. |
| tests/test_family.py | Updates holder copy/pin expectations and asserts the holder receives + pins .gitattributes. |
| templates/family-root/.gitattributes | Introduces the holder’s LF enforcement policy for clones. |
| templates/assembly-root/.gitattributes | Introduces the assembly root’s LF enforcement policy for clones. |
| templates/assembly-root/README.md | Documents .gitattributes in the template’s shipped layout list. |
| scripts/shape_materialize.py | Adds .gitattributes to both roots’ verbatim copy lists so it is copied and pinned. |
| README.md | Documents .gitattributes in the scaffolded tree and explains its purpose relative to digest pins and autocrlf. |
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| def unname_everywhere(text: str, entry: str) -> str: | ||
| """`name_in_list` inverted, for every list at once. | ||
|
|
||
| How the copy lists read BEFORE a file joined them. The entry is matched as | ||
| a whole line so a comment mentioning the same name is left where it is: a | ||
| comment names nothing, and `upstream_copies` reads the tuples. | ||
| """ | ||
| return text.replace(f' "{entry}",\n', "") |
…counted 881 -> 945 #58 landed first and moved the README to 881 lines. This merge keeps its `.gitattributes` rows and rationale entry, and re-counts this branch's cap entry from 872 -> 936 to 881 -> 945 after it. The tree is identical to the branch rebased onto 0a84d6c, on which 583 tests passed; the ruleset refuses a force-push, so the rebase is carried as a merge. Lane: xfactory-2 (xFactory-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ffold leaves (#54) (#57) Brett Heap, 2026-09-05: "we have the case for windows only and wsl/linux users and mac users. we need to make sure it is explained for all. i think we have nothing so far for mac users" then "go, file the issue and pick it up after #49 lands". Read against main after #46 and #49, macOS was one line (`brew install gh`), nothing had ever run on a Mac, the `gh api` one-liner decoded with a flag BSD base64 does not take, and a first-time user could neither rehearse the run nor learn what a failure part-way leaves behind. README § Quick start: the platform block is now Linux / macOS / Windows, natively / Windows via WSL2. The macOS paragraph names where git, make and python3 come from (the Xcode Command Line Tools), that Homebrew is its own install (linked, not pasted) and prints the Apple Silicon PATH line, `brew install gh`, `brew install git-filter-repo` only for adopting, and that the stock /bin/bash 3.2 is enough because neither bash entry point uses newer syntax. `base64 -d` becomes `base64 --decode`. A "Rehearse first, creating nothing" paragraph documents `--local-remote-dir <dir>` and says exactly which route still touches the network (the command fetches setup.sh and setup.sh self-bootstraps; from a checkout nothing does) and that `--org` is only a string there. An "If it fails part-way" paragraph gives the creation order (spec, code, root last), that there is no rollback, the refusal of a second run, `--reuse-empty-repo` as root-only, `gh repo delete` and its scope, and `internal` as Enterprise Cloud only — each sentence checked against scaffold-project.py, shape_materialize.py and setup.sh. tests.yml gains a `tests-macos` job on macos-latest mirroring the Linux job (same action shas, same pins, same per-invocation identity), plus a step that prints /bin/bash --version and runs `/bin/bash -n` on setup.sh and on openRepoShape separately, because `bash -n a b` parses only `a`. Green on macos-latest is what "runs on a Mac" means here; there is no Mac on this side. Adversarial Opus review before opening found four defects, all fixed: the rehearsal paragraph claimed "no network" of a route that fetches setup.sh and clones the standard; the failure paragraph attributed the "NOTHING has been rolled back" line to any failure when only a failed push prints it, and described a clone-failure message that setup.sh prints only when the target already exists; the tests.yml comment claimed `bash -n` catches mapfile, declare -A and local -n, which are runtime builtins, not grammar; and the macOS prose asserted which bash the runner's /bin/bash is. README 872 -> 933, cap moved with the rationale beside it. AGENTS.md unchanged. 570 tests pass on Linux. Copilot's one review finding on the PR is folded in: the macOS paragraph now names the exit when the Command Line Tools' python3 is too old (older Tools shipped 3.8). #58 landed first, so the cap entry reads 881 -> 945 after #51's; the ruleset refuses a force-push, so the rebase rode as a merge commit. 583 tests pass on Linux; tests, tests-macos and tests-windows green on the merged head; the macOS runner's /bin/bash is 3.2.57 and parsed both entry points. Lane: xfactory-2 (xFactory-2) Co-Authored-By: Claude Fable 5.1 <[email protected]>
…tes, the shim's --shape-ref length bound (#63) (#65) * Empty $OPENREPOSHAPE_REPO means unset, the standard's own .gitattributes, the shim's --shape-ref length bound (#63) Three Copilot inline comments read after their PRs merged (#56, #58, #60) and deferred as cosmetic. None changes what a user sees today; each left a statement in the tree that was not true, or a bound present in one entry point and absent from the other. setup-project.py: the comment above the $OPENREPOSHAPE_REPO read claimed that checked_value refuses an empty value; the truthiness test in front of it means an empty value is never checked and falls to DEFAULT_SHAPE_REPO, exactly as setup.sh's ${OPENREPOSHAPE_REPO:-<default>} does. Ruled on #63: empty means unset in both entry points. Behaviour unchanged; the comment now says so. One test per entry point pins it offline by handing the child a url.<file-uri>.insteadOf <default> rewrite through GIT_CONFIG_COUNT, so the echoed clone line naming the default URL proves the empty value fell through. .gitattributes at the root: the templates got theirs in #51; the checkout that ships them had none, so a core.autocrlf=true clone of openRepoShape itself turned every LF into CRLF and unname_everywhere() in the update-shape-add tests, which matches a copy-list line whole, stripped nothing. Same rule, * text=auto eol=lf, its own header; git add --renormalize is a no-op because every tracked file is already LF. Hygiene tests pin the rule and its agreement with both templates; the helper matches \r?\n anyway, for a checkout made before this landed. setup.sh: the --shape-ref case mirrored REF_RE's alphabet but not its 255 character bound, so an over-long ref reached git checkout in the temporary clone. A length check after the case refuses it, naming the length rather than echoing the value. bash 3.2 clean. A 256-character ref joins both parametrised refusal tests; a dedicated shim test asserts the refusal names --shape-ref and 255, exits 2 and does not echo the value. 611 -> 619 tests. Lane: xfactory-2 (xFactory-2) Co-Authored-By: Claude Fable 5.1 <[email protected]> * PR #65 review: the shim refuses an over-long or control-character --shape-ref before anything echoes it (#63) Copilot on PR #65: the shape `case` echoed the raw --shape-ref in its refusal, so a value holding a newline could forge a line onto stderr, and an over-long ref that also failed the shape was echoed as 255+ characters of noise. Three checks now run in order - length, then a control character, both refusing without naming the value the way the OPENREPOSHAPE_REPO guard above them does, then the shape case, which by then only ever sees a printable ref of at most 255 characters. Two tests: a newline-carrying ref is refused and the forged line never reaches stderr; the over-long test is parametrised over a legal shape and an illegal one, and neither is echoed. Also from the review: the comment claiming the case is "only reached when non-empty" (it runs unconditionally and matches nothing) is reworded, and the hygiene test named "repositorys" is renamed. Lane: xfactory-2 (xFactory-2) Co-Authored-By: Claude Fable 5.1 <[email protected]> --------- Co-authored-by: Claude Fable 5.1 <[email protected]>



Lane: xfactory-2 (xFactory-2)
Claim: #51 (comment)
Closes #51.
What this changes
Both root templates ship a
.gitattributeswith* text=auto eol=lf, pinned like every other copy. Brett Heap, 2026-09-05: "pick up #50 and #51 too".A scaffolded project pins its copied files by sha256 in
contracts/shape-pin.yaml, andvalidate-pins.pyrecomputes each digest from the bytes on disk. Git for Windows' installer default iscore.autocrlf=true, so a colleague who did nothing but clone the finished project got CRLF in the worktree and every pinned row was false for them alone. #53 fixed the clonesetup-project.pymakes; this fixes the next person's, by putting the answer in the project where the digests are. No path is named in the file: every pinned file is text, andtext=autoleaves binary detection with git for whatever the project adds later.templates/assembly-root/.gitattributesandtemplates/family-root/.gitattributes, byte-identical, the WHY in the comment block.scripts/shape_materialize.py: the file joinsCOPIED_VERBATIMandFAMILY_COPIED_VERBATIM. Nothing else in the materializer, inadopt-project.py,scripts/family.pyorupdate-shape.pyneeded to change: they all read those tuples.The proof, as tests
A
git -c core.autocrlf=true clone --recurse-submodulesof a scaffolded project — git honours that setting on every platform — showsw/lffor every pinned file ingit ls-files --eol, and the clone's ownvalidate-pins.pyandvalidate-manifest.pyexit 0. The control, the same clone with.gitattributesremoved and committed first, showsw/crlfandFINDING shape-copy-drifton every copy: the bug report this closes. A family holder carries the same row. An existing project scaffolded before this change seesupstream-added: .gitattributesfromupdate-shape.py checkand takes it withapply --add .gitattributes, both validators green afterwards.Expected downstream drift: every existing project and holder reports
upstream-added: .gitattributes(exit 1) on its nextupdate-shape.py checkuntil a human runsapply --add. That is #29's machinery doing what it was built for.Evidence
python3 -m pytest tests -q→ 583 passed (573 onmain, +10). Both CI jobs on this PR.Merge word: Brett Heap, 2026-09-05, "merge #50 and #51 on green too".
🤖 Generated with Claude Code
Summary by Sourcery
Ship and pin a shared
.gitattributespolicy so cloned projects preserve the bytes recorded by their shape pins across platforms.New Features:
.gitattributesto both root templates so scaffolded projects and family holders enforce LF worktree line endings for digest-pinned files.Bug Fixes:
core.autocrlf=true.Documentation:
.gitattributesfile in the project and template layouts.Tests:
.gitattributes, and updating existing projects with the new file.