Fork Horse repository, listed by its owner. Publisher snapshot.
packages/forkhorse-dashboard/test/collision-fixtures.ts
Snapshot at 34e3175
1import type { StateResponse } from "../src/contracts.ts";
2import { reviewFixtureState } from "./review-fixtures.ts";
3
4export const collisionScenarios = [
5 "collision-open",
6 "collision-history",
7 "collision-missing",
8 "collision-error",
9 "collision-race-release",
10 "collision-race-promote",
11];
12/** FH-048 contract fixtures only: no owner session or Cloudflare access. */
13export function collisionFixtureState(id = "collision-open"): StateResponse {
14 const state = reviewFixtureState("review-current");
15 state.project.id = id;
16 state.claims = [];
17 state.activity = [];
18 state.reconcilerAlerts = [];
19 state.ledger = [];
20 const r = state.reviews[0];
21 r.packet = "pushing-packet";
22 state.packets[0].id = r.packet;
23 state.packets[0].title = "Pushing packet";
24 state.packets.push({ ...state.packets[0], id: "claimant-packet", title: "Claimant packet" });
25 const claimantFork = state.forks.find((f) => f.repoName !== r.repoName)!;
26 state.reviews.push({
27 ...r,
28 id: "claimant-review",
29 packet: "claimant-packet",
30 repoName: claimantFork.repoName,
31 sha: claimantFork.head,
32 });
33 state.blockers = [
34 {
35 id: "collision-1",
36 packet: "claimant-packet",
37 pushingPacket: r.packet,
38 pushingAgent: r.agent,
39 claimingAgent: "fixture-claimant",
40 repoName: r.repoName,
41 sha: r.sha,
42 paths: ["src/claimed.ts", "src/other.ts"],
43 at: "2026-10-13T14:00:00Z",
44 resolved: null,
45 },
46 ];
47 if (id === "collision-history") {
48 for (const [i, by] of (["promote", "release", "owner"] as const).entries())
49 state.blockers.push({
50 ...state.blockers[0],
51 id: `resolved-${by}`,
52 at: null,
53 resolved: {
54 at: `2026-10-13T14:0${i + 1}:00Z`,
55 by,
56 ...(by === "owner"
57 ? { reason: "Agreed on ownership.\n<script>plain text</script>" }
58 : {}),
59 },
60 });
61 }
62 return state;
63}
64