Skip to content

fix(dms): pass the nightly's Windows legs and its Stress mongod check - #1227

Merged
Upd4ting merged 6 commits into
mainfrom
fix/wec9b4589-23-nightly-windows
Nov 20, 2026
Merged

Upd4ting merged 6 commits into
mainfrom
fix/wec9b4589-23-nightly-windows

Conversation

@Upd4ting

@Upd4ting Upd4ting commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Wec9b4589-23: makes the Windows legs of the dms nightly pass again (from ANT-3515), and fixes the ci / Stress failure of 11-17.

Cause

The 11-20 nightly (run 44660722441) failed on four causes. A fifth explains the 11-17 Stress failure.

  1. EPERM on saveRun. saveRun writes run.json.next, then renames it over run.json. Windows refuses to replace a file another process has open, so the rename fails with EPERM while a service reads the run. run-state.test.mjs "a process reading the run while it is saved again never reads a partial run.json" hits it on every run.
  2. Forward-slash diagnostic paths. The builder reports a typecheck diagnostic's file through ts-morph's getFilePath(), which always uses /. Three test files added on 11-19 (perf(dms): keep the parsed declarations of the builder's index across operations #1183, fix(dms): rebuild the builder's projects when the install state or the tsconfig changes #1188, perf(dms): typecheck only the files a builder save can break #1191) built the expected path with path.join, which uses \ on Windows. This failed 19 tests across builder:1/5, 2/5 and 3/5. The engine is consistent: its other paths also come from getFilePath(), and isInsideFolder compares through path.relative, which accepts both separators.
  3. 8.3 short temp path. suite.test.mjs expected realpathSync(mkdtemp(tmpdir())), which keeps the runner's 8.3 short name C:\Users\RUNNER~1\…. The kit resolves a config against git rev-parse --show-toplevel, which answers the long name C:\Users\runneradmin\…. Both name one folder, but the test compared the strings, so three suite tests failed.
  4. No /proc on Windows. services.test.mjs checks the mail sink's port through listenersOf, which answers null where /proc is missing. The rest of the test, that a kit copy with no bin/ starts and records its mail sink, holds on Windows.
  5. Unreaped mongod in the 11-17 Stress run. stopRecorded stops waiting once isSameProcess reports a process gone, and it treats an unreaped zombie as gone. mongo-server.test.mjs "a mongod that cannot join the replica set is stopped" then asserted with isAlive, a kill(pid, 0) that a zombie still passes until Node reaps it. Under the Stress job's 16 busy loops, the reap comes after the assertion.

The dev-frontend write ECONNRESET failures in the 11-18 and 11-20 Windows logs are the pooled-connection race that #1197 fixed. #1197 landed at 03:14 UTC on 11-20, after that night's run on 658fcde. The 11-19 Stress failure (invite-validation-failure.test.mjs) failed on every leg that night. It came from the #1158 dependency bumps, which #1161 repaired.

Change

  • saveRun replaces run.json through replaceFile, which retries the rename on Windows EPERM every 5 ms for up to 2 s. Any other error, and EPERM on another platform, throws at once.
  • The three builder tests pass each diagnostic's file through path.normalize before comparing it with path.join.
  • suite.test.mjs builds its checkout root with realpathSync.native, which expands 8.3 names the way git does.
  • services.test.mjs checks the port's listener only where hasProc() holds. Everywhere it still checks that ensureMail exits 0 and that the run records a mail sink.
  • mongo-server.test.mjs asserts with isRunning, the check stopRecorded waits on. It reads a zombie as stopped, and it falls back to isAlive where /proc is missing.

The .agents formal checks need no change here. formal.yml and formal-generated.yml run them on ubuntu-latest only, and checks/run-tests.mjs runs only .agents/formal/maps.test.mjs, which spawns no pnpm.

flowchart LR
  A[saveRun] --> B[write run.json.next]
  B --> C{rename over run.json}
  C -->|ok| D[done]
  C -->|EPERM on Windows, under 2 s| E[wait 5 ms] --> C
  C -->|other error, or 2 s passed| F[throw]
Loading

Proof

The Windows failures come from the 11-20 nightly logs. Pull request CI runs no Windows leg, so the next scheduled nightly proves the fix on Windows.

Builder diagnostics. Before, on windows-latest:

1) [unit] a declaration file edited between two builder operations
     is parsed again by the next operation's typecheck:
    AssertionError: expected [ Array(1) ] to deeply equal [ Array(1) ]
     [
    -  "D:/a/dms/dms/packages/dms/.test-app-3888/src/labels.ts"
    +  "D:\\a\\dms\\dms\\packages\\dms\\.test-app-3888\\src\\labels.ts"
     ]

The same comparison on Windows path rules, reproduced on Linux with path.win32:

before: false "D:/a/dms/dms/packages/dms/.test-app-3888/src/labels.ts" vs "D:\\a\\dms\\dms\\packages\\dms\\.test-app-3888\\src\\labels.ts"
after:  true

After, on Linux (ajs module test . -f dist/test/unit/builder/<file>.test.js):

declaration-refresh   2 passing (5s)
environment-refresh   5 passing (12s)
importer-typecheck   14 passing (11s)

run.json rename. Before, on windows-latest:

✖ a process reading the run while it is saved again never reads a partial run.json (99.4395ms)
  Error: EPERM: operation not permitted, rename '…\dms-e2e-run-state-test-H3Efb5\run.json.next' -> '…\dms-e2e-run-state-test-H3Efb5\run.json'
      at renameSync (node:fs:1073:11)
      at saveRun (file:///D:/a/dms/dms/packages/dms/e2e/run-state.mjs:278:3)

Suite paths. Before, on windows-latest:

+ 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\dms-e2e-suite-7YjTkG\\e2e\\builder\\journeys.config.ts'
- 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\dms-e2e-suite-7YjTkG\\e2e\\builder\\journeys.config.ts'

After, the touched kit tests on Linux (node --test --test-concurrency=4 e2e/run-state.test.mjs e2e/suite.test.mjs e2e/services.test.mjs e2e/mongo-server.test.mjs):

ℹ tests 23
ℹ pass 23
ℹ fail 0

Stress mongod. Before, in the 11-17 Stress run:

✖ a mongod that cannot join the replica set is stopped (1678.972808ms)
  AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
  true !== false

Reproduced locally beside 16 busy loops. A script that runs the test's steps 30 times and reads /proc/<pid>/stat whenever isAlive still answers true:

run 5: isAlive true, /proc state Z, isRunning false
run 11: isAlive true, /proc state Z, isRunning false
run 21: isAlive true, /proc state Z, isRunning false
run 27: isAlive true, /proc state Z, isRunning false
4 of 30 runs left isAlive true after startMongod rejected

The test itself, 30 runs each beside 16 busy loops:

before: pass 27 fail 3
after: pass 30 fail 0

Follow-ups

  • none

@Upd4ting
Upd4ting marked this pull request as ready for review November 20, 2026 22:22
@Upd4ting
Upd4ting enabled auto-merge November 20, 2026 22:22
@Upd4ting
Upd4ting added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 20da340 Nov 20, 2026
23 checks passed
@Upd4ting
Upd4ting deleted the fix/wec9b4589-23-nightly-windows branch November 20, 2026 22:34
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