Repository navigation
field init pins LF in every project it creates (windows-portability.md §1.1) - #159
Conversation
…d §7.2) The engine repo got its .gitattributes in #157, and every project field creates was still born without one line of it: init wrote the seven LFS filter rules and nothing else, so a project cloned to a Windows machine with git's default core.autocrlf=true had every text file rewritten to CRLF on disk — and field hashes working-tree bytes. Asset pins, .scd action keys, and check's byte-wise formatting gate all change their answers while git status stays clean, which is windows-portability.md §1.1 happening to user projects after the engine fixed it for itself. init now writes the whole file: the blanket LF rule first, the LFS rules after it (last match wins, so audio is never converted), and *.state binary — captured plugin state is named by its own sha256 and refused if the bytes move, so it must never ride git's binary heuristic. The mechanics of the rule are the ones #157 proved with a real Windows clone and its review reproduced independently, including the .state override holding against a CRLF blob with no NUL bytes. The new test asserts the shape that carries the guarantee — the LF rule preceding every override — and failed against the unfixed init before the change. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Starting review of 2f0db7d. |
eve-nyx-13
left a comment
There was a problem hiding this comment.
No findings on 2f0db7dbdd93ed78d0f7a9485318b7330adcd426; this is an approval in words. Submitted as a COMMENT review because the reviewing account authored the pull request. One coordination note at the end that no thread can carry, because it lives outside this diff's base.
The guarantee, reproduced end to end
The shape assertions are the right test, but they test the file rather than the behaviour, so I built the behaviour test: a project made by this init, committed, then cloned with core.autocrlf=true — the configuration §1.1 measured the damage under.
fresh clone of an init-created project, core.autocrlf=true
shared/instruments/creek.scd disk=79db67b5cd762953 blob=79db67b5cd762953 CR=0 MATCH
shared/plugins/deadbeef.state disk=834ef20666084c99 blob=834ef20666084c99 CR=3 MATCH
field.yaml disk=4ef9db78f7b3d4ee blob=4ef9db78f7b3d4ee CR=0 MATCH
git status: clean
The .scd and the manifest land at LF with their committed hashes intact, and the .state blob keeps its CRLF bytes byte-for-byte — committed CRLF stays CRLF, which is the property plugins.ts needs and the one a blanket text rule would destroy.
Worth recording that audio is protected by a different mechanism here than in the engine's file, and that it works:
sample.wav: text: unset <- from `-text` on the LFS line, not from a `binary` rule
sample.wav: eol: lf <- inherited and inert, exactly as on the engine's *.state
-text alone short-circuits the eol handling, so the seven LFS rules need no binary counterpart. Same conclusion as #157's review, reached through the LFS spelling instead.
The test earns its place
It fails against the unfixed init, with the assertion the body predicts:
× init .gitattributes > pins LF for text before the binary overrides
→ expected '*.wav filter=lfs diff=lfs merge=lfs -…' to be '* text=auto eol=lf'
Asserting lines[0] after stripping comments and blanks is the right shape for it: it catches a rule inserted above the LF line, and the full-string toContain checks catch a dropped -text on any LFS rule, which is the other way this file could quietly stop working.
pnpm typecheck is clean at this head. The test runs in 1.1–1.5s warm, in line with the other init-based suites. No other test in src/ reads .gitattributes, so there is no regression surface beyond the one file.
The existsSync guard, stated so it is on the record
A project that already has a .gitattributes keeps it, which the body says and which is the right call for a scaffolder. The consequence is that projects created by the old init never acquire the LF rule and nothing tells them — field check has no opinion on .gitattributes. Not this diff's job, and examples/bloom is covered by the engine's own file, so nothing in the tree is affected. Worth a line in the inventory if you want the gap recorded rather than rediscovered.
Merge ordering, which is the one thing to decide
This is based on main, where §7 does not exist yet — it arrives with #158. So this diff cannot update the inventory entry it implements, and the moment both are merged, §7.2 will describe as outstanding, and as "the sharpest item on this list", a defect that is fixed.
Either order works, but the second one through has to carry the sweep:
- If #158 merges first, rebase this onto it and strike or mark that bullet in the same diff, the way #158 stacked on #157.
- If this merges first, #158 lands with §7.2 already marked as done rather than pending.
Flagging it here rather than as a thread because no line in this diff owns it. It is the same failure this series has now corrected twice — a plan describing a state its own commit ended — and it is cheapest to catch before the merge rather than after.
minjudd
left a comment
There was a problem hiding this comment.
🔭 Projector review · model claude-opus-5[1m] · effort xhigh · CHANGES REQUESTED · took 2m 58s
1 finding thread: 0 resolved, 1 open — this review opens it.
The change is correct, and I measured it rather than reasoning about it. I built the old and new templates into throwaway repositories under core.autocrlf=true, committed an LF .scd, deleted it and checked it out again the way a Windows clone would:
old template → working tree is CRLF (hash changes) sha256=8e90119dbb5c58a0
new template → working tree is LF (hash preserved) sha256=f7a42fd120a073e4
Two different digests on the same authored bytes is the whole bug, and this template is what closes it. The ordering the code comment relies on is real: * text=auto eol=lf first, then -text on the LFS patterns and binary on *.state — binary expands to -diff -merge -text, and the later -text is what keeps git from reconverting, exactly as the comment claims. The emitted file ends with a single trailing newline, unchanged from before.
src/commands/init.test.ts passes at this head (vitest run src/commands/init.test.ts, 1 test), and tsc --noEmit over the whole tree is clean — worth stating separately because pnpm build excludes test files, so a new test file's types are only ever checked by the typecheck gate. Both in-code citations point at windows-portability.md §1.1, which on main is "The checkout corrupts content hashes before any code runs" — the right section.
One thing I want to record without filing it, because this diff did not introduce it: the fix reaches new projects only. writeFileSync is guarded by if (!existsSync(gitattributes)), so a project created before this lands keeps the seven-line LFS-only file forever, and nothing anywhere will tell its owner — grep -rn gitattributes src/ returns matches in init.ts and nowhere else, so field check never looks at the file. The title scopes itself honestly to "every project it creates" and I am not asking this pull request to widen; but the measurement above applies unchanged to those projects, and §7.2 in #158 is the natural place to record that the item is only half closed once this lands. examples/bloom is not affected — it carries no .gitattributes of its own, so the repository-root file from #157 governs it.
CI: the one linux run on this head failed in four seconds with the Actions spending-cap annotation, as on the rest of the stack. mergeable_state is blocked rather than dirty — this branch does merge with main cleanly, unlike #157.
Brings the branch up to date with main. Clean merge: main's changes to init and the rest of the tree do not touch the .gitattributes template this branch adds.
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.3 · model claude-opus-5-5 · effort xhigh · CHANGES REQUESTED · took 6m 13s
This pull request makes field init write a .gitattributes that pins text files to LF line endings in every new project. field hashes files as they sit on disk, for asset pins, .scd action keys, and check's formatting gate. Git for Windows defaults to core.autocrlf=true, which rewrites text to CRLF on checkout and changes those hashes while git status stays clean. The new file puts * text=auto eol=lf first, then the seven LFS audio rules and a *.state binary rule, so the later, more specific rules win for audio and plugin state. A project that already has a .gitattributes keeps its own, so the change covers only projects that init creates.
1 finding thread: 0 resolved, 1 open
The open thread comes from an earlier review of 2f0db7d. It says the title cites windows-portability.md §7.2, a section that exists only on #158's branch. Nobody has answered it, and the title at 6babd61 is unchanged, so the thread stays open. Both #157 and #158 now merge cleanly, so either way out that the thread names works: land #158 first, or retitle to cite §1.1, which both code comments already cite and which is on main. The squash merge takes the title as the commit subject, so editing the title at merge time also settles it. Nothing in the code blocks this pull request.
Covered 2 of 2 changed files; no generated files.
The head was reviewed by reading only. Its author, eve-nyx-13, has no write access to this repository, and its first commit names authors outside it, so no test, build, or script from the head ran. To check the attribute precedence, I copied the generated file by hand into a scratch repository and ran only git there.
Suggestions
src/commands/init.test.ts:12: The header says "The engine repo carries this file by hand", but neither this head normainhas a.gitattributes. That file arrives with #157. Drop the sentence, or land #157 first.docs/project-model.md"Assets": No doc says that a new project pins LF, andinitrefuses a directory that is already a project. So a project created before this change gets the rule only by hand. One sentence beside the paragraph on SHA-256 and the LFS OID would tell owners of existing projects to add* text=auto eol=lfabove their LFS lines.
What was checked
- Attribute precedence. In the scratch repository,
git check-attrreportstext: autofor.scdand.yaml,text: unsetwithfilter: lfsfor.wav, andtext: unsetfor.state. After a commit and a checkout undercore.autocrlf=true, a CRLF.scdcame out with 0 CR bytes, and a CRLF.stateblob kept all 3 of its CR bytes. - The comments' claims.
indexStateBlobsinsrc/audio/plugins.tsnames each.stateblob by its own SHA-256, andtoPluginWirethrows when the bytes stop hashing to that name, as the comment ininit.tssays. - Callers. 32 other test files call
init(). None asserts the file's content, and none writes a carriage return. The only other consumer is thegit lfs ls-filescheck inclone.test.ts, which still findspad.wavbecause the LFS lines are unchanged. - The new test runs and typechecks.
vitest.config.tsincludessrc/**/*.test.ts, and every import in the test is used, asnoUnusedLocalsrequires. Asserting thatlines[0]is the LF rule proves that the rule precedes every override. - The merge commit.
6babd61mergesmainat3d26d52, which is also the merge base, so the diff againstmainis exactly the two files above. - Plan readiness.
windows-portabilitystays atstatus: draft, and this change does not edit it, so no readiness gate applies.
main has no .gitattributes at the root; that file arrives with #157, and this branch can land before it. The rest of the comment already says why the test exists.
field hashes .scd programs and compares manifests with their canonical form as the bytes sit on disk, so the line-ending rule init now writes is part of how content identity holds across platforms. init keeps an existing .gitattributes, so the paragraph also tells the owner of an older project which line to add by hand.
§7.2 filed the field init item as unclaimed, but #159 is open and makes init write the text=auto eol=lf line and the *.state override. Say so, as §7.4 names other pull requests. §7.4 cited "the §1.5 invariant", which is the daemon-binary finding and states no rule about separators. Write the rule in place and attribute it to chunk 2 (#160), where it arrives. Also from the review's suggestions: name pnpm/action-setup@v4 rather than corepack in the CI bullet, and add the workers' fcntl import and pkill advice to §7.3.
ninjudd
left a comment
There was a problem hiding this comment.
📽️ Projector review · 0.7.3 · model claude-opus-5-5 · effort xhigh · CLEAN · took 1m 58s
This pull request makes field init write a .gitattributes that pins text files to LF line endings in every new project. field hashes files as they sit on disk, for asset pins, .scd render inputs, and check's formatting gate. Git for Windows defaults to core.autocrlf=true, which rewrites text to CRLF on checkout and changes those hashes while git status stays clean. The new file puts * text=auto eol=lf first, then the seven LFS audio rules and *.state binary, so the later rules win for audio and plugin state. Since 6babd61, two commits drop the test comment's claim that the engine repository already has this file and add a paragraph to docs/project-model.md, and the title now cites §1.1.
1 finding thread: 1 resolved, 0 open
The one thread, about the title citing §7.2, is fixed. The title at 4eabd58 cites windows-portability.md §1.1, and that section is on main at 817b01f. The author's reply says so, and the thread is already resolved.
Covered 3 of 3 changed files; no generated files.
The head was reviewed by reading only. Its first commit is by eve-nyx-13, who has no write access to this repository, so no test, build, or script from the head ran. To check the Git behavior that the code and the new paragraph describe, I ran only git in scratch repositories that hold hand-made copies of the files.
This head looks clean. A human approval is what remains.
Suggestions
docs/project-model.md:216: Adding the line changes how Git writes files from then on, not the files already on disk. In a scratch test, a clone made undercore.autocrlf=truebefore the line arrived still had CRLF in its.scdaftergit pullbrought the line in, andgit statusstayed clean. One more sentence could tell readers that such a checkout needs its files written again, for example by cloning afresh.
What was checked
- Attribute precedence. In a scratch repository,
git check-attron the generated file reportstext: autofor.scdand.yaml,text: unsetwithfilter: lfsfor.wav, andtext: unsetfor.state. After a commit and a checkout undercore.autocrlf=true, a CRLF.scdcame out with no CR bytes, and a CRLF.stateblob kept all of them. - The new paragraph. Each claim matches the code.
src/generators/supercollider.ts:126hashes the program file into the render's inputs,unformattedFilesinsrc/model/project.tscompares each file's raw text with its canonical form, andinitwrites the file only when none exists. - The comments.
indexStateBlobsandtoPluginWireinsrc/audio/plugins.tsname each.stateblob by its SHA-256 and refuse a blob whose bytes have moved, as the comment ininit.tssays. The test header no longer claims that the engine repository has a.gitattributes. - Callers. 32 other test files call
init(). None asserts the file's content or writes a carriage return, and thegit lfs ls-filescheck inclone.test.tsstill findspad.wavbecause the LFS lines are unchanged. - The new test runs and typechecks.
vitest.config.tsincludessrc/**/*.test.ts, every import in the test is used, and asserting thatlines[0]is the LF rule proves that the rule precedes every override. - Against
main.mainhas moved to817b01f. Its only change to these files is in an earlier section ofdocs/project-model.md, andgit merge-treemerges it with this head cleanly. - Plan readiness.
windows-portabilitystays atstatus: draft, and this change does not edit it, so no readiness gate applies.
…s (windows-portability.md §7) (#158) Adds §7 to the [Windows portability plan](../blob/windows/inventory/docs/projects/windows-portability/readme.md): a swept inventory of every remaining Windows item, grouped by where it lands — the committed chunks, findings not yet in any chunk, the workers' own transport decision, and consumers that inherit the port rather than adding to it. Sections append at the end per the docs convention, so nothing renumbers. ## How it was gathered Every spawn site and path literal in `src/` (`grep` over `spawn|execFile|execSync` and absolute-path strings), the daemon sources, the Python workers, and the test surface — cross-checked against what chunks 1 and 2 actually hit when they ran, which is how the labels bug earned its §5 amendment and how three of the items below surfaced. Line citations are pinned to `main` at `4f90a87`. ## The finding worth reading first **`field init` plants chunk 1's defect in every new project** (`commands/init.ts:60`): the `.gitattributes` it writes carries only the seven LFS filter lines — no `* text=auto eol=lf`, no `*.state` override. A project created on or cloned to Windows gets the §1.1 checkout corruption against its own committed `.scd` programs and asset pins, and the engine repo's own fix cannot reach it. #159, open against `main`, makes `init` write both halves, and §7.2 names it. ## Also new - The `field insert add` picker (#155) decodes raw-mode CSI sequences that nobody has run under Windows Terminal/ConPTY — one manual pass needed. - `homeRelative` hardcodes `/` so tilde-shortening never fires on Windows; `defaultExportDir()` misses a OneDrive-redirected Desktop. Warts, not breaks. - `sclang`'s convenience fallback probes `/Applications/…`; PATH and `FIELD_SCLANG` already work everywhere. - The workers' Python end has no named-pipe socket family in CPython, and its `fcntl` import fails on Windows before the socket is reached, so their transport and single-owner lock are a decision of their own, not §2.1 verbatim. - The UI plan (#156) and the unlanded `field open` are consumers of this port, not additions to it — noted so their reviews ask the right question. §7.4 also states chunk 2's rule for separators: a project-relative path is slash-separated wherever it is data, and a path printed for a person keeps the platform's separator. ## Testing The change is one plan file, so the checks read it. Run these from the root of a checkout of `windows/inventory`. They need no build and change nothing in the tree. ```sh project check git diff origin/windows/gitattributes --stat git show 4f90a87:src/commands/init.ts | sed -n '55,72p' git show 4f90a87:python/worker/src/field_worker/server.py | grep -n '^import fcntl\|AF_UNIX' git show 4f90a87:src/workers/client.ts | grep -n 'brew install uv\|pkill -f' ``` `project check` prints `Project plans are valid.` The diff against the base touches only `docs/projects/windows-portability/readme.md`. The `init.ts` lines show the LFS-only `.gitattributes` §7.2 describes, at lines 60 and 71. The `server.py` grep prints line 23 (`import fcntl`) and line 129 (`AF_UNIX`), and the `client.ts` grep prints lines 122, 305, and 345, the citations §7.3 makes. The change is wrong if `project check` reports an error or if any of those greps prints a different line number than §7 cites. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- projector-summary v=1 sha=1283ef807c8d387b511a8114b3d62717bdf9bd81 --> 📽️ **Projector summary** of 1283ef8: https://field.amnes.ac/reviews/158 --------- Co-authored-by: Claude Fable 5 <[email protected]> Co-authored-by: Justin Balthrop <[email protected]>
The sharpest standalone item from the §7 inventory (#158): #157 gives the engine repo its
.gitattributes, but every projectfield initcreates is still born without the line that matters.initwrote the seven LFS filter rules and nothing else, so a project cloned to Windows under git's defaultcore.autocrlf=truegets CRLF in every text file — and field hashes working-tree bytes, so asset pins,.scdaction keys, andcheck's byte-wise formatting gate all change their answers whilegit statusstays clean. That is §1.1 of the plan, "The checkout corrupts content hashes before any code runs", happening to user projects rather than to the engine.What init writes now
The blanket LF rule first, the overrides after it — last match wins, which is the mechanism, and the same shape #157 proved with a fresh clone on a real Windows machine (0 CR bytes,
creek-kit.scdback at its committed hash). #157's review independently reproduced the.stateoverride holding against a CRLF blob with no NUL bytes, so the one new pattern here rides proven mechanics.What the docs say
docs/project-model.md"Assets" now says that a new project pins LF, and why: field hashes files as they sit on disk, not as Git stores them.initkeeps a.gitattributesthat already exists, so a project created before this change never gets the rule on its own. The same paragraph tells that project's owner to add* text=auto eol=lfby hand above the LFS lines.Testing
I ran these from the root of a worktree of this branch at
4eabd58,/Users/justin/amnesiac/field/.claude/worktrees/agent-a1beb3dd6e289bbeb, afterpnpm install --frozen-lockfile. Substitute your own checkout's path where it appears below.pnpm buildwritesdist/, which is gitignored, and the scratch project stays under/tmp/field-159-albumuntil you delete it.pnpm typecheck pnpm exec vitest run src/commands/init.test.tstsc --noEmitprints no errors, and vitest reportsTests 1 passed (1). The test asserts that the first rule after comments and blank lines is* text=auto eol=lf, that all seven LFS rules keep-text, and that*.state binaryis present. Againstmain'sinitit fails with the message below, which is what you see if the LF rule is missing or no longer first:To reproduce that failure, run
git show origin/main:src/commands/init.ts > src/commands/init.ts, rerun the vitest command, thengit restore src/commands/init.ts.To check the attributes a new project resolves, build the CLI and initialize a scratch project:
initprintsinitialized Field project at /private/tmp/field-159-album. Thensong.scdandfield.yamlshowtext: autoandeol: lf, andsample.wavandpad.stateshowtext: unset, so Git converts text and never touches audio or plugin state. Ifsong.scdshowstext: unspecifiedandeol: unspecified, which is whatmain's LFS-only file resolves to, the project does not pin LF, and a Windows clone writes CRLF.The full suite (
pnpm test, withFIELD_AUDIODpointing at a builtfield-audiod) passes 800 tests with 1 skipped, andproject checkprints "Project plans are valid."🤖 Generated with Claude Code
📽️ Projector summary of 4eabd58: https://field.amnes.ac/reviews/159