Skip to content

Fix the test failures that turn main's windows CI job red on every run (windows-portability.md §7.2) - #197

Merged
ninjudd merged 6 commits into
mainfrom
windows/ci-green
Oct 11, 2026
Merged

ninjudd merged 6 commits into
mainfrom
windows/ci-green

Conversation

@ninjudd

@ninjudd ninjudd commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

The windows CI job fails on every run of main, and every branch cut from main inherits the failure, so a red windows check says nothing about the pull request it sits on. The failures come from main's own tests meeting Windows, not from any open pull request. This change fixes the 12 tests that fail on every windows run, and the inventory-cache test that failed in 7 of the 22 failed windows runs I read on 2026-10-11 (main's newest run and every failed branch run back to 2026-10-11 04:39 UTC). It also gives clone.test.ts's heavy setup hook room to finish. It changes test files and one plan note, and no product code.

  • The voice host's process tests (src/keys/voice-host.test.ts, 7 tests). They start an extensionless Node script with a #! line as FIELD_SCLANG. Windows cannot start that, and sclangCommand refuses it there with "which Windows cannot start directly" before anything spawns. They now skip on win32, the way src/graph/build.test.ts skips its #!/bin/sh sclang stubs. The missing-binary refusal in the same block still runs everywhere, and src/generators/supercollider.test.ts covers the Windows lookup rules on every platform.
  • Instrument resolution (src/keys/voice-host.test.ts, 3 tests). instrumentPath resolves a program against the project root with path.resolve, so on Windows it answers D:\p\shared\instruments\pad.scd, and resolveInstrument's refusal names that path. A program is a file to open, so a native path is correct; only project-relative paths that are data stay slash-separated. The product code is right and the expectations now build native paths with path.resolve and path.join.
  • MIDI take cleanup (src/commands/record-midi-daemon.test.ts, 2 tests). The afterEach kills the daemons and calls rmSync on the temp project at once. On Windows a killed daemon keeps the project as its cwd until it exits, so the removal failed with EPERM. It now goes through removeTempProject (src/testing/temp.ts), as the other daemon test files do.
  • The inventory cache (src/audio/plugin-hosting.test.ts, "serves an unchanged file from cache and re-reads a changed one"). Every failure was at the same-size rewrite: the third read returned the cached second object. That write follows the previous one at once, and on Windows it can land in the same timestamp tick, so no timestamp moves and the size and file index match. The test now waits 50 ms on win32 before that write, as its sibling test already does. The tick is the inferred cause, as the sibling's comment says; it was not measured.
  • The clone tests' setup (src/commands/clone.test.ts). Its beforeEach builds the source project, commits it, clones it bare, and pushes its LFS objects, one git or git-lfs process after another. On the windows runner that takes 2 to 3 s, judged by the file's tests that do nothing beyond it, but process starts there stall now and then, and on this pull request's first windows run one stall pushed the hook to 10.6 s, past vitest's 10 s default. The hook measures nothing about clone, so it now gets 30 s.
  • The Windows plan (docs/projects/windows-portability/readme.md §7.2). Its guard census now counts the seven voice host tests beside build.test.ts's two.

Two kinds of intermittent failure remain, and this change leaves both alone because neither is a test defect.

  • Loop takes in src/commands/punch-daemon.test.ts, now Loop takes stop, lose their count, or crash the daemon when the message thread falls behind #203, failed in 6 of the 22 runs: "timed out waiting for three passes to land", loop_takes missing from status after three takes landed, missed at 1, and once "field-audiod stopped answering mid-take". Reading serviceCapture and recordAudioBlock in native/audiod/src/player.cpp shows two loop handoff races that a slow message thread opens, which fits these symptoms; I have not reproduced them. First, a wrap that arrives before the heartbeat has serviced the previous pass ends the loop for good, because that path does not request a new start. Second, a wrap that arrives while serviceCapture is finalizing, before the next standby is open, counts a missed pass. If the heartbeat then runs before the callback adopts the late standby, capture stays null, status loses loop_takes, and the following pass's serviceCapture dereferences a null finished.
  • Runner stalls outside clone.test.ts: a 10 s beforeEach timeout twice in src/model/project.test.ts, whose hook only creates a project, and a 5 s test timeout once in src/audiod/live-session.test.ts. A hook that only creates a project does not take 10 s, so these read as the runner stalling rather than as tests to change.

