Repository navigation
Add field push and field pull: the offer and the warm behind Git's verbs (remote.md chunk 4) - #172
Conversation
…rbs (remote.md chunk 4) field push is git push with the arguments passed through, then the offer of audiofield-io.md §5.2 for HEAD: every rule entry this machine holds beneath each song's main, announced with the commit and label it satisfies, its missing outputs uploaded to the presigned URLs the site hands back, and a completion per entry. Every entry is offered, not only the new ones, because the site plays by commit and label; the remote asks for no upload when it holds the bytes. A dirty tree pushes and offers nothing, since keys computed from the files on disk would not be the commit's. When a token is held the push carries the credential helper for the origin's host and http.proactiveAuth per invocation, so a project made with field init needs only field login first. field pull is git pull followed by the clone's warm for the new HEAD. The client gains offer, upload and complete; the stub gains the three routes with a staging area and a hash check at completion. Progress in remote.md §10.
The first push against the live site ran from a checkout's dist/ while an older field sat on PATH, and Git was handed !field git-credential, a helper without the subcommand, so it fell back to a prompt. A push runs now, so its per-invocation helper names this very executable and script; clone keeps writing the PATH form into a checkout, where a path would go stale with the next install.
minjudd
left a comment
There was a problem hiding this comment.
🔭 Projector review · model claude-opus-5[1m] · effort xhigh · CHANGES REQUESTED · took 4m 10s
2 finding threads: 0 resolved, 2 open.
Reviewed 0354d61 in a scratch worktree confirmed at that exact SHA, against base 4b71737 — 887 insertions across 9 files.
What I checked
pnpm typecheck is clean and the targeted suite passes: 50 tests across 6 files, including all 8 in push.test.ts and the clone/pull suites, run from the scratch worktree at this head.
Beyond the suite I probed the two claims the tests do not reach:
- The Commander wiring for
gitArgshas no test —push.test.tscallspush()directly withgitArgsalready assembled, so theallowUnknownOption()/allowExcessArguments()passthrough that produces it is unexercised. I ran it against this branch'scommander:-u origin main,--force,origin main --force-with-lease,--dry-runand the bare verb all arrive intact incmd.args. The claim holds; it is just resting on nothing in CI. hello()is memoized (helloPromise ??=), so theawait this.hello()at the head ofoffer()andcomplete()costs one request per client, not two per entry. The "two small requests" accounting inpush.tsis right.
I also read the reset-then-set helper list, runningCliHelper()'s shell quoting (correct POSIX '\'' escaping, and the .ts entry point correctly falling back to the PATH form), and the dirty-tree guard — git status --porcelain reports repo-wide regardless of the project root's depth, so it is stricter than needed rather than looser, which is the right direction.
Findings
Two, both filed inline.
The P2 is the substantive one: client.upload() buffers the whole output with readFileSync and bounds it with a flat 300s total deadline, abandoning both halves of the design download() carries in the same file — streaming, and an idle timeout that re-arms per chunk because "a large artifact on a slow link is not a stall". Using this PR's own documented example of a 61.2 MB push, the deadline demands ~1.63 Mbit/s sustained upstream; below that the abort lands between upload() and complete(), so nothing registers and the next push re-uploads from zero and fails the same way.
The P3 is a stale sentence: docs/remote.md still closes by calling push and pull "the next chunk", one line under the two sections documenting them as shipped.
Not filed
- Exit status on a failed offer. A push whose offers all fail — the refused-token case the suite covers — prints
not offered — …per song and still exits 0, becauseofferArtifactsrecords failures inreport.noterather than throwing. I am not filing it:clone's warm behaves identically,docs/remote.mdstates the intent plainly ("stops that song's offer and says why; what was completed is registered, and the rest is offered again by the next push"), and changing it here would makepushinconsistent with the verb it was modelled on. Worth a deliberate decision across all the remote verbs at some point rather than a change to this diff. - Readiness gate.
docs/projects/remote/readme.mdisstatus: in-progress, and this PR does not change that field, so it is not a readiness flip. The text it adds is an "Amended (as built)" record and a progress entry — statements, not questions — so it introduces no open question to gate on.
upload() buffered the whole render with readFileSync and bounded it with a flat 300s deadline, which is 1.63 Mbit/s sustained for the 61.2 MB push docs/remote.md advertises: below that the abort lands between the upload and its completion, nothing registers, and the next push re-uploads from zero and fails the same way. The body is now a read stream under a timer that re-arms per chunk, which is the rule RemoteTimeouts states and download() implemented; the timer is lifted into one idleGuard both directions share. The stub can stall an upload, and a test holds the error to the same shape the stalled download has.
docs/remote.md documented both verbs with worked transcripts and then closed by calling them the next chunk, which is the state of the file before they existed. What remains is the plan's first chunk.
minjudd
left a comment
There was a problem hiding this comment.
🔭 Projector review · model claude-opus-5[1m] · effort xhigh · CHANGES REQUESTED · took 3m 48s
3 finding threads: 2 resolved, 1 open.
Reviewed 8d17dcb in a scratch worktree confirmed at that SHA — the fix range 0354d61..8d17dcb and the integration diff against 4b71737. pnpm typecheck clean; 51 tests across 6 files pass, one more than the previous head, the new one being the upload-stall test.
Both previous findings are genuinely fixed
The upload path (ef660ec) — verified by measurement, not by reading. The shared idleGuard() is the right shape, and lifting the download's timer into it means the rule RemoteTimeouts states is now implemented once instead of on one side and contradicted on the other. But the new test uses a 25-byte file, so it proves the timer fires when the remote never reads and cannot say anything about a real render. The thing I actually wanted to rule out was subtler: source.on('data', …) attaches a listener before Readable.toWeb(source), and a 'data' listener normally switches a Node readable into flowing mode — which would drain the file from disk regardless of the socket, putting the render back in memory and re-arming the idle timer off disk reads rather than network progress. That would have quietly undone both halves of the fix while every test still passed.
It does not happen. Measuring the exact construction from upload():
- Stalled consumer, 200 MB file — a server that accepts the connection and never reads: 15
'data'events, RSS +2.2 MB. Reads are consumer-paced, so backpressure survives the listener; had flowing mode won, all 200 MB would have been read. - Throttled consumer (~20 MB/s), 200 MB — 3200
'data'events over 11.2s, which is the network's pace, not the disk's. So the timer re-arms on transfer progress, which is what the fix claims. - Integrity at 200 MB and 600 MB — exact byte counts, sha256 match both times, with the explicit
content-lengthalongside a streamed body.
I also chased the RSS figures under a throttled reader, which grow with file size and initially looked like residual buffering. They do not scale with it proportionally, and against the stalled-consumer result they are allocator and GC churn rather than accumulation. I could not substantiate a defect there and am not filing one — recording it so the number is not mistaken for a finding later.
The docs (8d17dcb). The closing paragraph now names what remains and matches the plan's progress entry. No next chunk left in the file.
One new finding
A pull-shaped staleness of exactly the class of the last one, in the plan rather than the manual: §9.9 still records pull as unbuilt. Filed inline; it is one sentence to fix.
To be clear about what I am not gating on: the question in §9.9 being open is fine and does not withhold approval. docs/projects/remote/readme.md is status: in-progress and this PR does not change that field, so it makes no new readiness claim, and a pre-existing open question on a plan already there is not this diff's to answer. The finding is only that the sentence recording why it stays open is now false. The plan's other three "unstarted" references are all to chunk 1 and remain accurate.
The one open question specifically about pull still recorded the verb as unbuilt as its reason for staying open, in the pull request that builds it. The question stays open, because whether pull should materialize the pointers is a real design choice; what it now says is that pull warms the CAS and the index and leaves .field/out to the next build, which is the status quo the section describes, chosen by the implementation.
minjudd
left a comment
There was a problem hiding this comment.
🔭 Projector review · model claude-opus-5[1m] · effort xhigh · APPROVED · took 1m 02s
3 finding threads: 3 resolved, 0 open.
Reviewed 7f81c48 in a scratch worktree confirmed at that SHA — the fix range 8d17dcb..7f81c48 and the integration diff against 4b71737.
What I checked
The §9.9 sweep is the shape it should be: the false clause is gone, the observation about field play survives intact, and the Amended (2026-09-08, as built) line records that pull warms only — the CAS and the index — with the materialize question left open rather than quietly closed. That matches the code: pull() calls warmCache() and nothing else.
I re-ran your sweep both ways rather than taking the rg result. This repository's own guidance is that rg skips binary files while traversing, so one stray NUL byte in a Markdown file hides it from every rg search — and that the check is command grep -rl, not the shimmed grep, which passes -I and shares rg's blind spot. Here the two agree exactly: three hits, docs/projects/remote/readme.md lines 623, 702 and 729, all of them chunk 1 and all accurate. Same single file from rg -l and command grep -rl, so there is no hidden document in docs/ on this pattern. Your sweep was right; it is now confirmed by the tool that could have disagreed.
I widened it past your two phrasings as well — next chunk, not yet built, yet to be built, will carry, remains to build, and any field push/field pull within eighty characters of unbuilt|not yet|forthcoming|next. One hit, docs/project-model.md:42, and it is about field.lock, markers.yaml, automation/ and friends, not these verbs. Nothing else in docs/ still describes push or pull as unbuilt.
Gates. pnpm typecheck clean and project check reports Project plans are valid. src/ is byte-identical to 8d17dcb — I confirmed that with git diff --stat 8d17dcb 7f81c48 -- src/ returning empty — so the 51 tests I ran green on that head carry unchanged, and no test touches these files.
Verdict
Clean. All three findings across this pull request's three heads are fixed and their threads resolved: the upload path streams under a shared idle guard, docs/remote.md names what actually remains, and §9.9 no longer calls a shipped verb unbuilt.
Approving, which review.allow_approve permits in this repository. Worth saying plainly that the merge is still yours — this approval clears the review gate and makes no claim about when the branch should land.
The merge of main brought in recording (#166 to #170) and the remote (#171, #172), and the manual predated both. It now has a "Record a take" section and a "Share a project through a remote" section, rows for record, login, logout, clone, push and pull, `fetched` in the build vocabulary, `choose --take`, the input device list, and FIELD_REMOTE and FIELD_TOKEN. The play section said a live song refuses `--click` and `--from` with `--loop`. Both work: the engine synthesizes the click, and `--from` with `--loop` is a region loop on the live session. The section now says what each does. The `--version`, `devices`, `transport status`, `export` and `import` transcripts are rerun at this head, and the install section says every stem renders through field-audiod, not only effect inserts.
The
push/pullhalf of remote.md chunk 4, the day the site's artifact API and player landed (okamnesiac/audiofield#22) andaudiofield.iowent live.field push [git args]isgit pushwith everything after the verb handed to Git, then the artifact offer of audiofield-io.md §5.2 for the commit atHEAD: every rule entry this machine holds beneath each song'smain, announced with the commit and label it satisfies, its missing outputs uploaded to the presigned URLs the site hands back, and a completion per entry.field pull [git args]isgit pullfollowed by the warmclonedoes, for the newHEAD. The client gainsoffer,uploadandcomplete; the test stub gains the three routes with a staging area and a hash check at completion, as the site does;docs/remote.mdgains the two verbs.Three things §3.3 now records as amended. Every entry beneath
mainis offered, not only the ones the remote lacks, because the site indexes its player by commit and label and an unchanged mix at a new commit needs a ref at that commit; the remote asks for no upload when it holds the bytes, so "upload only those" still holds for the bytes. A working tree with uncommitted changes pushes and offers nothing, and says so, because keys computed from the files on disk would not be the commit's, and the site's player would repeat the lie. And when a token is held,pushandpullpass the credential helper for the origin's host per invocation as well ashttp.proactiveAuth(decision 13 as amended twice), so a project made withfield initneeds onlyfield loginbefore its first push, which is what the site's own instructions will say once this ships.The first push against the live site found one thing, fixed in the second commit: the helper Git was handed was
!field git-credential, which resolves throughPATH, and on this machine that is an older installedfieldwithout the subcommand, so Git fell back to a prompt. A push runs now, so its per-invocation helper names the very executable and script that is running;clonekeeps writing thePATHform into a checkout, where a path would go stale with the next install.Review then found that
upload()had abandoned both halves of the designdownload()carries in the same file: it buffered the whole render withreadFileSyncand bounded it with a flat 300s deadline, which is 1.63 Mbit/s sustained for the 61.2 MB push the docs advertise, and below that the abort lands between the upload and its completion so the next push re-uploads from zero and fails identically. The body now streams from disk under a timer that re-arms per chunk, and that timer is lifted into oneidleGuardboth directions share, so the ruleRemoteTimeoutsstates lives in one place. The stub can stall an upload, and a test holds the error to the shape the stalled download already had.Testing
From the checkout:
The push tests push a built project to a bare repository with the stub as its API and assert the bare has the commit, the stub holds both entries under the commit's labels with one blob between them, a second push moves nothing, a dirty tree and a missing remote push without offering, a refused token is reported per song, and the helper names the running CLI; the pull tests warm a plain clone and build it with a runner that refuses to render; the client tests abandon a stalled upload the way they already abandoned a stalled download. The whole suite needs the daemon:
FIELD_AUDIOD=<path to field-audiod> pnpm testpasses 799 with one skipped.Against the live site, from a fresh project made with the CLI built from this branch (
pnpm build, thennode dist/cli.js):The last two printed
logged in to https://audiofield.io as ninjudd (token in keychain)and then* [new branch] main -> mainfollowed bytone: offered 2 entries, uploaded 1 output (1.1 MB).https://audiofield.io/ninjudd/field-push-demo/songs/tonethen plays the mix as the author's render at9fac71d, with the stem beside it. On a machine that had never seen the project:printed
tone: fetched 2 artifacts (1.1 MB)and thencachedfor bothpad-eqandmain, rendering nothing, which is remote.md §8's definition of done. A secondfield pushprintedEverything up-to-dateandtone: offered 2 entries, already on the remote. A second song added to the same project after the streaming change pushed through the new path and printedtone2: offered 2 entries, uploaded 1 output (1.1 MB), withaudiofield.io/ninjudd/field-push-demo/songs/tone2playing it. What would show the change is wrong: that second push uploading again, the clone's build printingbuiltfor either target, or a push from a tree with uncommitted changes printing anything butpushed; nothing offered.