test: fix three flaky CI tests (3131 regex, zero-session trim, win32 fixture probe)

Merged
DE
11d ago
+18-7

Summary

Three tests that fail CI at random on code-yeongyu/senpi (first attempt fails, rerun on the same SHA passes). Test-only; no runtime change.

TestRoot causeFix
test/suite/regressions/3131-spent-account.test.tsJSON.stringify of RPC history/entries contains ms timestamps and faux api ids; any containing the digits 429 matched /429|rate_limit_error/Match the raw payload markers (429 { / rate_limit_error) instead of bare digits
test/rpc-host-zero-session-trim-real.test.tsfootprintBeforeMb is read at the trim, after two earlier closes; an ordinary GC in between may already have returned their pages, so before - after can be one session's worth (expected 103 >= 159.3)Measure the record's footprintAfterMb from the observed peak (the final peak - after assertion is unchanged)
test/rpc-host-ensure.test.ts (Windows)Fixture setup (writeRegistration / writerRecord) called readProcessStartTime with the 1 s win32 default; on a loaded runner Get-CimInstance is killed (SIGTERM) and setup threw before the case ranRead fixture writer identities with the 15 s unhurried probe production already uses for the same read

Evidence (CI runs that failed, then passed on rerun)

  • 3131: run 38189312672 attempt 1, Test (coding-agent 3/3)
  • trim-real: run 38189256304 attempt 1, Test (coding-agent 1/3)
  • rpc-host-ensure: runs 38110197122 and 38089949727 attempt 1, RPC named pipes (Windows) - Command failed: powershell.exe ... Get-CimInstance ... with killed: true, signal: 'SIGTERM'

Not included: the #3044 owner-lifetime flake (already fixed by 2cd89870f) and the Windows zip: command not found (covered by #3162).

Verification

  • node ../../scripts/run-tests.mjs vitest run test/suite/regressions/3131-spent-account.test.ts test/rpc-host-zero-session-trim-real.test.ts test/rpc-host-ensure.test.ts -> 3 files, 57 tests passed
  • biome check on the changed files: clean; tsc --noEmit: no errors in changed files
  • Test-only diff, so no changes.md / CHANGELOG entry and no CLI QA

Summary by cubic

Fixes three CI tests that flake at random (first attempt fails, rerun on the same SHA passes). Test-only; no runtime change.

  • The #3131 spent-account regression test now matches the raw 429 { / rate_limit_error payload instead of bare digits, which serialized timestamps and fake API ids could contain.
  • The zero-session trim test measures the record's after-trim footprint from the observed peak instead of footprintBeforeMb, which is read after two earlier closes and may already be reduced by an ordinary GC.
  • The Windows rpc-host-ensure fixture setup now reads writer identities with the 15-second probe production already uses, so Get-CimInstance is not killed on a loaded runner before the test runs.

Verified: all three test files pass (57 tests), and biome check and tsc --noEmit are clean on the changed files.