refactor(queue): extract signal-snapshot generation into its own module - #4820
Merged
Conversation
Part of #4013's module-split sequence (step 2, after transient-locks.ts in #4157): generateSignalSnapshots and its loadOpenQueueCounts helper move to src/queue/signal-snapshot.ts. Pure mechanical move, no behavior change -- a re-export shim keeps processors.ts's existing external callers (src/api/routes.ts, test/unit/queue-trends.test.ts) working unchanged.
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4820 +/- ##
=======================================
Coverage 94.23% 94.23%
=======================================
Files 442 443 +1
Lines 38845 38845
Branches 14150 14150
=======================================
Hits 36607 36607
Misses 1577 1577
Partials 661 661
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This was referenced Jul 11, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/queue/processors.ts(13.5k+ lines, 48 exports, only 2 with real external callers). Step 1 (transient-locks.ts, PR refactor(queue): extract transient-lock primitives into their own module #4157) already merged; this is step 2, the other function the issue calls out as "nearly self-contained."generateSignalSnapshotsand itsloadOpenQueueCountshelper intosrc/queue/signal-snapshot.ts. Pure mechanical move — no behavior change.loadOpenQueueCountsis also used byprocessors.ts's own (unexported)buildBurdenForecasts, so rather than leaving it inprocessors.tsand importing it back into the new file (which would make the two files circularly dependent), it moved too —processors.tsnow imports it back fromsignal-snapshot.ts, one direction only.export { generateSignalSnapshots } from "./signal-snapshot";, alongside a localimportforprocessJob's own internal call site) keepssrc/api/routes.tsandtest/unit/queue-trends.test.ts's existingimport { generateSignalSnapshots } from "../../src/queue/processors"working unchanged, mirroring the exact shim shape refactor(queue): extract transient-lock primitives into their own module #4157 already established for the actuation-lock functions.Part of #4013 (more extraction steps remain in the sequence — not closing the tracking issue).
Test plan
npx tsc --noEmit -p .— zero errorsnpx vitest run test/unit test/integration— 694/696 files passed (the 1 failure,selfhost-update-script.test.ts, is a pre-existing timing-sensitive timeout under full-suite load, unrelated to this change — passes cleanly in isolation)npm run test:coverage(unsharded) — 94.43% statements / 93.41% branches / 93.59% functions / 95.02% lines, no threshold failures;signal-snapshot.tsitself is 100% line + branch covered by the existing test suite (no new tests needed for a byte-for-byte move)npm run docs:drift-check,npm run manifest:drift-check,npm run engine-parity:drift-check,npm run cf-typegen:check— all oknpm audit --audit-level=moderate— 0 vulnerabilities