Repository navigation
Description
Part of #1693.
Scope
The unit tests of src/ports/, src/daemon/, src/state/, src/history/, src/auth/, src/gateway/, src/mcp/ and src/test-support/ run on the Windows job and pass, and their files come off the list. These are the tests that start a real daemon on a named pipe, spawn real children and write real files, so Windows-only behaviour of the daemon is now checked on every PR. A Windows-only defect they show in the product is fixed here.
If it goes wrong, a daemon defect only Windows has (a pipe, a file left open, a child not stopped) ships, or a fix for Windows changes behaviour on macOS or Linux.
Technical spec
Commit 2df19f8.
Rows
- Behaviours: B4
- Interfaces: I1, I3, I4 (used)
- Existing code: X10, X11, X12
Facts
| # | Fact | Source |
|---|---|---|
| F1 | At this commit, 54 files of this group fail on Windows (about 470 tests). The main causes: listen EACCES or connect ENOENT on a joined daemon.sock (176 tests, mostly src/daemon/server*.test.ts and optional-modules*.test.ts); EBUSY removing a folder that still holds an open file (96, mostly src/daemon/relay-*.e2e.test.ts and dispatcher-usage.test.ts); modes such as expected 438 to be 384 (state.test.ts, history.test.ts, logger.test.ts, daemon-launcher.test.ts, worker-lock.test.ts); launchd and systemd files (service-manager.test.ts); a repo scan that compares ports/sqlite.ts with a \ path (sqlite.test.ts). |
pnpm exec vitest run --project unit --project ui-dom --reporter=json on DesktopWindows (Windows 11 23H2), 2026-11-18 |
| F2 | The ports fake for the disk is read per I3 after T1; with that change src/daemon still fails 307 tests and src/ports 36, so most of this group's failures are not fake paths. |
the same run with the fake reading both styles (T1 F4) |
| F3 | Tests that start a daemon join daemon.sock themselves, for example src/daemon/main-update.test.ts, src/daemon/main-host-load.test.ts, src/mcp/main.test.ts. |
rg -ln 'socketPath: join\(' src --glob '*.test.ts' |
| F4 | src/daemon/driver-discovery.test.ts and src/daemon/main-worker-lock.test.ts build a fake Android SDK, which on Windows needs .exe and .bat names (I4). |
pnpm exec vitest run --project unit --project ui-dom --reporter=json on DesktopWindows (Windows 11 23H2), 2026-11-18: SdkMissingError and expected [ { …(6) } ] to deeply equal [] in those files |
Modules touched
Searches: rg -ln "daemon\.sock|socketPath" src --glob '*.test.ts', rg -ln "removeUsageRigs|cleanUp\(" src, rg -n "0o600|0o700|umask|launchctl|systemctl" src/ports src/daemon src/state src/history --glob '*.test.ts'.
- The test files of the eight folders above, and their test helpers (
src/history/testing.ts,src/daemon/test-*.ts). - Product code in those folders only where a test shows a Windows-only defect; each such change is named in the PR.
src/test-support/windows-skipped.ts: this group's files removed.- A conflict in
src/test-support/windows-skipped.tswith a sibling task of CI: run the tests on Windows #1693 (neighbouring lines removed) is resolved by keeping both sides' removals.
Rules in play
- ADR 0087 §2, §3, §5: paths built as the code builds them, POSIX-only facts skipped on
win32, product defects fixed here. docs/internal/agent-rules/testing.mdrule 5: no other skip; a flake is reproduced by rerunning the Windows job on the base commit (toolchain.md).- Ports and daemon manuals: application code still takes ports; a fix that touches
fsorchild_processstays insrc/ports/.
Tests
The seam is the Windows job (B1) running the group's existing test files; model a platform skip on e2e/slow-host-load.test.ts:16.
- B4: every file of the group passes on the Windows job and none is on the list: an endpoint from
resolveDaemonSocketPath; a folder removed after its files are closed; a temporary folder compared afterrealpath; POSIX-only facts skipped onwin32; source scans compare/-joined paths; fake Android SDKs built with I4; any product fix pinned by the test that showed it
Done when
pnpm test:changedpasses on the branch.- The PR's
Unit tests (Windows)job passes, and no file of the group is left insrc/test-support/windows-skipped.ts. - Every
skipIf(process.platform === "win32")the PR adds checks a POSIX-only fact, said in itswhy:comment.
Out of scope
- Files of the other groups (T3–T6), the e2e lane.
Depends on
- The unit tests run on Windows in CI, with a shrinking list of the files still failing there #1705
- The Android driver passes its unit tests on Windows #1707
Written by an agent.
Activity
test: the group's files leave the Windows list (#1706)
fix(test): the group's tests close files before removing folders, rea…
fix(test): the device-data test closes its databases, and the service…
fix(test): the fleet test waits for the lease folder's removal, and t…
chore(test): the fleet test names what is left in a directory it cann…
chore(test): the fleet test tries each leftover on its own (#1706)
fix(test): the fleet test retries removing a worker directory Windows…
fix(test): Windows keeps the claims it can prove, and each skip says …
fix(test): the through-a-file case is skipped on Windows, where ENOEN…
fix(test): the two gateway e2e files retry removing a directory Windo…