Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions pm-stack/aggregator/src/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { CheckoutDrift } from "./checkout-drift.ts";
import { isProjectAudit, isProjectPoolItem } from "./projects.ts";
import { isRepoCensus, type RepoCensus } from "./coverage.ts";
import { isSessionRecord } from "./registry.ts";
import { isDependencyStatus } from "./orchestration-dependency.ts";
import {
arrayOf,
isFiniteNumber,
Expand Down Expand Up @@ -381,14 +382,11 @@ function isTierElement(v: unknown): boolean {
return isRecord(v) && typeof v.id === "string";
}

const DEPENDENCY_STATUSES: readonly string[] = ["in-progress", "queued", "stalled", "done", "unknown"];

function isDependencyElement(v: unknown): boolean {
if (!isRecord(v)) return false;
return (
typeof v.task === "string" &&
typeof v.status === "string" &&
DEPENDENCY_STATUSES.includes(v.status) &&
isDependencyStatus(v.status) &&
(v.ref === undefined || typeof v.ref === "string") &&
(v.taskRef === undefined || typeof v.taskRef === "string") &&
(v.workerSessionId === undefined || typeof v.workerSessionId === "string") &&
Expand Down
2 changes: 1 addition & 1 deletion pm-stack/aggregator/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ export interface DependencyRef {
task: string;
/** "owner/repo#123" when the prerequisite is a GitHub item. */
ref?: RefKey;
status: "in-progress" | "queued" | "stalled" | "done" | "unknown";
status: import("./orchestration-dependency.ts").DependencyStatus;
/** Session working the blocker, when one is. */
workerSessionId?: string;
/** Human label for the worker, e.g. "opencode-laptop · Jules 4259…". */
Expand Down
10 changes: 10 additions & 0 deletions pm-stack/aggregator/src/orchestration-dependency.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Wire vocabulary shared by orchestration publishers, the collector gate,
// and dashboard work-item derivation. "blocked" describes a prerequisite
// that is itself waiting, not an unknown or merely queued prerequisite.
const dependencyStatuses = ["in-progress", "queued", "stalled", "blocked", "done", "unknown"] as const;

export type DependencyStatus = (typeof dependencyStatuses)[number];

export function isDependencyStatus(value: unknown): value is DependencyStatus {
return dependencyStatuses.some((status) => status === value);
}
3 changes: 2 additions & 1 deletion pm-stack/aggregator/src/work-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
// done-recently. Lower sorts first; ties keep section order.

import type { DependencyRef, Horizon, LinedUpTask, OrchestrationSection, RefKey, TierItem } from "./model.ts";
import { isDependencyStatus } from "./orchestration-dependency.ts";

export type WorkItemStatus = "needs-drew" | "needs-orchestrator" | LinedUpTask["status"];

Expand Down Expand Up @@ -127,7 +128,7 @@ function asBlockers(value: unknown): DependencyRef[] {
const blocker = d as Record<string, unknown>;
return (
typeof blocker.task === "string" &&
["in-progress", "queued", "stalled", "done", "unknown"].includes(String(blocker.status)) &&
isDependencyStatus(blocker.status) &&
(blocker.ref === undefined || typeof blocker.ref === "string")
);
});
Expand Down
31 changes: 31 additions & 0 deletions pm-stack/aggregator/test/contract-corpus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import {
} from "../src/feed.ts";
import { isProjectPoolItem, resolveEpicRefs } from "../src/projects.ts";
import { isSessionRecord } from "../src/registry.ts";
import { resolveOrchestrationDocument } from "../src/orchestration-db.ts";
import { assembleWorkItems, formatBlockers } from "../src/work-items.ts";

const CORPUS = join(import.meta.dir, "contract-corpus", "v1");

Expand Down Expand Up @@ -63,6 +65,35 @@ describe("contract corpus: orchestration section (incl. the #1110 object-provena
expect(() => todayFromSection(normalized!)).not.toThrow();
});

test("both readers preserve blocked dependencies and derived work items", async () => {
const document = await loadJson("orchestration.json");
for (const source of ["db", "file"] as const) {
const result = await resolveOrchestrationDocument({
source,
readDb: async () => document,
readFile: async () => document,
validate: orchestrationSectionProblem,
});
expect(result.source).toBe(source);
const section = normalizeOrchestrationSection(result.document);
expect(section?.dependencies.map((dep) => dep.status)).toEqual(["queued", "blocked"]);
const item = assembleWorkItems(section!).find((row) => row.title === "Example dependent task");
expect(item?.blockers).toHaveLength(1);
expect(formatBlockers(item?.blockers ?? [])).toBe("Example upstream work (blocked)");
}
});

test("both top-level and nested unknown dependency literals still fail", async () => {
const section = normalizeOrchestrationSection(await loadJson("orchestration.json"))!;
const blocker = { ...section.dependencies[1], status: "unexpected" };
expect(orchestrationSectionProblem({ ...section, dependencies: [blocker] })).toBe(
"dependencies (per-dependency shape)",
);
const goal = section.goals[0];
const task = { ...goal.linedUp[0], blockedBy: [blocker] };
expect(normalizeOrchestrationSection({ ...section, goals: [{ ...goal, linedUp: [task] }] })).toBeNull();
});

test("the corpus pins the publisher's object provenance form (the #1110 contract)", async () => {
const section = (await loadJson("orchestration.json")) as { provenance: unknown };
expect(typeof section.provenance).toBe("object");
Expand Down
23 changes: 22 additions & 1 deletion pm-stack/aggregator/test/contract-corpus/v1/feed.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@
"ref": "example-owner/example-repo#807",
"status": "queued",
"taskRef": "example-owner/example-repo#818"
},
{
"task": "Example upstream work",
"ref": "example-owner/example-repo#809",
"status": "blocked",
"taskRef": "example-owner/example-repo#819"
}
],
"goals": [
Expand All @@ -94,7 +100,22 @@
"momentum": "moving",
"summary": "Example progress recorded since the previous run.",
"progressedSinceLastRun": ["Example task closed via merged PR"],
"linedUp": [],
"linedUp": [
{
"title": "Example dependent task",
"ref": "example-owner/example-repo#819",
"status": "blocked",
"horizon": "today",
"horizonWhy": "Waiting on the prerequisite",
"blockedBy": [
{
"task": "Example upstream work",
"ref": "example-owner/example-repo#809",
"status": "blocked"
}
]
}
],
"stalled": [],
"gaps": []
}
Expand Down
2 changes: 1 addition & 1 deletion pm-stack/aggregator/test/contract-corpus/v1/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"capturedAt": "2026-11-03",
"notes": [
"The section captures were read from a real collector-published fleet-feed.json on 2026-11-03, then scrubbed before check-in; no raw feed is stored.",
"- orchestration.json mirrors the orchestration-pass run orch-2026-10-27T03:14:56Z, captured in PR #1244 (#1110: provenance as an OBJECT { sources, runId }); text and refs have been scrubbed.",
"- orchestration.json mirrors the orchestration-pass run orch-2026-10-27T03:14:56Z, captured in PR #1244 (#1110: provenance as an OBJECT { sources, runId }); text and refs have been scrubbed; synthetic blocked dependency examples added for #10508.",
"- quota.json is a scrubbed QuotaView captured from the real fleet feed; provider/pool names and usage measurements are replaced with deterministic examples.",
"- dns.json is a scrubbed DnsSection captured from the real fleet feed; domains and editorial values are replaced, while the real status variants and null semantics remain.",
"- registry.json holds scrubbed SessionRecords captured from the real fleet feed; ids, labels, timestamps, model names, and task refs are synthetic.",
Expand Down
23 changes: 22 additions & 1 deletion pm-stack/aggregator/test/contract-corpus/v1/orchestration.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
"ref": "example-owner/example-repo#807",
"status": "queued",
"taskRef": "example-owner/example-repo#818"
},
{
"task": "Example upstream work",
"ref": "example-owner/example-repo#809",
"status": "blocked",
"taskRef": "example-owner/example-repo#819"
}
],
"goals": [
Expand All @@ -40,7 +46,22 @@
"momentum": "moving",
"summary": "Example progress recorded since the previous run.",
"progressedSinceLastRun": ["Example task closed via merged PR"],
"linedUp": [],
"linedUp": [
{
"title": "Example dependent task",
"ref": "example-owner/example-repo#819",
"status": "blocked",
"horizon": "today",
"horizonWhy": "Waiting on the prerequisite",
"blockedBy": [
{
"task": "Example upstream work",
"ref": "example-owner/example-repo#809",
"status": "blocked"
}
]
}
],
"stalled": [],
"gaps": []
}
Expand Down