Skip to content

Fix the ticker cadence test under Node 24, and run the suite on 24 in CI - #543

Merged
dannon merged 2 commits into
galaxyproject:mainfrom
dannon:fix/node24-live-ticker-cadence
Oct 2, 2026
Merged

dannon merged 2 commits into
galaxyproject:mainfrom
dannon:fix/node24-live-ticker-cadence

Conversation

@dannon

@dannon dannon commented Oct 2, 2026

Copy link
Copy Markdown
Member

engines.node allows anything from 22.19, but CI only runs 22, and on Node 24.21 the suite has one failure on a clean main:

FAIL tests/galaxy-live-source.test.ts > GalaxyLiveTicker cadence > does not pile a signal per tick onto one that lives for the session
AssertionError: expected 0 to be greater than 0

The ticker is fine; the test was reading Node internals that moved. It counted registrations on the session AbortSignal by walking its own-symbol properties and summing anything with a .size, with a guard that at least one such thing existed so the test couldn't go vacuous. Node 24.19 started allocating an EventTarget's listener maps lazily (nodejs/node#63702), so on a fresh signal there is nothing with a .size and the guard itself fires before the ticker does anything. Bisected across 22.13, 22.14, 22.23, 24.16, 24.21 and 26.10: 24.16 behaves like 22, 24.21 and 26 don't, and the changelog puts the change in 24.19.0.

Test-only change; no runtime behaviour moves. Plain listeners are now counted with the public getEventListeners(signal, "abort"). The one thing with no public API -- what AbortSignal.any hangs on its sources -- is still read from the private kDependantSignals set, by exact name, with an absent set treated as empty. A control composite replaces the old guard: the test builds AbortSignal.any([control.signal]), attaches a listener, and asserts the probe sees it, so if Node renames the internal the test fails loudly instead of quietly measuring nothing.

While checking the new test couldn't pass vacuously, a second Node 24 difference turned up: since at least 24.16, AbortSignal.any([src]) only registers the composite on src once the composite gets a listener (22 registers immediately). The old test's fake snapshot never listened on the signal it was handed, so if someone swapped tickSignal() back to AbortSignal.any([this.abort.signal, ...]) -- the exact leak this test exists to catch -- it would fail on 22 and pass silently on 24. The fake now listens, the way fetch does. In production that leak is still real on 24 (five listened-to composites retain five entries, and GC doesn't release them).

Checked by mutation on both Nodes: a no-op done() fails with 50 vs 0, and the AbortSignal.any swap fails with 50 vs 0; the swap with a non-listening fake passes silently on 24, which is why the listening fake is in the commit.

Verification

Full suite under 24.21.0 and 22.23.2 with an install built for each: identical, 3851 passed, 1 skipped. The earlier reports of session-index failures under 24 are a better-sqlite3 ABI mismatch from running a 22-built install under 24 (NODE_MODULE_VERSION 127 vs 137); after npm rebuild better-sqlite3 it's 33/33. macOS arm64 only; nothing was run on Linux or Windows under 24.

Second commit: CI gets an ubuntu-only test-node24 job (install, typecheck, root tests; no packaging or smoke-pack), which is how this would have been caught. About 1.5 runner-minutes per run, no wall-clock cost since it runs beside the existing legs. The macOS and Windows legs stay on 22: what broke here isn't platform-specific, and Windows smoke-pack alone is 6.5 minutes.

Not in this PR: resolveHistoryId has its own AbortSignal.any call with no test covering the leak shape; a follow-up.

dannon added 2 commits October 2, 2026 00:20
…Node's lazy internals.

Node 24.19 started allocating an EventTarget's listener maps only when the first listener arrives, so the old probe found no symbol-keyed collection on a fresh signal and its own vacuity guard failed, even though the ticker was releasing everything correctly. Plain listeners now come from the public getEventListeners, and only the AbortSignal.any dependant set is still read by name, treating an absent one as empty. A control composite proves that probe works on the running Node, and the fake snapshot listens on its signal the way fetch does, since newer Node only registers a composite on its sources once something listens to it -- without that, swapping the tick signal back to AbortSignal.any on the session signal would pass silently on 24. Test-only; no runtime behaviour changes.
engines.node allows 24 but the matrix only ran 22, which is how a Node-24-only test failure sat on main unnoticed. One ubuntu job, install plus typecheck plus the root tests and nothing else: packaging and the tarball smoke aren't where a runtime difference shows up, and the macOS and Windows legs on 24 would cost far more than they'd catch.
@dannon
dannon merged commit 40dbe2d into galaxyproject:main Oct 2, 2026
4 checks passed
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