Tests that start a notifier close it, so its pager does not outlive the test and log errors into the next file's counts #50

Merged
grokbot merged 1 commit from grokbot/forge:fix/tests-close-notifiers into main 2026-10-17 20:57:38 +00:00
Owner

startNotifier's stop() ends telling but, on purpose, leaves the drain pager
running (main.ts stops the notifier when a drain starts and the drain must
still be paged; notify-drain.test.ts holds that). Only close() clears the
pager. Four test files ended their notifier with stop(), so its pager kept
firing for the life of the bun test process.

test/drill-board-line.test.ts starts one with clockMs: 10: after its afterAll
removes the data directory, the pager logs "notify failed ... ENOENT: statfs
'/forge-drill-line-…'" every 10 ms into the process-wide error ring.
Any later file in the same process that counts errors goes red: vitals'
"errors are counted, bounded, redacted, and a burst is said" (lastHour is
not 1) and tui-sentinel's "an admin has it, and it says what the board says"
(the hunt files an error-rate finding). That is what the forge's parallel
check, which runs many files per process, saw on pulls that never touched
either.

On main, bun test test/drill-board-line.test.ts test/vitals.test.ts test/tui-sentinel.test.ts fails both, every time; with this change it is
25/25 green. accounts, watches and snapshot-mirror had the same stop(); they
are not red today but leak the same interval, so they close too.

Validation

pipeline/validate on 7abaa7fb: pass in 12s — bun 1.3.14, CI-shaped env (scrubbed vars, runner PATH), exact check.yml shard + forge.json commands.

step result time
bun install --frozen-lockfile ok (exit 0) 0s
forge.json check.fast ok (exit 0) 3s
check.yml gate (1) pull_request ok (exit 0) 2s
check.yml gate (2) pull_request ok (exit 0) 2s
check.yml gate (3) pull_request ok (exit 0) 5s
  • ⚠️ node v20.19.2 here, v22 on CI (tsc runs under node)
test output (failures, totals)
▶ bun install --frozen-lockfile
  ok  exit 0  0s
▶ forge.json check.fast
Ran 129 tests across 11 files in 2.0s (8 shards).
  ok  exit 0  3s
▶ check.yml gate (1) pull_request
Ran 33 tests across 3 files in 1.7s (3 shards).
  ok  exit 0  2s
▶ check.yml gate (2) pull_request
Ran 20 tests across 4 files in 1.2s (4 shards).
  ok  exit 0  2s
▶ check.yml gate (3) pull_request
Ran 76 tests across 4 files in 5.3s (4 shards).
  ok  exit 0  5s
startNotifier's stop() ends telling but, on purpose, leaves the drain pager running (main.ts stops the notifier when a drain starts and the drain must still be paged; notify-drain.test.ts holds that). Only close() clears the pager. Four test files ended their notifier with stop(), so its pager kept firing for the life of the bun test process. test/drill-board-line.test.ts starts one with clockMs: 10: after its afterAll removes the data directory, the pager logs "notify failed ... ENOENT: statfs '<tmp>/forge-drill-line-…'" every 10 ms into the process-wide error ring. Any later file in the same process that counts errors goes red: vitals' "errors are counted, bounded, redacted, and a burst is said" (lastHour is not 1) and tui-sentinel's "an admin has it, and it says what the board says" (the hunt files an error-rate finding). That is what the forge's parallel check, which runs many files per process, saw on pulls that never touched either. On main, `bun test test/drill-board-line.test.ts test/vitals.test.ts test/tui-sentinel.test.ts` fails both, every time; with this change it is 25/25 green. accounts, watches and snapshot-mirror had the same stop(); they are not red today but leak the same interval, so they close too. <!-- pipeline:validation --> ### Validation `pipeline/validate` on `7abaa7fb`: **pass** in 12s — bun 1.3.14, CI-shaped env (scrubbed vars, runner PATH), exact check.yml shard + forge.json commands. | step | result | time | |---|---|---| | `bun install --frozen-lockfile` | ok (exit 0) | 0s | | `forge.json check.fast` | ok (exit 0) | 3s | | `check.yml gate (1) pull_request` | ok (exit 0) | 2s | | `check.yml gate (2) pull_request` | ok (exit 0) | 2s | | `check.yml gate (3) pull_request` | ok (exit 0) | 5s | - ⚠️ node v20.19.2 here, v22 on CI (tsc runs under node) <details><summary>test output (failures, totals)</summary> ``` ▶ bun install --frozen-lockfile ok exit 0 0s ▶ forge.json check.fast Ran 129 tests across 11 files in 2.0s (8 shards). ok exit 0 3s ▶ check.yml gate (1) pull_request Ran 33 tests across 3 files in 1.7s (3 shards). ok exit 0 2s ▶ check.yml gate (2) pull_request Ran 20 tests across 4 files in 1.2s (4 shards). ok exit 0 2s ▶ check.yml gate (3) pull_request Ran 76 tests across 4 files in 5.3s (4 shards). ok exit 0 5s ``` </details>
Tests that start a notifier close it, so its pager does not outlive the test and log errors into the next file's counts
All checks were successful
check / gate (2) (pull_request) Successful in 3m28s
check / gate (3) (pull_request) Successful in 4m14s
check / gate (1) (pull_request) Successful in 10m5s
check / check (pull_request) Successful in 1s
preview / preview (pull_request) Has been skipped
7abaa7fb47
startNotifier's stop() ends telling but, on purpose, leaves the drain pager
running (main.ts stops the notifier when a drain starts and the drain must
still be paged; notify-drain.test.ts holds that). Only close() clears the
pager. Four test files ended their notifier with stop(), so its pager kept
firing for the life of the bun test process.

test/drill-board-line.test.ts starts one with clockMs: 10: after its afterAll
removes the data directory, the pager logs "notify failed ... ENOENT: statfs
'<tmp>/forge-drill-line-…'" every 10 ms into the process-wide error ring.
Any later file in the same process that counts errors goes red: vitals'
"errors are counted, bounded, redacted, and a burst is said" (lastHour is
not 1) and tui-sentinel's "an admin has it, and it says what the board says"
(the hunt files an error-rate finding). That is what the forge's parallel
check, which runs many files per process, saw on pulls that never touched
either.

On main, `bun test test/drill-board-line.test.ts test/vitals.test.ts
test/tui-sentinel.test.ts` fails both, every time; with this change it is
25/25 green. accounts, watches and snapshot-mirror had the same stop(); they
are not red today but leak the same interval, so they close too.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
trevato-apps/forge!50
No description provided.