Testing

From the root of a checkout of windows/ci-green, after pnpm install --frozen-lockfile and a native build (cmake -S native/audiod -B native/audiod/build -DCMAKE_BUILD_TYPE=Release then cmake --build native/audiod/build --parallel 8 --config Release):

pnpm typecheck
FIELD_AUDIOD=$PWD/native/audiod/build/field-audiod_artefacts/Release/field-audiod pnpm exec vitest run src/keys/voice-host.test.ts src/commands/record-midi-daemon.test.ts src/audio/plugin-hosting.test.ts src/commands/clone.test.ts
FIELD_AUDIOD=$PWD/native/audiod/build/field-audiod_artefacts/Release/field-audiod pnpm test
project check

On macOS you should see tsc --noEmit print nothing, then Tests 57 passed | 1 skipped (58) for the four files, then Test Files 81 passed (81) and Tests 1026 passed | 1 skipped (1027) for the suite, then "Project plans are valid." The one skip is "refuses to arm for MIDI where there is no MIDI source", which runs only where there is no MIDI service, such as Linux without /dev/snd/seq. On macOS and Linux these changes leave every changed test running, so a failure in "resolving an instrument" there would mean the native-path expectations broke POSIX. The commands leave the native build in native/audiod/build, and the tests remove their own temp projects.

The real check is this pull request's windows CI job, which cannot run by hand here. In its pnpm test step the seven "the voice host process" tests should report as skipped, and the three "resolving an instrument" tests and both MIDI take tests should pass. Any FAIL line for src/keys/voice-host.test.ts or src/commands/record-midi-daemon.test.ts, or an EPERM naming field-record-midi-, shows the change is wrong. A punch-daemon.test.ts loop take failure there is the daemon race above (#203), not this change, and a beforeEach timeout in clone.test.ts would mean a stall longer than 30 s.

📽️ Projector summary of dbecdfc: https://field.amnes.ac/reviews/197

Seven tests in src/keys/voice-host.test.ts start an extensionless Node
script with a #! line as FIELD_SCLANG. Windows cannot start that, and
since #186 sclangCommand refuses it there with "which Windows cannot
start directly", so every one failed on the windows job before anything
spawned. They skip on win32 the way build.test.ts's #!/bin/sh sclang
stubs do; the missing-binary refusal still runs everywhere.
instrumentPath resolves a program against the project root with
path.resolve, so on Windows it answers D:\p\shared\instruments\pad.scd,
and resolveInstrument's refusal names that path. The program is a file
to open, so a native path is right; only project-relative paths that are
data stay slash-separated. The three "resolving an instrument" tests
compared against POSIX literals and failed on the windows job; they now
build their expectations with path.resolve and path.join.
record-midi-daemon.test.ts's afterEach SIGKILLs the daemons its tests
started and then calls rmSync on the temp project at once. On Windows a
killed daemon keeps the project as its cwd until it has exited, so the
removal failed with EPERM and took "advertises record-midi" and "refuses
to arm for MIDI where there is no MIDI source" down with it on the
windows job. removeTempProject (src/testing/temp.ts) retries the whole
removal for exactly this, as the other daemon test files already do.
…ize rewrite

"serves an unchanged file from cache and re-reads a changed one" failed
on the windows job in 7 of the 21 failed runs surveyed, always at the
same-size rewrite: the third read returned the second's cached object.
That rewrite follows the previous write at once, and on Windows it can
land in the same timestamp tick, so mtime and ctime do not move and the
size and file index match. Its sibling test already waits 50 ms on win32
for this; this one now does too, before the same-size write only.
windows-portability.md §7.2 counts every win32 guard and who could lift
it. The seven stub-sclang tests in keys/voice-host.test.ts join
build.test.ts's two, which only a second stub dialect would unskip.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CLEAN · took 14m 29s

This change is meant to make main's windows CI job pass by fixing the twelve tests that fail there on every run, plus an intermittent inventory cache test, without touching product code. Three instrument resolution tests now expect the native paths instrumentPath correctly returns, seven voice host process tests skip on win32 because their extensionless Node stub cannot start there, the MIDI take tests' cleanup retries through removeTempProject while a killed daemon exits, and the inventory cache test waits out a Windows timestamp tick before its same-size rewrite. It knowingly leaves the intermittent punch-daemon.test.ts loop take failure and the runner stalls alone, and records the new voice host guard in the Windows plan's section 7.2.

