Fork Horse repository, listed by its owner. Publisher snapshot.
packages/forkhorse-dashboard/test/needs-you-fixtures.ts
Snapshot at 34e3175
1import type { StateResponse } from "../src/contracts.ts";
2import { fixtureReceipt, fixtureState, HEAD, NEXT_HEAD } from "./fixtures.ts";
3
4/** FH-043 synthetic snapshots. No owner connection or live action. */
5export const needsScenarios = [
6 "needs-all",
7 "needs-promotion",
8 "needs-reconciler",
9 "needs-blocker",
10 "needs-failed",
11 "needs-promote",
12 "needs-approve",
13 "needs-advisory",
14 "needs-empty",
15 "needs-main-moved",
16];
17export function needsFixtureState(id: string): StateResponse {
18 const state = fixtureState("quiet");
19 state.project.id = id;
20 state.project.repoName = "fixture-project";
21 state.project.settings = { requireReceipt: id !== "needs-advisory" };
22 const all = id === "needs-all";
23 function review(packet: string, status: "pending" | "approved" | "failed") {
24 const index = state.reviews.length;
25 const agent = `fixture-agent-${index + 1}`;
26 const repoName = `fixture-project--agent-${index + 1}`;
27 const sha = (index + 11).toString(16).repeat(40);
28 const receipt = fixtureReceipt(
29 status === "failed" || id === "needs-advisory" ? "failed" : "passed",
30 );
31 const r: StateResponse["reviews"][number] = {
32 id: `needs-review-${index + 1}`,
33 packet,
34 agent,
35 repoName,
36 sha,
37 base: HEAD,
38 receiptDigest: receipt.digest,
39 receipt,
40 returned: null,
41 approval: status === "approved" ? { sha, receiptDigest: receipt.digest } : null,
42 stale: false,
43 promoted: false,
44 createdAt: "2026-10-13T12:00:00Z",
45 };
46 state.agents.push({ name: agent });
47 state.forks.push({
48 agent,
49 repoName,
50 head: sha,
51 remote: `https://git.idiot.tax/${repoName}`,
52 createdAt: r.createdAt,
53 });
54 state.reviews.push(r);
55 state.packets.push({
56 id: packet,
57 title: packet,
58 goal: "Inspect synthetic evidence.",
59 paths: ["src/fixture.ts"],
60 acceptance: ["Fixture only"],
61 });
62 return r;
63 }
64 if (all || id === "needs-promotion") {
65 const r = review("fixture-01", "approved");
66 r.promoted = true;
67 state.promotionPending = {
68 id: "pending-1",
69 review: r.id,
70 repoName: state.project.repoName,
71 ref: "refs/heads/main",
72 before: HEAD,
73 after: NEXT_HEAD,
74 receiptDigest: r.receiptDigest,
75 recordedAt: "2026-10-13T11:00:00Z",
76 };
77 }
78 if (all || id === "needs-reconciler") {
79 state.agents.push({ name: "fixture-external" });
80 state.forks.push({
81 agent: "fixture-external",
82 repoName: "fixture-project--external",
83 head: NEXT_HEAD,
84 remote: "https://git.idiot.tax/external",
85 createdAt: "2026-10-13T11:00:00Z",
86 });
87 state.reconcilerAlerts.push({
88 id: "2",
89 repoName: "fixture-project--external",
90 ref: "refs/heads/main",
91 before: HEAD,
92 after: NEXT_HEAD,
93 reason: "Synthetic outside movement.",
94 });
95 }
96 if (all || id === "needs-blocker") {
97 state.packets.push({
98 id: "fixture-02",
99 title: "Collision evidence",
100 goal: "Resolve the synthetic claim collision.",
101 paths: ["src/claims.ts"],
102 acceptance: ["Fixture only"],
103 });
104 state.blockers.push({
105 id: "3-fixture-02",
106 packet: "fixture-02",
107 pushingAgent: "fixture-reviewer",
108 claimingAgent: "fixture-builder",
109 repoName: "fixture-project--external",
110 sha: NEXT_HEAD,
111 paths: ["src/claims.ts", "src/claim-test.ts"],
112 });
113 }
114 if (all || id === "needs-failed") review("fixture-03", "failed");
115 if (all || id === "needs-promote") review("fixture-04", "approved");
116 if (all || id === "needs-approve" || id === "needs-advisory") review("fixture-05", "pending");
117 if (id === "needs-main-moved") {
118 review("fixture-main-moved", "approved");
119 const currentMain = "7".repeat(40);
120 const ready = review("fixture-ready", "approved");
121 ready.base = currentMain;
122 state.ledger = [
123 {
124 id: "fixture-main-promotion",
125 review: "fixture-other-review",
126 repoName: state.project.repoName,
127 ref: "refs/heads/main",
128 before: HEAD,
129 after: currentMain,
130 receiptDigest: null,
131 recordedAt: "2026-10-13T12:01:00Z",
132 },
133 ];
134 }
135 return state;
136}
137