Skip to content

Commit d8471a6

Browse files
authored
refactor(queue): extract decision-policy and read-model seams (#1124)
Extracts two parameter-driven seams from the 14,709-line ExactReviewQueue module as pure moves: the decision/supersession policy cluster (decision construction, source/branch authority reservations, ingress promotion, publication revision/lineage, supersession and command-context predicates) into exact-review-decision.ts, and the read model (lane/stage projection, Bay projection, admitted items, stats/lane stats, backoff reasons, next-wake, capacity) into exact-review-read-model.ts. Shared primitives live in exact-review-queue-shared.ts; a capacity fallback uses injection to avoid a runtime cycle. Everything remains re-exported through exact-review-queue.ts, so no test or worker import changed. The queue module drops 1,531 lines to 13,178. All 64 moved function bodies are byte-identical (committed extract-and-diff evidence); the real local Worker and Durable Object serve byte-identical normalized queue and status responses on merge-base vs this head; verified in a Docker-backed Crabbox local-container on the reviewed head with committed receipt. The DO class, mutation/lease/dead-letter helpers, alarm execution, and the side-effecting /stats handler stay in the queue module.
1 parent 5439582 commit d8471a6

11 files changed

Lines changed: 3370 additions & 1636 deletions

‎dashboard/exact-review-decision.ts‎

Lines changed: 782 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import type { ExactReviewDecision } from "./exact-review-decision.ts";
2+
3+
const EXACT_REVIEW_SCHEDULED_HOT_SOURCE_ACTION = "scheduled_hot_intake";
4+
const EXACT_REVIEW_SCHEDULED_NORMAL_SOURCE_ACTION = "scheduled_normal_backfill";
5+
6+
export type ExactReviewScheduledLane = "hot_intake" | "normal_backfill";
7+
8+
export function exactReviewScheduledLane(
9+
decision: ExactReviewDecision,
10+
): ExactReviewScheduledLane | null {
11+
if (decision.sourceAction === EXACT_REVIEW_SCHEDULED_HOT_SOURCE_ACTION) return "hot_intake";
12+
if (decision.sourceAction === EXACT_REVIEW_SCHEDULED_NORMAL_SOURCE_ACTION) {
13+
return "normal_backfill";
14+
}
15+
return null;
16+
}
17+
18+
export function objectValue(value) {
19+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
20+
}
21+
22+
export function numberFrom(value, fallback) {
23+
const number = Number(value);
24+
return Number.isFinite(number) ? number : fallback;
25+
}

0 commit comments

Comments
 (0)