0 finding threads: 0 resolved, 0 open

Covered 4 of 4 changed files; no generated files.

The MIDI take tests that publish a virtual MIDI source and arm every source on the machine did not run locally, because a live field keys session was running on the review machine. Only "advertises record-midi" ran from that file, and it exercises the changed cleanup.

Suggestions

  • src/commands/clone.test.ts:66: this beforeEach is what kept this head's windows job red. It builds, commits, bare-clones, and pushes LFS objects, and the file's passing tests took 1.7 to 5.7 s each in that run against vitest's 10 s hook limit. That reads as thin headroom more than a runner stall, which is an inference, so a longer timeout on this hook would probably take it out of the red runs the description puts down to stalls.
  • native/audiod/src/player.cpp (serviceCapture): the two loop take handoff races this pull request's description diagnoses, one ending in a null finished dereference, are recorded nowhere but the description. Filing them as an issue, as #194 records the punch-out shortfall, keeps the punch-daemon.test.ts failures traceable after the squash.

What was checked

  • The failures being fixed. main's windows job at 8472df5 failed 13 tests: the twelve this change names, and one punch-daemon.test.ts loop take. Each of the twelve fixes answers the error that log shows for its tests.
  • The MIDI take tests hide no daemon defect. In that log each of the two failures carries one error, EPERM from rmSync in afterEach, and nothing from its body. So "refuses to arm for MIDI where there is no MIDI source" already passed over the Windows named pipe. The change skips neither test, and the four take tests still skip at run time for want of a virtual MIDI port.
  • Instrument resolution is ported, not skipped. instrumentPath resolves with path.resolve and returns an absolute spec unchanged. The log received D:\p\shared\instruments\pad.scd, which join(resolve('/p'), …) builds, and win32 isAbsolute accepts /elsewhere/voice.scd, so that expectation holds there too. The refusal names dir exactly as mkdtempSync gave it, RUNNER~1 included, and the new string assertion pins more of the message than the regular expression it replaces.
  • The voice host skip is honest and recorded. All seven failed at sclangCommand's refusal before any spawn. itStartsTheStub follows build.test.ts's sclang stub guards and generate.test.ts's itSpawnsAWorker, its comment names what would lift it, and section 7.2 records it. The missing-binary test still runs on Windows, because sclangCommand reports a missing binary before it checks the extension.
  • The cache wait fixes timing rather than masking a defect. readInventory keys on modification time, change time, inode, and size. The wait sits only before the same-size rewrite, the one write that size cannot reveal, and matches the next test's existing 50 ms win32 wait.
  • Local runs on macOS. pnpm install --frozen-lockfile, then pnpm typecheck with no errors, then voice-host.test.ts and plugin-hosting.test.ts with 41 passed, and "advertises record-midi" passed.
  • This head's windows CI job. The windows job of run 38154856676, which tests this head merged into main at 4467d6f, still failed, on one test this change does not touch: the beforeEach in clone.test.ts timed out at 10 s in "refuses to clone over an existing directory, before any request". Every test this change fixes passed there. voice-host.test.ts ran 15 with the 7 process tests skipped, record-midi-daemon.test.ts passed its 2 runnable tests with the 4 take tests skipped, plugin-hosting.test.ts passed with only its macOS fixture test skipped, and no EPERM appeared. punch-daemon.test.ts passed in this run. The suite reported 1 failed, 959 passed, and 72 skipped, against 13 failed at 8472df5.

@ninjudd
ninjudd marked this pull request as ready for review October 11, 2026 16:35
@ninjudd
ninjudd marked this pull request as draft October 11, 2026 16:51
clone.test.ts's beforeEach builds the source project, commits it, clones
it bare, and pushes its LFS objects, one git or git-lfs process after
another. On the windows CI runner it takes 2 to 3 s, judged by the
file's tests that do nothing beyond it, but process starts there stall
now and then: on #197's first windows run one stall pushed the hook to
10.6 s and failed "refuses to clone over an existing directory, before
any request". The hook measures nothing about clone, so it gets 30 s.
ninjudd added a commit that referenced this pull request Oct 11, 2026
Every project plan opened with a `# Plan: …` heading. The prefix says
nothing the reader doesn't already know: each one lives under
`docs/projects/`, and the `project` command already labels it as a
project. Because Projector takes a project's title from its first
heading, the prefix also filled every row of `project list` and the
project site with the same word, which made the titles harder to scan.

