Skip to content

refactor(queue): extract signal-snapshot generation into its own module - #4820

Merged
JSONbored merged 1 commit into
mainfrom
refactor/4013-extract-signal-snapshot
Jul 11, 2026
Merged

refactor(queue): extract signal-snapshot generation into its own module#4820
JSONbored merged 1 commit into
mainfrom
refactor/4013-extract-signal-snapshot

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Part of refactor(queue): split processors.ts into cohesive modules #4013's module-split sequence for 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."
  • Moves generateSignalSnapshots and its loadOpenQueueCounts helper into src/queue/signal-snapshot.ts. Pure mechanical move — no behavior change.
  • loadOpenQueueCounts is also used by processors.ts's own (unexported) buildBurdenForecasts, so rather than leaving it in processors.ts and importing it back into the new file (which would make the two files circularly dependent), it moved too — processors.ts now imports it back from signal-snapshot.ts, one direction only.
  • A re-export shim (export { generateSignalSnapshots } from "./signal-snapshot";, alongside a local import for processJob's own internal call site) keeps src/api/routes.ts and test/unit/queue-trends.test.ts's existing import { 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 errors
  • npx 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.ts itself 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 ok
  • npm audit --audit-level=moderate — 0 vulnerabilities

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.
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.23%. Comparing base (20c412b) to head (98aa4fa).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

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           
Flag Coverage Δ
shard-1 51.34% <100.00%> (-0.15%) ⬇️
shard-2 45.43% <6.89%> (+0.02%) ⬆️
shard-3 41.85% <0.00%> (-0.11%) ⬇️
shard-4 52.16% <0.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/queue/processors.ts 95.64% <ø> (-0.04%) ⬇️
src/queue/signal-snapshot.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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