Parent: #9492
Summary
src/queue/processors.ts is 16,200 lines with 437 touches since 2026-07-01, 86 of them in a single week. It is where most of the 2026-07-27 audit's confirmed bugs physically live:
The drift is mechanical, not careless: a guard is added to the instances someone greps for, and the next one is 8,000 lines away in the same file, so it does not read as a separate site needing the same change.
Deliverables, in value order
Prior art already in place
Requirements
- Behaviour-preserving. No verdict, no reason code, and no public surface may change. This is a structural change and must be reviewable as one.
- Land it separately from any behavioural fix — bundling the two makes both unreviewable, and their risk profiles are entirely different.
- Each extracted seam gets its own direct tests; the existing suites must pass unmodified except where a symbol genuinely moved.
Note on src/api/routes.ts (6,906 lines, 173 touches)
The requiresApiToken exemption list plus the canSessionAccessPath allowlist is a proven drift generator — #9120 was literally "route doc said unauthenticated, list said 401", and three later routes carry comments promising to update both "in the SAME PR so the two can never drift", by convention only. A route-registration structure co-locating auth posture with the route would retire the class. Lower priority than the above; recorded so it is not rediscovered. (Partly overlapping with #9519's route-registration seam.)
Parent: #9492
Summary
src/queue/processors.tsis 16,200 lines with 437 touches since 2026-07-01, 86 of them in a single week. It is where most of the 2026-07-27 audit's confirmed bugs physically live:The drift is mechanical, not careless: a guard is added to the instances someone greps for, and the next one is 8,000 lines away in the same file, so it does not read as a separate site needing the same change.
Deliverables, in value order
run*ForAdvisoryspend gates behind one shared precondition struct.authorLogin,baseRef) that both the live path and the approval-accept path must construct. This one change structurally fixes approval-queue: accept path builds a thinner executor context — #9159 mutex, moderation ladder and #9055 base guard all silently inert #9482 and roughly half the determinism gap, because both are caused by ad-hoc optional context fields.Prior art already in place
decisionNowMsplan-input field — a first, deliberately non-optional instance of exactly the typed decision-pass context the third deliverable calls for. Follow that pattern: required, not optional.scripts/check-dead-source-files.tsmakes a module accidentally orphaned during a split fail CI rather than silently die — a safety net this refactor specifically benefits from.Requirements
Note on
src/api/routes.ts(6,906 lines, 173 touches)The
requiresApiTokenexemption list plus thecanSessionAccessPathallowlist is a proven drift generator — #9120 was literally "route doc said unauthenticated, list said 401", and three later routes carry comments promising to update both "in the SAME PR so the two can never drift", by convention only. A route-registration structure co-locating auth posture with the route would retire the class. Lower priority than the above; recorded so it is not rediscovered. (Partly overlapping with #9519's route-registration seam.)