This change removes the prefix from all 51 plans that had it.
`daw-features` never had one. Three headings started with an ordinary
lowercase word once the prefix was gone, so they now start with a
capital: "The UI, first version", "The TUI" and "Hosted plugins — AU and
VST3 as inserts". Headings that start with a name the docs keep
lowercase stay as they were: `bloom`, `prettier`, `src/engine` and the
backticked `field` commands.

Projector's own templates never add the prefix. It was a habit in this
repository, and new plans picked it up by copying the existing ones.
Once this merges, `main` has no plan left to copy it from.

This change covers only plans that already exist on `main`. Two open PRs
add new plans that still carry the prefix, because their authors copied
it from `main`: #185 adds `install` (`# Plan: Install and upgrade`) and
#202 adds `instrument-knobs` (`# Plan: Instrument knobs`). Each needs
the same one-line fix on its own branch. The other open PRs that edit
plans (#196, #197, #198, #201) change plan bodies but not headings, so
they merge cleanly on top of this.

## Testing

From the repository root, with nothing to build first:

```sh
grep -rn "Plan: " docs/projects
project list
project check
```

`grep` should print nothing. `project list` should show titles such as
`Arming` and `The UI, first version`. A title that still begins with
`Plan:` means a heading was missed. `project check` should print
`Project plans are valid.` It also prints a `site-workflow-outdated`
warning, which `main` already shows and which this change does not
touch. None of the commands change any files.

@ninjudd ninjudd left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📽️ Projector review · 0.7.4 · model claude-opus-5-5 · effort xhigh · CLEAN · incremental from 1d0e0e0 · took 8m 33s

Incremental review of the change since the full review of 1d0e0e0: +9 −1 lines in 1 file.

The push gives the beforeEach in src/commands/clone.test.ts a 30 s timeout, SETUP_TIMEOUT_MS, in place of vitest's 10 s default, with a comment that keeps the reason. With #203 now recording the loop take races, both suggestions from the full review are settled. On this head's windows run the job passed, 960 passed and 72 skipped, and the clone tests took 2.1 to 4.1 s each. pnpm typecheck and clone.test.ts pass on macOS.

@ninjudd
ninjudd marked this pull request as ready for review October 11, 2026 17:03
@ninjudd
ninjudd merged commit 281e6f2 into main Oct 11, 2026
2 checks passed
@ninjudd
ninjudd deleted the windows/ci-green branch October 11, 2026 17:04
ninjudd added a commit that referenced this pull request Oct 12, 2026
…ows-portability.md §7.2) (#220)

The `windows` CI job still fails every few runs after #197, on `main`
and on branches alike, and every failure since is a vitest timeout in
`src/commands/clone.test.ts`, `push.test.ts`, or `pull.test.ts`. Each
test in those files sets up a project, a commit, and a bare remote, one
git or git-lfs process after another, and several then clone, push, or
pull. Starting a process is slow on the Windows runner, so on a run that
passes vitest reports 3 to 7 s for one of these tests, setup included,
against its 5 s test default and 10 s hook default. A process-start
stall then tips one over. #197 gave `clone.test.ts`'s `beforeEach` 30 s
for this reason, but left the test bodies and the other two files at the
defaults.

These are the six windows runs that timed out this way on 2026-10-11:

- **`main` at `e791a11`**
([run](https://github.com/okamnesiac/field/actions/runs/38176898514)):
clone's "accepts a full URL" and push's "pushes, then offers every entry
beneath main", each at 5 s.
- **#212**
([run](https://github.com/okamnesiac/field/actions/runs/38179875094)):
clone's "expands the short name" at 5 s, reported at 9.1 s, and pull's
`beforeEach` at 10 s, reported at 11.0 s.
- **#219**
([run](https://github.com/okamnesiac/field/actions/runs/38189357197)):
push's "pushes, then offers every entry beneath main" at 5 s, reported
at 14.2 s.
- **`live/monitor`**
([run](https://github.com/okamnesiac/field/actions/runs/38173858309)):
push's "pushes without a remote" at 5 s.
- **`projector-agents-v4`**
([run](https://github.com/okamnesiac/field/actions/runs/38173650201)):
pull's `beforeEach` at 10 s.
- **`install/release-installer`**
([run](https://github.com/okamnesiac/field/actions/runs/38171418583)):
push's "offers nothing for a working tree with uncommitted changes" at 5
s.

These read as slow runs rather than hangs. Vitest can fire a timeout
only when the event loop is free, and these tests spend long stretches
in synchronous git calls. So a test reported well past its limit, such
as the 14.2 s push on #219, was still making progress until the timer
fired. On that run the whole push file took 33 s against 17.6 s on
`main`'s passing run, so the runner was slow across the board.

All three files now give their `beforeEach` and every test in their
`describe` 30 s, through one `GIT_HEAVY_MS` constant per file, as
`release.test.ts` gives its git-heavy tests. `clone.test.ts`'s
`SETUP_TIMEOUT_MS` becomes that constant. 30 s is twice the slowest
timed-out test, so a timeout there now means a stall twice as long as
any seen, or a real hang. This differs from the "runner stalls" #197
left alone in `project.test.ts` and `live-session.test.ts`, whose hooks
are cheap and stalled once or twice. These tests use most of their
budget on runs where nothing stalls. Raising vitest's `testTimeout` for
the whole suite would also stop these failures, but it would hide real
hangs everywhere else. The Windows plan records the item in §7.2 as
done. The change touches tests and the plan, and no product code.

## Testing

From the root of a checkout of `windows/remote-test-timeouts`, after
`pnpm install --frozen-lockfile`. These three files need no native
build.

```sh
pnpm typecheck
pnpm exec vitest run src/commands/clone.test.ts src/commands/push.test.ts src/commands/pull.test.ts
project check
```

You should see `tsc --noEmit` print nothing, then `Test Files 3 passed
(3)` and `Tests 22 passed (22)`, then "Project plans are valid." On
macOS these tests pass with or without this change, so this only shows
nothing broke.

To see that the budget reaches both the hooks and the tests, shrink it
and watch the timeout messages name the new value:

```sh
sed -i '' 's/^const GIT_HEAVY_MS = 30_000;$/const GIT_HEAVY_MS = 100;/' src/commands/{clone,push,pull}.test.ts
pnpm exec vitest run src/commands/clone.test.ts src/commands/push.test.ts src/commands/pull.test.ts 2>&1 | grep -oE '(Test|Hook) timed out in [0-9]+ms' | sort | uniq -c
git checkout -- src/commands
sed -i '' 's/{ timeout: GIT_HEAVY_MS }/{ timeout: 100 }/' src/commands/{clone,push,pull}.test.ts
pnpm exec vitest run src/commands/clone.test.ts src/commands/push.test.ts src/commands/pull.test.ts 2>&1 | grep -oE '(Test|Hook) timed out in [0-9]+ms|Tests +[0-9].*' | sort | uniq -c
git checkout -- src/commands
```

The first run should report only `Hook timed out in 100ms`, because
every setup hook now fails first. The second should report `Test timed
out in 100ms` and `Tests 9 failed | 13 passed (22)`, beside the tail of
vitest's `Failed Tests 9` banner: the nine tests that wait on a real
clone, push, or pull time out, and the rest finish synchronously. A
`5000ms` or `10000ms` in either run means a hook or test still runs on
vitest's default, and the change is wrong. The `sed -i ''` form is BSD
sed, as on macOS. Each `git checkout -- src/commands` puts the files
back, and the tests remove their own temp projects, so nothing is left
behind.

The real check is this pull request's `windows` CI job, which cannot run
by hand here. Its `pnpm test` step should pass all three files. A `Test
timed out in 5000ms` or `Hook timed out in 10000ms` naming
`clone.test.ts`, `push.test.ts`, or `pull.test.ts` means the change is
wrong. A `30000ms` timeout there would be a new finding: a stall longer
than 30 s, or a hang. One green run proves little against a failure that
came every few runs, so the evidence builds over the next runs on
`main`.

<!-- projector-summary v=1 sha=205b0caa95d297c0823c7746b262708791e78577
-->
📽️ **Projector summary** of 205b0ca: https://field.amnes.ac/reviews/220
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant