Repository navigation
Install the shared lifecycle editable, not as a copy - #67
Conversation
`field-worker` is our own source rather than a pinned release, but each worker declared it as a plain path dependency — and uv installs those as a copy. So the moment #65 added `optional_number` to `field_worker.protocol`, every worker venv held a `field_voiced` reading from the source tree and a `field_worker` frozen at whatever the last sync captured. The failure is worse than the cause. The daemon died at startup with `ImportError: cannot import name 'optional_number' from 'field_worker.protocol'`, pointing at the module that wanted the symbol rather than the stale copy that lacked it, and the CLI reported it as `field-voiced did not start — run field setup voiced`. That advice is wrong twice over: setup had been run, and running it again would not have helped, because `uv sync` does not reinstall a path dependency whose version has not changed. Found by a generation failing on bloom, which is the only place it could be found: nothing in this repo imports `field_worker` through an installed venv. The regression test asserts the declaration rather than the installed layout — the venvs are ambient and CI has none while `pnpm test` runs, and the declaration is the thing that was actually wrong. Both workers get it. aced had the same latent break and would have hit it the next time the lifecycle grew anything.
|
Starting review of 0360aca. |
ninjudd
left a comment
There was a problem hiding this comment.
Reviewed 0360aca. One finding, P3, on the regression test rather than the fix — the fix itself is right and I confirmed it produces the install shape it claims.
The declaration change lands correctly in both lockfiles, in both places each one records it: requires-dist flips to { name = "field-worker", editable = "../worker" } and the package's own source flips from { directory = "../worker" } to { editable = "../worker" }. So this is a real resolution change rather than a comment plus a no-op.
The intended install shape is observable here: python/voiced/.venv/.../site-packages now holds _editable_impl_field_worker.pth and a bare field_worker-0.1.0.dist-info, with no copied field_worker/ tree beside them — a pointer at the source rather than a snapshot of it, which is exactly what stops the venv drifting from python/worker/src. One honest caveat: I could not reproduce the original failure, because that venv has already been re-synced past it. I verified the post-state and the declaration, not the stale copy.
The test's textual matching is sturdier than it first looks. startsWith('field-worker = ') cannot be satisfied by the "field-worker", entry in dependencies, since that line starts with a quote — so it can only match the [tool.uv.sources] line it means. And asserting editable = true on that single line, rather than anywhere in the file, means a stray editable = true under some other source could not make it pass. Both matter for a test whose whole job is to fail when one line is wrong. pnpm vitest run src/workers/setup.test.ts is 15 passed.
Agreed on scoping it to the declaration rather than the installed layout. CI has no venvs during pnpm test, so an assertion about site-packages would have been unconditionally skipped there — the same ambient-state trap #61/#62 hit, and the reason the aced half of this could be fixed without anyone having an aced environment to check it against.
The new test hardcoded [ACED_SPEC, VOICED_SPEC] while `SETUP_SPECS` in generate.ts is the list a worker cannot be left out of — `field setup <name>` resolves through it, so a worker missing there is a worker nobody can install. A third worker would necessarily be added to that list and not to this one, and would then ship the same stale-copy break this PR exists to fix. Exported it and looped it in both places the test enumerated workers. Verified by adding a third spec with a non-editable field-worker: the test fails naming the package, where before it stayed green.
|
Starting review of b26c952. |
|
Reviewed b26c952 — no findings. The finding from 0360aca is fixed, and the fix goes one step further than what I asked for in a way that is worth calling out.
Verified at this head rather than assumed. One thing I checked and am not raising, since it turns on a convention this repo does not have: the new Also not raising, but recording as an observation rather than a request: the canonical worker list now lives in CI's Linux and macOS jobs were still running when I finished; that is independent of this review either way. The thread stays yours to resolve. |
Seven findings, and the through-line is that a command whose job is saying what is running has to be right about it or it is worse than absent — someone runs it precisely when they already suspect something. Two duplicated rules, both of which this change was about to make worse. The socket path is shortened against the `sun_path` limit in audiod/client.ts and workers/client.ts, and probing with a bare absolute path would have reported a running daemon as not running on any deep enough checkout. It is one exported function now, used by all three. And `SETUP_SPECS` was exported in #67 to be the canonical worker list, with a comment saying anything enumerating workers should read it; this was the first code since to enumerate workers and it kept a copy — which would have left the newest worker, the one most likely to be skewed, missing from the report entirely. The test sources its expectation from the same list, so adding a worker now breaks it loudly. Three ways the probe could describe a daemon wrongly. It never checked `daemon`, so a stale socket put one worker's process under another's name. It treated any parseable line as a hello, so an `ok: false` refusal printed as a healthy daemon with an unknown version. And `field-audiod` got its protocol printed and never checked, though AudiodClient refuses a mismatch and `--watch` gates on the version — so a stale audiod appeared as a clean line to someone running this command to find out why playback broke. audiod is compared against audiod's own number: its 1 and the workers' 2 are unrelated counters, and the test pins that they differ so the trap stays real. And the duplicated literal I removed came back as a duplicated reader, resolving the package root from two files at two depths and disagreeing on failure — mine threw at module scope, outside `fail()`, so every command would have died with a stack trace. One shared reader, so `field --version` and `field version` can only be wrong in the same way.
Seven findings, and the through-line is that a command whose job is saying what is running has to be right about it or it is worse than absent — someone runs it precisely when they already suspect something. Two duplicated rules, both of which this change was about to make worse. The socket path is shortened against the `sun_path` limit in audiod/client.ts and workers/client.ts, and probing with a bare absolute path would have reported a running daemon as not running on any deep enough checkout. It is one exported function now, used by all three. And `SETUP_SPECS` was exported in #67 to be the canonical worker list, with a comment saying anything enumerating workers should read it; this was the first code since to enumerate workers and it kept a copy — which would have left the newest worker, the one most likely to be skewed, missing from the report entirely. The test sources its expectation from the same list, so adding a worker now breaks it loudly. Three ways the probe could describe a daemon wrongly. It never checked `daemon`, so a stale socket put one worker's process under another's name. It treated any parseable line as a hello, so an `ok: false` refusal printed as a healthy daemon with an unknown version. And `field-audiod` got its protocol printed and never checked, though AudiodClient refuses a mismatch and `--watch` gates on the version — so a stale audiod appeared as a clean line to someone running this command to find out why playback broke. audiod is compared against audiod's own number: its 1 and the workers' 2 are unrelated counters, and the test pins that they differ so the trap stays real. And the duplicated literal I removed came back as a duplicated reader, resolving the package root from two files at two depths and disagreeing on failure — mine threw at module scope, outside `fail()`, so every command would have died with a stack trace. One shared reader, so `field --version` and `field version` can only be wrong in the same way.
Install the shared lifecycle editable, not as a copy
field-workeris our own source rather than a pinned release, but each worker declared it as a plain path dependency — and uv installs those as a copy. So the moment #65 addedoptional_numbertofield_worker.protocol, every worker venv held afield_voicedreading from the source tree and afield_workerfrozen at whatever the last sync captured.The failure is worse than the cause. The daemon died at startup with
ImportError: cannot import name 'optional_number' from 'field_worker.protocol', pointing at the module that wanted the symbol rather than the stale copy that lacked it, and the CLI reported it asfield-voiced did not start — run field setup voiced. That advice is wrong twice over: setup had been run, and running it again would not have helped, becauseuv syncdoes not reinstall a path dependency whose version has not changed.Found by a generation failing on bloom, which is the only place it could be found: nothing in this repo imports
field_workerthrough an installed venv. The regression test asserts the declaration rather than the installed layout — the venvs are ambient and CI has none whilepnpm testruns, and the declaration is the thing that was actually wrong.Both workers get it. aced had the same latent break and would have hit it the next time the lifecycle grew anything.
Note
Low Risk
Packaging and test-only changes to how the shared worker package is linked; no runtime logic, auth, or data paths.
Overview
field-workeris local source, but aced and voiced had it as a plain path dependency, so uv copied a snapshot into each worker venv. After lifecycle changes (e.g. new symbols infield_worker), workers could import stale code while the tree was current—startup ImportErrors pointed at the consumer module, and re-running setup did not help because uv sync skips reinstall when the dependency version is unchanged.Both workers now declare
field-worker = { path = "../worker", editable = true }with inline comments explaining why; lockfiles record editable instead of directory. A Vitest regression insetup.test.tsasserts every worker that depends onfield-workerincludeseditable = trueinpyproject.toml(declaration-only, so CI without venvs still catches a wrong line).Reviewed by Cursor Bugbot for commit 0360aca. Configure here.