Skip to content

Commit cc8d07a

Browse files
committed
fix(hub): count any writer in flight as at work for the unblocked step
1 parent 2561045 commit cc8d07a

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

‎apps/hub/src/projects/deploy-tools.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,9 @@ test("an approval names the step it unblocks once every earlier document is appr
306306
};
307307

308308
expect(await unblocked(["problem_brief"])).toEqual([undefined, undefined]);
309-
const writerRun = { runId: "w", role: "writer", status: "running" };
310-
inFlight.push({ ...writerRun, state: "working" });
309+
inFlight.push({ runId: "w", role: "writer", status: "running" });
311310
expect(await unblocked(["constraints"])).toEqual([undefined, undefined]);
312-
inFlight.splice(0, 1, { ...writerRun, state: "waiting" });
311+
inFlight.pop();
313312
expect(await unblocked(["constraints"])).toEqual([
314313
"approaches",
315314
{ unblocked: "approaches" },

‎apps/hub/src/projects/deploy-tools.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ const ArtifactList = type({
152152
runId: "string > 0",
153153
role: "string > 0",
154154
status: "'deployed' | 'running'",
155-
"state?": "'working' | 'waiting' | 'approval'",
156155
"concept?": "string > 0",
157156
}).array(),
158157
preferences: Preferences,
@@ -162,21 +161,20 @@ type Ref = typeof SourceRef.infer;
162161
// A coordinator on 2026-11-05 often read a bare approval as still pending and started nothing, so
163162
// an approval of a document names the step it unblocks: the document after the last filed one, once
164163
// every filed document before it is approved and no writer is at work, or the design while none of
165-
// it is under way. A specialist that filed its work stays parked, waiting, and is not at work.
164+
// it is under way. A writer's run ends with its one task, so one in flight is at work.
166165
function unblockedStep(
167166
documents: readonly { kind: string }[],
168167
byKind: ReadonlyMap<string, Ref>,
169168
approved: ReadonlyMap<string, number>,
170-
inFlight: readonly { role: string; state?: string }[],
169+
inFlight: readonly { role: string }[],
171170
designOptions: boolean,
172171
): string | undefined {
173172
const approving = (kind: string) =>
174173
documents.some((doc) => doc.kind === kind);
175174
if (!DOCUMENT_ORDER.some(approving)) return undefined;
176175
const index = DOCUMENT_ORDER.findLastIndex((kind) => byKind.has(kind)) + 1;
177176
const next = DOCUMENT_ORDER[index];
178-
const atWork = (role: string) =>
179-
inFlight.some((run) => run.role === role && run.state !== "waiting");
177+
const atWork = (role: string) => inFlight.some((run) => run.role === role);
180178
if (next === undefined || atWork("writer")) return undefined;
181179
if (next === "design" && (designOptions || atWork("designer")))
182180
return undefined;

0 commit comments

Comments
 (0)