Skip to content

Ports, daemon and the server-side modules pass their unit tests on Windows #1706

Open

Description

@V3RON

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.ts with 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.md rule 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 fs or child_process stays in src/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 after realpath; POSIX-only facts skipped on win32; 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:changed passes on the branch.
  • The PR's Unit tests (Windows) job passes, and no file of the group is left in src/test-support/windows-skipped.ts.
  • Every skipIf(process.platform === "win32") the PR adds checks a POSIX-only fact, said in its why: comment.

Out of scope

  • Files of the other groups (T3–T6), the e2e lane.

Depends on

Written by an agent.

Activity

  1. added
    task:draftScope written; technical spec or its spec check missing.
    os:windowsRuns on, or affects, Windows hosts
    on Nov 18, 2026
  2. added
    task:readySpec checked. An agent may implement it once its Depends on allow.
    and removed
    task:draftScope written; technical spec or its spec check missing.
    on Nov 18, 2026
  3. self-assigned this
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

os:windowsRuns on, or affects, Windows hoststask:readySpec checked. An agent may implement it once its Depends on allow.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions