Public: anyone can read this; the crew can change it.

The fork tree, browsable, and each fork chooses how it follows #1089

Closed opened this in answer to
Closed without merging

scout/forge:scout/608-the-fork-tree-browsable-and-each-fork-ch → main 6 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
20 files changed +534 −74
.tmp/.dfffbffbfefefd5e-00000000.hm added
No content changes.
.tmp/bunx-1000-typescript@latest/bun.lock added +54
@@ -0,0 +1,54 @@
1 {
2 "lockfileVersion": 1,
3 "configVersion": 1,
4 "workspaces": {
5 "": {
6 "dependencies": {
7 "typescript": "^7.0.2",
8 },
9 },
10 },
11 "packages": {
12 "@typescript/typescript-aix-ppc64": ["@typescript/[email protected]", "", { "os": "aix", "cpu": "ppc64" }, "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ=="],
13
14 "@typescript/typescript-darwin-arm64": ["@typescript/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA=="],
15
16 "@typescript/typescript-darwin-x64": ["@typescript/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA=="],
17
18 "@typescript/typescript-freebsd-arm64": ["@typescript/[email protected]", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ=="],
19
20 "@typescript/typescript-freebsd-x64": ["@typescript/[email protected]", "", { "os": "freebsd", "cpu": "x64" }, "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw=="],
21
22 "@typescript/typescript-linux-arm": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ=="],
23
24 "@typescript/typescript-linux-arm64": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ=="],
25
26 "@typescript/typescript-linux-loong64": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ=="],
27
28 "@typescript/typescript-linux-mips64el": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA=="],
29
30 "@typescript/typescript-linux-ppc64": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "ppc64" }, "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA=="],
31
32 "@typescript/typescript-linux-riscv64": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "none" }, "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ=="],
33
34 "@typescript/typescript-linux-s390x": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "s390x" }, "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw=="],
35
36 "@typescript/typescript-linux-x64": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A=="],
37
38 "@typescript/typescript-netbsd-arm64": ["@typescript/[email protected]", "", { "os": "none", "cpu": "arm64" }, "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA=="],
39
40 "@typescript/typescript-netbsd-x64": ["@typescript/[email protected]", "", { "os": "none", "cpu": "x64" }, "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA=="],
41
42 "@typescript/typescript-openbsd-arm64": ["@typescript/[email protected]", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ=="],
43
44 "@typescript/typescript-openbsd-x64": ["@typescript/[email protected]", "", { "os": "openbsd", "cpu": "x64" }, "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg=="],
45
46 "@typescript/typescript-sunos-x64": ["@typescript/[email protected]", "", { "os": "sunos", "cpu": "x64" }, "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g=="],
47
48 "@typescript/typescript-win32-arm64": ["@typescript/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ=="],
49
50 "@typescript/typescript-win32-x64": ["@typescript/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="],
51
52 "typescript": ["[email protected]", "", { "optionalDependencies": { "@typescript/typescript-aix-ppc64": "7.0.2", "@typescript/typescript-darwin-arm64": "7.0.2", "@typescript/typescript-darwin-x64": "7.0.2", "@typescript/typescript-freebsd-arm64": "7.0.2", "@typescript/typescript-freebsd-x64": "7.0.2", "@typescript/typescript-linux-arm": "7.0.2", "@typescript/typescript-linux-arm64": "7.0.2", "@typescript/typescript-linux-loong64": "7.0.2", "@typescript/typescript-linux-mips64el": "7.0.2", "@typescript/typescript-linux-ppc64": "7.0.2", "@typescript/typescript-linux-riscv64": "7.0.2", "@typescript/typescript-linux-s390x": "7.0.2", "@typescript/typescript-linux-x64": "7.0.2", "@typescript/typescript-netbsd-arm64": "7.0.2", "@typescript/typescript-netbsd-x64": "7.0.2", "@typescript/typescript-openbsd-arm64": "7.0.2", "@typescript/typescript-openbsd-x64": "7.0.2", "@typescript/typescript-sunos-x64": "7.0.2", "@typescript/typescript-win32-arm64": "7.0.2", "@typescript/typescript-win32-x64": "7.0.2" }, "bin": { "tsc": "bin/tsc" } }, "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA=="],
53 }
54 }
.tmp/bunx-1000-typescript@latest/package.json added +5
@@ -0,0 +1,5 @@
1 {
2 "dependencies": {
3 "typescript": "^7.0.2"
4 }
5 }
docs/FOLLOWING.md +20 −1
@@ -126,10 +126,29 @@ without any simply moves.
126126 - The converge run's assignee is set without the assignment event, so the
127127 run queues under its own reason and not as an ordinary assignment.
128128
129 ## How a fork follows
130
131 A fork's writer chooses, on the forks page (`/:owner/:name/forks`) or with the
132 MCP `follow {repo, mode}` tool; `following` returns the `mode`. Saved on the
133 repository as `follow_mode`:
134
135 - `auto` (the default, and what forks always did): a parent that moves is
136 followed when git can do it alone — fast-forward, and with autonomy on a
137 clean merge or the crew's converge.
138 - `tell`: nothing is moved; the fork hears `fork.parent_moved`.
139 - `off`: nothing happens. Pressing Take updates or Converge by hand still works.
140
141 A conflict is never a stuck state. Taking updates that hit one (the button,
142 the API, MCP `take_updates`) is refused with the files and, in the same
143 step, told to the crew: the converge issue carries the files in conflict and
144 is assigned to a builder when the repository has one. With nobody on the crew
145 the issue still stands, unassigned, and the card says so; the next converge,
146 once someone joins, takes that same issue.
147
129148 ## The way back up
130149
131150 A fork's own work goes upstream in one press. When a fork is ahead of what
132 it follows, its following card offers **Propose upstream**: one pull opens
151 it follows, the forks page offers **Offer this change** (the following card no longer carries a second button for it): one pull opens
133152 on the parent from the fork's default branch, its title the one landed
134153 change's title, or `N changes from owner/fork` when there are several, its
135154 body one line per change that landed here since the fork last proposed,
docs/MCP.md +2 −1
@@ -38,7 +38,8 @@ for a tunnel and a forge that sleeps.
3838 | `audit` | who can do what, per app, read from its contract.json in git: yes, own or no per door, and whether outsiders may direct its crew (`crewOutsiders`) | |
3939 | `outsiders` | `{ repo, on?, dryRun? }`: whether people who cannot write may direct the crew; with `on`, planned first (`dryRun` is true unless `false`); set only by the app's admin with an admin token, never an agent | yes |
4040 | `probe` | knock on a running app's doors as nobody, a user and an admin; the ones that disobey its contract | |
41 | `following` | where a fork stands against what it follows, and what the crew is doing about it | |
41 | `following` | where a fork stands against what it follows, its follow `mode`, and what the crew is doing about it | |
42 | `follow` | `{ repo, mode }`: `auto`, `tell` or `off`, how a fork follows its parent; a writer's to say | yes |
4243 | `spawn` | `{ name, apps?, crew?, dryRun? }`: a child forge, planned first (`dryRun` is true unless `false`); an admin's, and an `ro` token may plan but not make | yes |
4344 | `claim_link` | `{ name }`: a new claim link for a child you spawned that nobody has claimed; the old one stops working. An admin's | yes |
4445 | `take_updates` | a fork takes its parent's updates when git can do it alone; a conflict is refused | yes |
src/actions/forks.ts +24 −1
@@ -18,6 +18,8 @@ import {
1818 import {
1919 canRead,
2020 forkParentFor,
21 updateRepoSettings,
22 type FollowMode,
2123 type Repo,
2224 } from "../core/repos.ts";
2325 import { commitIdentity } from "../core/commit_identity.ts";
@@ -25,7 +27,7 @@ import type { User } from "../core/users.ts";
2527 import { divergence } from "../git/branches.ts";
2628 import { resolveOid } from "../git/merge.ts";
2729 import { repoDir } from "../git/repos.ts";
28 import { err, type Result } from "../kernel/result.ts";
30 import { err, ok, type Result } from "../kernel/result.ts";
2931 import { requireWriter, type AccessError } from "./access.ts";
3032
3133 export type { ForkRelation, ForkSync, TakeError } from "../core/following.ts";
@@ -65,6 +67,27 @@ export async function relationOf(
6567 return forkRelation(app, fork, parent);
6668 }
6769
70 /** Choose how a fork follows its parent; a writer's to say, a fork's only. */
71 export function setFollowMode(
72 app: App,
73 actor: User | undefined,
74 fork: Repo,
75 mode: FollowMode,
76 ): Result<Repo, AccessError | "not_a_fork"> {
77 const writer = requireWriter(app, actor, fork);
78 if (!writer.ok) return writer;
79 if (fork.forkParentId === null) return err("not_a_fork");
80 if (fork.followMode === mode) return ok(fork);
81 const saved = updateRepoSettings(app.db, fork, { followMode: mode });
82 app.bus.append({
83 kind: "repo.follow_mode",
84 repoId: fork.id,
85 actorId: writer.value.id,
86 payload: { from: fork.followMode, to: mode },
87 });
88 return ok(saved);
89 }
90
6891 export type TakeUpdatesError = AccessError | "not_a_fork" | TakeError;
6992
7093 /**
src/core/event_audience.ts +2 −1
@@ -42,7 +42,8 @@ export function eventAudience(kind: string): EventAudience {
4242 // theirs to see, never the readers' (`actions/reports.ts`).
4343 kind.startsWith("report.") ||
4444 kind === "repo.settings_updated" ||
45 kind === "repo.crew_outsiders"
45 kind === "repo.crew_outsiders" ||
46 kind === "repo.follow_mode"
4647 )
4748 return "admins";
4849 // A fleet operation spans repositories; its receipt is its actor's.
src/core/following.ts +17 −1
@@ -96,7 +96,22 @@ export function follow(forge: Following): () => void {
9696 }),
9797 );
9898 if (moved.some((m) => m.ref === `refs/heads/${repo.defaultBranch}`))
99 for (const fork of listForks(forge.db, repo.id))
99 for (const fork of listForks(forge.db, repo.id)) {
100 // The fork's owner chose how it follows: `off` is left alone, `tell`
101 // hears that the parent moved and nothing else happens.
102 if (fork.followMode === "off") continue;
103 if (fork.followMode === "tell") {
104 forge.bus.append({
105 kind: "fork.parent_moved",
106 repoId: fork.id,
107 actorId: actor,
108 payload: {
109 parent: `${repo.ownerName}/${repo.name}`,
110 parentId: repo.id,
111 },
112 });
113 continue;
114 }
100115 fastForwardFork(forge, fork, repo, actor)
101116 .then((followed) => {
102117 // A fork with work of its own cannot be moved; it is told the
@@ -120,6 +135,7 @@ export function follow(forge: Following): () => void {
120135 error: String(error),
121136 }),
122137 );
138 }
123139 });
124140 }
125141
src/core/repos.ts +17 −1
@@ -98,6 +98,8 @@ export interface Repo {
9898 readonly autonomyCeilingUsd: number;
9999 readonly autonomySlots: number;
100100 readonly autonomyBy: string | null;
101 /** How this fork follows its parent; see `FollowMode`. */
102 readonly followMode: FollowMode;
101103 /**
102104 * "Outsiders may trigger the crew": whether someone who cannot write here
103105 * may still start or steer a run by speaking (`crew/direct.ts`). Off by
@@ -124,6 +126,16 @@ export interface Repo {
124126 readonly counts?: RepoCounts;
125127 }
126128
129 /**
130 * How a fork follows its parent: `auto` takes what git can take alone,
131 * `tell` only says the parent moved, `off` leaves the fork as it is.
132 */
133 export const FOLLOW_MODES = ["auto", "tell", "off"] as const;
134 export type FollowMode = (typeof FOLLOW_MODES)[number];
135 export function isFollowMode(v: unknown): v is FollowMode {
136 return FOLLOW_MODES.includes(v as FollowMode);
137 }
138
127139 interface RepoRow {
128140 id: string;
129141 owner_id: string;
@@ -141,6 +153,7 @@ interface RepoRow {
141153 autonomy_slots: number;
142154 autonomy_by: string | null;
143155 crew_outsiders: number;
156 follow_mode: string;
144157 direction_issue_id: string | null;
145158 fork_parent_id: string | null;
146159 sealed_for: string | null;
@@ -177,6 +190,7 @@ function toRepo(row: RepoRow): Repo {
177190 autonomySlots: row.autonomy_slots,
178191 autonomyBy: row.autonomy_by,
179192 crewOutsiders: row.crew_outsiders === 1,
193 followMode: isFollowMode(row.follow_mode) ? row.follow_mode : "auto",
180194 directionIssueId: row.direction_issue_id,
181195 forkParentId: row.fork_parent_id,
182196 sealedFor: row.sealed_for,
@@ -983,6 +997,7 @@ export interface RepoSettings {
983997 autonomyBy?: string | null;
984998 /** Whether someone who cannot write here may start or steer a run. */
985999 crewOutsiders?: boolean;
1000 followMode?: FollowMode;
9861001 }
9871002
9881003 /** Update the mutable repo fields, leaving unspecified ones untouched. */
@@ -995,7 +1010,7 @@ export function updateRepoSettings(
9951010 `UPDATE repo SET visibility = ?1, description = ?2, protect_default = ?3,
9961011 default_branch = ?4, require_review = ?5, require_checks = ?7,
9971012 autonomy = ?8, autonomy_direction = ?9, autonomy_ceiling_usd = ?10,
998 autonomy_slots = ?11, autonomy_by = ?12, crew_outsiders = ?13
1013 autonomy_slots = ?11, autonomy_by = ?12, crew_outsiders = ?13, follow_mode = ?14
9991014 WHERE id = ?6`,
10001015 ).run(
10011016 settings.visibility ?? repo.visibility,
@@ -1011,6 +1026,7 @@ export function updateRepoSettings(
10111026 settings.autonomySlots ?? repo.autonomySlots,
10121027 settings.autonomyBy === undefined ? repo.autonomyBy : settings.autonomyBy,
10131028 (settings.crewOutsiders ?? repo.crewOutsiders) ? 1 : 0,
1029 settings.followMode ?? repo.followMode,
10141030 );
10151031 return getRepoById(db, repo.id)!;
10161032 }
src/core/schema.ts +6
@@ -1540,4 +1540,10 @@ export const migrations: readonly string[] = [
15401540 SELECT RAISE(ABORT, 'a sealed repository is never public');
15411541 END;
15421542 `,
1543 // 71 — how a fork follows its parent (#608): `auto` takes what git can
1544 // take on its own (today's behaviour), `tell` only says the parent moved,
1545 // `off` leaves the fork alone. Meaningless on a repository that is no fork.
1546 `
1547 ALTER TABLE repo ADD COLUMN follow_mode TEXT NOT NULL DEFAULT 'auto';
1548 `,
15431549 ];
src/crew/converge.ts +16 −6
@@ -31,6 +31,7 @@ import { activeRunFor, listRuns } from "../core/runs.ts";
3131 import { commitIdentity } from "../core/commit_identity.ts";
3232 import { getUserById, type User } from "../core/users.ts";
3333 import { createLog } from "../kernel/log.ts";
34 import { ok } from "../kernel/result.ts";
3435 import { parkedCount } from "./autonomy.ts";
3536 import { PARK_STRIKES } from "./parks.ts";
3637 import { queueAgentRun } from "./dispatch.ts";
@@ -50,11 +51,12 @@ export type Converge =
5051 | { kind: "working"; issue: Issue; agent: Agent | undefined }
5152 /** The crew's proposal is open on the fork. */
5253 | { kind: "proposed"; issue: Issue; pull: Pull }
54 /** The issue carrying the conflicting files is open; nobody on the crew to take it yet. */
55 | { kind: "told"; issue: Issue }
5356 /** The crew tried its limit; a person's word is needed. */
5457 | { kind: "parked"; issue: Issue }
5558 /** Not the crew's: in step, behind only, ahead only, or a clean merge. */
5659 | { kind: "nothing"; relation: ForkRelation | undefined }
57 | { kind: "no_crew" }
5860 | { kind: "nobody" }
5961 /** The person asking may not direct the crew here (`direct.ts`). */
6062 | { kind: "forbidden" }
@@ -103,6 +105,8 @@ export function convergeState(
103105 return { kind: "working", issue, agent };
104106 }
105107 if (parkedCount(app, fork, issue.id) >= PARK_STRIKES) return { kind: "parked", issue };
108 // Never taken by a builder: told, and waiting for one.
109 if (issue.assigneeId === null) return { kind: "told", issue };
106110 return { kind: "working", issue, agent: undefined };
107111 }
108112
@@ -139,11 +143,11 @@ export async function convergeFork(
139143 if (relation === undefined || relation.state !== "diverged" || relation.clean)
140144 return { kind: "nothing", relation };
141145 const inHand = convergeState(app, fork, parent);
142 if (inHand !== undefined) return inHand;
146 if (inHand !== undefined && inHand.kind !== "told") return inHand;
143147 const builders = listCrewRoles(app.db, fork.id)
144148 .filter((c) => c.role === "builder")
145149 .map((c) => c.agent);
146 if (builders.length === 0) return { kind: "no_crew" };
150 if (inHand !== undefined && builders.length === 0) return inHand;
147151 const as = opener(app, fork, actor);
148152 if (as === undefined) return { kind: "nobody" };
149153
@@ -155,7 +159,10 @@ export async function convergeFork(
155159 return { kind: "nothing", relation };
156160 }
157161 const files = relation.conflicts;
158 const opened = openIssue(app, as, fork, {
162 const opened =
163 inHand !== undefined
164 ? ok(inHand.issue)
165 : openIssue(app, as, fork, {
159166 title: convergeTitle(parent),
160167 body: [
161168 `This repository follows ${parent.ownerName}/${parent.name}. Both have moved since they last agreed: ${relation.behind} change${relation.behind === 1 ? "" : "s"} there, ${relation.ahead} here, and ${files.length === 0 ? "git cannot merge them" : `${files.length === 1 ? "one file" : `${files.length} files`} changed on both sides: ${files.join(", ")}`}.`,
@@ -165,13 +172,16 @@ export async function convergeFork(
165172 });
166173 if (!opened.ok) return { kind: "nobody" };
167174 const issue = opened.value;
175 // A conflict is a tell for the crew, not a stuck state: with nobody on
176 // the crew the issue still stands, carrying the files, for whoever joins.
177 if (builders.length === 0) return { kind: "told", issue };
168178
169179 const inFlight = new Map<string, number>();
170180 for (const r of listRuns(app.db, fork.id, { kind: "agent", limit: 50 }))
171181 if ((r.state === "running" || r.state === "queued") && r.actorId !== null)
172182 inFlight.set(r.actorId, (inFlight.get(r.actorId) ?? 0) + 1);
173183 const agent = pickBuilder(issue, builders, inFlight);
174 if (agent === undefined) return { kind: "no_crew" };
184 if (agent === undefined) return { kind: "told", issue };
175185 // The assignee is the agent so that what follows — feedback on the
176186 // proposal, a red check — reaches the same builder. Set without the
177187 // assignment event: that event starts an ordinary run, and this one is
@@ -207,7 +217,7 @@ export function followDivergence(app: App): () => void {
207217 const parent =
208218 typeof parentId === "string" ? getRepoById(app.db, parentId) : undefined;
209219 if (fork === undefined || parent === undefined) return;
210 if (fork.autonomy === "off") return;
220 if (fork.autonomy === "off" || fork.followMode !== "auto") return;
211221 diverged(app, fork, parent).catch((error) =>
212222 log.error("could not act on a diverged fork", {
213223 fork: `${fork.ownerName}/${fork.name}`,
src/design/activity.ts +1
@@ -111,6 +111,7 @@ const WORDS: Record<string, string> = {
111111 "repo.created": "created a repository",
112112 "repo.forked": "forked a repository",
113113 "repo.settings_updated": "changed repository settings",
114 "repo.follow_mode": "changed how the fork follows its parent",
114115 "repo.crew_outsiders": "changed who may trigger the crew",
115116 "repo.mirrored": "mirrored a repository",
116117 "repo.imported": "imported issues and pulls",
src/http/api.ts +14 −3
@@ -1717,15 +1717,24 @@ export function apiRoutes(router: Router<Handler>): void {
17171717 return e === "not_a_fork"
17181718 ? apiError("not_a_fork", 404, "this repository follows nothing")
17191719 : respondAccess(e, 403);
1720 if (e.kind === "conflict")
1720 if (e.kind === "conflict") {
1721 const parent = forkParentFor(ctx.app.db, repo, ctx.auth.user);
1722 const told =
1723 parent === undefined
1724 ? undefined
1725 : await convergeFork(ctx.app, repo, parent, ctx.auth.user);
17211726 return json(
17221727 {
17231728 error: "conflict",
1724 message: "both sides changed these files; the crew can converge",
1729 message:
1730 "both sides changed these files; they are told to the crew as an issue",
17251731 files: e.files,
1732 issue:
1733 told !== undefined && "issue" in told ? told.issue.number : null,
17261734 },
17271735 409,
17281736 );
1737 }
17291738 return apiError(
17301739 e.kind,
17311740 409,
@@ -1782,7 +1791,9 @@ export function apiRoutes(router: Router<Handler>): void {
17821791 const status =
17831792 outcome.kind === "queued"
17841793 ? 202
1785 : outcome.kind === "working" || outcome.kind === "proposed"
1794 : outcome.kind === "working" ||
1795 outcome.kind === "proposed" ||
1796 outcome.kind === "told"
17861797 ? 200
17871798 : outcome.kind === "ceiling"
17881799 ? 429
src/http/mcp.ts +50 −11
@@ -19,7 +19,7 @@
1919
2020 import { mayView, mayViewId, sealedScope } from "../core/sealed.ts";
2121 import { changeCapacity, listCapacity } from "../actions/capacity.ts";
22 import { relationOf, takeUpdates } from "../actions/forks.ts";
22 import { relationOf, setFollowMode, takeUpdates } from "../actions/forks.ts";
2323 import { watchMilestone } from "../actions/watches.ts";
2424 import {
2525 addCommentThrough,
@@ -66,6 +66,8 @@ import {
6666 canWrite,
6767 forkParentFor,
6868 getRepo,
69 FOLLOW_MODES,
70 isFollowMode,
6971 ownerFactRepoIds,
7072 type Repo,
7173 } from "../core/repos.ts";
@@ -742,9 +744,40 @@ const TOOLS: readonly Tool[] = [
742744 clean: relation.clean,
743745 conflicts: relation.conflicts,
744746 converge: converge?.kind ?? null,
747 mode: repo.followMode,
745748 });
746749 },
747750 },
751 {
752 name: "follow",
753 description:
754 "Choose how a fork follows the repository it came from: `auto` takes the updates git can take on its own, `tell` only notes that the parent moved, `off` leaves the fork alone. A writer's to say.",
755 inputSchema: {
756 type: "object",
757 properties: {
758 repo: REPO_ARG,
759 mode: { type: "string", enum: [...FOLLOW_MODES] },
760 },
761 required: ["repo", "mode"],
762 },
763 writes: true,
764 async run(ctx, user, args) {
765 const repo = repoArg(ctx, user, args);
766 if (isAnswer(repo)) return repo;
767 const mode = str(args["mode"]);
768 if (!isFollowMode(mode))
769 return bad("invalid", "mode is auto, tell or off");
770 const set = setFollowMode(ctx.app, user, repo, mode);
771 if (!set.ok)
772 return bad(
773 set.error,
774 set.error === "not_a_fork"
775 ? "this repository follows nothing"
776 : "only a writer chooses how a fork follows",
777 );
778 return good({ mode: set.value.followMode });
779 },
780 },
748781 {
749782 name: "spawn",
750783 description:
@@ -852,7 +885,7 @@ const TOOLS: readonly Tool[] = [
852885 {
853886 name: "take_updates",
854887 description:
855 "Take the parent's updates into a fork: a fast-forward, or a merge when git merges cleanly. A conflict is refused with its files; use `converge` then.",
888 "Take the parent's updates into a fork: a fast-forward, or a merge when git merges cleanly. A conflict is refused with its files and told to the crew as an issue (assigned to a builder when there is one).",
856889 inputSchema: {
857890 type: "object",
858891 properties: { repo: REPO_ARG },
@@ -880,15 +913,21 @@ const TOOLS: readonly Tool[] = [
880913 ? "this repository follows nothing"
881914 : "you need write access to take updates here",
882915 );
883 return e.kind === "conflict"
884 ? bad(
885 "conflict",
886 `both sides changed ${e.files.join(", ")}; converge with the crew`,
887 )
888 : bad(
889 e.kind,
890 e.kind === "moved" ? "something moved; try again" : e.message,
891 );
916 if (e.kind === "conflict") {
917 const parent = forkParentFor(ctx.app.db, repo, user);
918 const told =
919 parent === undefined
920 ? undefined
921 : await convergeFork(ctx.app, repo, parent, user);
922 return bad(
923 "conflict",
924 `both sides changed ${e.files.join(", ")}; told to the crew${told !== undefined && "issue" in told ? ` on issue #${told.issue.number}` : ""}`,
925 );
926 }
927 return bad(
928 e.kind,
929 e.kind === "moved" ? "something moved; try again" : e.message,
930 );
892931 },
893932 },
894933 {
src/web/pages/following.ts +103 −39
@@ -13,11 +13,15 @@
1313 import { DIRECTION_NOTE } from "../../crew/direct.ts";
1414 import {
1515 relationOf,
16 setFollowMode,
1617 takeUpdates,
1718 type ForkRelation,
1819 } from "../../actions/forks.ts";
1920 import { listCrewRoles } from "../../core/agents.ts";
2021 import {
22 FOLLOW_MODES,
23 type FollowMode,
24 isFollowMode,
2125 canRead,
2226 canWrite,
2327 forkParentFor,
@@ -156,6 +160,67 @@ export function relationSentence(relation: ForkRelation): string {
156160 }
157161 }
158162
163 const MODE_WORDS: Record<FollowMode, [string, string]> = {
164 auto: ["Take green updates", "Updates git can take alone are taken."],
165 tell: ["Tell me", "The fork is only told when its parent moves."],
166 off: ["Don't follow", "The fork stays as it is."],
167 };
168
169 /**
170 * How this fork follows, and the one offer it can make: on the forks page,
171 * for a writer of a fork. Choosing the mode is the action; a fork ahead of
172 * its parent also offers its change up.
173 */
174 export async function followPanel(
175 ctx: Ctx,
176 repo: Repo,
177 ): Promise<Html | null> {
178 if (repo.forkParentId === null) return null;
179 if (!canWrite(ctx.app.db, repo, ctx.auth.user)) return null;
180 const following = await followingOf(ctx, repo);
181 if (following === undefined) return null;
182 const { relation } = following;
183 const parent = relation.parent;
184 const base = repoBase(repo);
185 const proposal =
186 relation.ahead > 0 ? openProposal(ctx.app, repo, parent) : undefined;
187 return html`<section class="card follow-panel" id="follow">
188 <div class="card-body">
189 <p class="following-sentence">${relationSentence(relation)}</p>
190 <form method="post" action="${base}/following" class="following-actions">
191 <input type="hidden" name="do" value="mode" />
192 ${FOLLOW_MODES.map((m) =>
193 btn(MODE_WORDS[m][0], {
194 size: "sm",
195 type: "submit",
196 name: "mode",
197 value: m,
198 variant: repo.followMode === m ? "primary" : "secondary",
199 }),
200 )}
201 </form>
202 <p class="muted small following-foot">${MODE_WORDS[repo.followMode][1]}</p>
203 ${relation.ahead === 0
204 ? null
205 : proposal === undefined
206 ? html`<form method="post" action="${base}/following" class="following-actions">
207 <input type="hidden" name="do" value="propose" />
208 ${btn("Offer this change", {
209 size: "sm",
210 type: "submit",
211 icon: "merge",
212 })}
213 </form>`
214 : html`<p class="following-actions">
215 ${btn("See the offer", {
216 size: "sm",
217 href: `/${parent.ownerName}/${parent.name}/pulls/${proposal.number}`,
218 })}
219 </p>`}
220 </div>
221 </section>`;
222 }
223
159224 /**
160225 * The card on a fork's home. `studio` swaps nothing but the words for the
161226 * crew's part; the mechanics are one and the same.
@@ -192,11 +257,11 @@ export function followingCard(
192257 })}
193258 </form>`,
194259 );
195 if (writer && conflict && converge === undefined && crew)
260 if (writer && conflict && converge === undefined)
196261 actions.push(
197262 html`<form method="post" action="${base}/following">
198263 <input type="hidden" name="do" value="converge" />
199 ${btn("Converge with the crew", {
264 ${btn(crew ? "Converge with the crew" : "Tell the crew", {
200265 size: "sm",
201266 type: "submit",
202267 variant: "primary",
@@ -212,39 +277,17 @@ export function followingCard(
212277 }),
213278 );
214279
215 // The fork's own work, offered upstream in one click: the words come
216 // from what landed here, so nothing waits on the crew.
217 if (writer && relation.ahead > 0) {
218 const proposal = openProposal(ctx.app, repo, parent);
219 actions.push(
220 proposal === undefined
221 ? html`<form method="post" action="${base}/following">
222 <input type="hidden" name="do" value="propose" />
223 ${btn("Propose upstream", {
224 size: "sm",
225 type: "submit",
226 icon: "merge",
227 })}
228 </form>`
229 : btn("See the upstream proposal", {
230 size: "sm",
231 href: `/${parent.ownerName}/${parent.name}/pulls/${proposal.number}`,
232 }),
233 );
234 }
235
236280 const foot: Html | null =
237281 converge === undefined
238 ? conflict
239 ? crew
240 ? writer
241 ? null
242 : html`A writer can ask the crew to converge it.`
243 : html`Nobody is on the crew to converge it: add someone under
244 <a href="${base}/settings/crew">Settings → Crew</a>, or merge
245 <span class="mono">refs/following/${parent.defaultBranch}</span>
246 by hand.`
282 ? conflict && !writer
283 ? html`A writer can ask the crew to converge it.`
247284 : null
285 : converge.kind === "told"
286 ? html`Told to the crew on
287 <a href="${base}/issues/${converge.issue.number}"
288 >#${converge.issue.number}</a
289 >; a builder takes it once someone joins
290 <a href="${base}/settings/crew">the crew</a>.`
248291 : converge.kind === "working"
249292 ? html`${converge.agent === undefined
250293 ? "The crew"
@@ -321,6 +364,24 @@ export async function followingSubmit(ctx: Ctx): Promise<Response> {
321364 });
322365 const parentName = `${parent.ownerName}/${parent.name}`;
323366
367 if (field(form, "do") === "mode") {
368 const mode = field(form, "mode");
369 const to = `${base}/forks`;
370 if (!isFollowMode(mode))
371 return flashOrJson(ctx, to, {
372 tone: "danger",
373 message: "Choose take green updates, tell me, or don't follow.",
374 });
375 const set = setFollowMode(ctx.app, ctx.auth.user, repo, mode);
376 if (!set.ok)
377 return flashOrJson(ctx, to, {
378 tone: "danger",
379 message: "You need write access to choose how this follows.",
380 });
381 return flashOrJson(ctx, to, {
382 message: `${MODE_WORDS[mode][0]}: ${MODE_WORDS[mode][1]}`,
383 });
384 }
324385 if (field(form, "do") === "converge") {
325386 if (!canWrite(ctx.app.db, repo, ctx.auth.user))
326387 return flashOrJson(ctx, base, {
@@ -369,12 +430,17 @@ export async function followingSubmit(ctx: Ctx): Promise<Response> {
369430 ? "This repository follows nothing."
370431 : "You need write access to take updates here.",
371432 });
433 if (e.kind === "conflict") {
434 const told = await convergeFork(ctx.app, repo, parent, ctx.auth.user);
435 const said = convergeWords(told, parentName);
436 return flashOrJson(ctx, base, {
437 message: `${e.files.length === 1 ? "One file needs" : `${e.files.length} files need`} a decision (${e.files.join(", ")}). ${said.message}`,
438 });
439 }
372440 return flashOrJson(ctx, base, {
373441 tone: "danger",
374442 message:
375 e.kind === "conflict"
376 ? `${e.files.length === 1 ? "One file needs" : `${e.files.length} files need`} a decision (${e.files.join(", ")}); the crew can converge it.`
377 : e.kind === "moved"
443 e.kind === "moved"
378444 ? "Something moved while this was read; try again."
379445 : `Git could not take the updates: ${e.message}`,
380446 });
@@ -417,11 +483,9 @@ function convergeWords(
417483 ? "They merge cleanly; Take updates does it without the crew."
418484 : "Nothing to converge.",
419485 };
420 case "no_crew":
486 case "told":
421487 return {
422 tone: "danger",
423 message:
424 "Nobody is on the crew here; add someone under Settings → Crew.",
488 message: `Issue #${outcome.issue.number} carries the files in conflict; it goes to a builder once someone joins the crew (Settings → Crew).`,
425489 };
426490 case "nobody":
427491 return {
src/web/pages/repo.ts +3 −1
@@ -12,7 +12,7 @@ import { canRead, listForks, type Repo } from "../../core/repos.ts";
1212 import { FORKS_PER_DAY, forkRepo } from "../../actions/repos.ts";
1313 import { forkDrift, takeUpdates, type ForkDrift } from "../../actions/forks.ts";
1414 import { lineageOf } from "../../core/following.ts";
15 import { followingCard, followingOf, lineageCard } from "./following.ts";
15 import { followingCard, followingOf, followPanel, lineageCard } from "./following.ts";
1616 import { pinRepo, syncRepoNow, unpinRepo } from "../../actions/origins.ts";
1717 import {
1818 canAdmin,
@@ -132,7 +132,9 @@ export async function forksPage(ctx: Ctx): Promise<Response> {
132132 const lineage = await lineageOf(ctx.app, repo, (r) =>
133133 canRead(ctx.app.db, r, ctx.auth.user),
134134 );
135 const panel = await followPanel(ctx, repo);
135136 const body = html`${repoHeader(ctx, repo, "forks")}
137 ${panel}
136138 <div class="page-head mt">
137139 <h2>${forks.length} fork${forks.length === 1 ? "" : "s"}</h2>
138140 </div>
test/capacity.test.ts +5
@@ -39,6 +39,11 @@ import { EGRESS_REPORTED } from "../src/kernel/vitals.ts";
3939 import { serve, type Servers } from "../src/http/server.ts";
4040 import { readRunLog } from "../src/runs/log.ts";
4141
42 // The boot default honours the environment by design, and a check runs with
43 // FORGE_CHECK_SHARDS set; these tests are about stored values against the
44 // built-in defaults, so they start without it.
45 delete process.env["FORGE_CHECK_SHARDS"];
46
4247 describe("capacity: only a forge admin reads or changes it", () => {
4348 let dataDir: string;
4449 let app: App;
test/follow_mode.test.ts added +173
@@ -0,0 +1,173 @@
1 /**
2 * How a fork chooses to follow (#608): saved from the forks page and from
3 * MCP, and honoured when the parent moves.
4 */
5 import { afterAll, beforeAll, describe, expect, test } from "bun:test";
6 import { mkdtemp, rm } from "node:fs/promises";
7 import { tmpdir } from "node:os";
8 import { join } from "node:path";
9 import { createApp, type App } from "../src/app.ts";
10 import { commitToBranch, createRepo, forkRepo } from "../src/actions/repos.ts";
11 import { listEvents } from "../src/core/events.ts";
12 import { forkRelation } from "../src/core/following.ts";
13 import { getRepoById, type Repo } from "../src/core/repos.ts";
14 import { createToken } from "../src/core/tokens.ts";
15 import { createUser, type User } from "../src/core/users.ts";
16 import { serve, type Servers } from "../src/http/server.ts";
17
18 describe("a fork chooses how it follows", () => {
19 let dataDir: string;
20 let app: App;
21 let servers: Servers;
22 let base: string;
23 let alice: User;
24 let bob: User;
25 let eve: User;
26 let bobToken: string;
27 let eveToken: string;
28 let parent: Repo;
29 const forks: Record<string, Repo> = {};
30 const tokens: Record<string, string> = {};
31 const fresh = (r: Repo) => getRepoById(app.db, r.id)!;
32 const commit = (who: User, repo: Repo, path: string) =>
33 commitToBranch(app, who, repo, {
34 message: path,
35 files: [{ path, content: `${path}\n` }],
36 });
37 const post = (token: string, repo: string, body: string) =>
38 fetch(`${base}/${repo}/following`, {
39 method: "POST",
40 headers: {
41 authorization: `Bearer ${token}`,
42 "content-type": "application/x-www-form-urlencoded",
43 accept: "application/json",
44 },
45 body,
46 });
47 const mcp = async (token: string, name: string, args: unknown) => {
48 const res = await fetch(`${base}/mcp`, {
49 method: "POST",
50 headers: {
51 authorization: `Bearer ${token}`,
52 "content-type": "application/json",
53 },
54 body: JSON.stringify({
55 jsonrpc: "2.0",
56 id: 1,
57 method: "tools/call",
58 params: { name, arguments: args },
59 }),
60 });
61 const r = (await res.json()) as any;
62 const text: string = r.result.content[0].text;
63 return r.result.isError === true
64 ? { error: text }
65 : { value: JSON.parse(text) };
66 };
67
68 beforeAll(async () => {
69 dataDir = await mkdtemp(join(tmpdir(), "forge-follow-mode-"));
70 app = createApp({ dataDir, port: 0 });
71 servers = await serve(app);
72 base = servers.url;
73 const mk = async (username: string, first = false) => {
74 const u = await createUser(app.db, {
75 trusted: true,
76 username,
77 email: `${username}@forge.local`,
78 password: "a-good-passphrase",
79 adminIfFirst: first,
80 });
81 if (!u.ok) throw new Error(u.error);
82 tokens[username] = createToken(app.db, u.value.id, "t", "rw").token;
83 return u.value;
84 };
85 alice = await mk("alice", true);
86 bob = await mk("bob");
87 eve = await mk("eve");
88 bobToken = tokens["bob"]!;
89 eveToken = tokens["eve"]!;
90 const made = await createRepo(app, alice, { name: "game", visibility: "public" });
91 if (!made.ok) throw new Error(String(made.error));
92 parent = made.value;
93 await commit(alice, parent, "README.md");
94 for (const name of ["auto", "tell", "off"]) {
95 const f = await forkRepo(app, name === "off" ? bob : await mk(`f${name}`), parent);
96 if (!f.ok) throw new Error(String(f.error));
97 forks[name] = f.value;
98 }
99 }, 30_000);
100
101 afterAll(async () => {
102 servers.stop();
103 app.close();
104 await rm(dataDir, { recursive: true, force: true });
105 });
106
107 test("the owner saves a mode from the forks page; a stranger cannot", async () => {
108 expect(fresh(forks["auto"]!).followMode).toBe("auto");
109 const page = await fetch(`${base}/ftell/game/forks`, {
110 headers: { authorization: `Bearer ${tokens["ftell"]}`, accept: "text/html" },
111 }).then((r) => r.text());
112 expect(page).toContain("Take green updates");
113 expect(page).toContain("Tell me");
114 expect(page).toContain("Don&#39;t follow");
115 expect((await post(tokens["ftell"]!, "ftell/game", "do=mode&mode=tell")).status).toBe(200);
116 expect((await post(bobToken, "bob/game", "do=mode&mode=off")).status).toBe(200);
117 expect(fresh(forks["tell"]!).followMode).toBe("tell");
118 expect(fresh(forks["off"]!).followMode).toBe("off");
119
120 expect((await post(tokens["fauto"]!, "fauto/game", "do=mode&mode=bogus")).status).toBe(422);
121 expect((await post(eveToken, "fauto/game", "do=mode&mode=off")).status).toBe(422);
122 expect(fresh(forks["auto"]!).followMode).toBe("auto");
123
124 // A stranger's view of the same page carries no controls.
125 const seen = await fetch(`${base}/ftell/game/forks`, {
126 headers: { authorization: `Bearer ${eveToken}`, accept: "text/html" },
127 }).then((r) => r.text());
128 expect(seen).not.toContain("Tell me");
129 });
130
131 test("converge honours each mode when the parent moves", async () => {
132 await commit(alice, parent, "levels.txt");
133 const tip = async (f: Repo) =>
134 (await forkRelation(app, fresh(f), fresh(parent)))!;
135 const until = async (f: Repo) => {
136 for (let i = 0; i < 100; i++) {
137 if ((await tip(f)).state === "synced") return true;
138 await Bun.sleep(40);
139 }
140 return false;
141 };
142 expect(await until(forks["auto"]!)).toBe(true);
143 // Give the others the same time; they must not have moved.
144 await Bun.sleep(300);
145 expect((await tip(forks["tell"]!)).state).toBe("behind");
146 expect((await tip(forks["off"]!)).state).toBe("behind");
147
148 const told = (f: Repo) =>
149 listEvents(app.db, { repoId: f.id }).filter((e) => e.kind === "fork.parent_moved");
150 expect(told(forks["tell"]!).length).toBe(1);
151 expect(told(forks["off"]!).length).toBe(0);
152 expect(told(forks["auto"]!).length).toBe(0);
153 });
154
155 test("a fork ahead offers its change up from the forks page", async () => {
156 await commit(bob, forks["off"]!, "mine.txt");
157 const page = () =>
158 fetch(`${base}/bob/game/forks`, {
159 headers: { authorization: `Bearer ${bobToken}`, accept: "text/html" },
160 }).then((r) => r.text());
161 expect(await page()).toContain("Offer this change");
162 });
163
164 test("MCP reads and sets the mode", async () => {
165 expect((await mcp(bobToken, "following", { repo: "bob/game" })).value.mode).toBe("off");
166 const set = await mcp(bobToken, "follow", { repo: "bob/game", mode: "auto" });
167 expect(set.value.mode).toBe("auto");
168 expect(fresh(forks["off"]!).followMode).toBe("auto");
169 expect((await mcp(bobToken, "follow", { repo: "bob/game", mode: "x" })).error).toBeDefined();
170 expect((await mcp(eveToken, "follow", { repo: "bob/game", mode: "off" })).error).toBeDefined();
171 expect((await mcp(bobToken, "follow", { repo: "alice/game", mode: "off" })).error).toBeDefined();
172 });
173 });
test/following.test.ts +20 −7
@@ -240,7 +240,15 @@ describe("a fork that follows its parent", () => {
240240 headers: { authorization: `Bearer ${bobToken}`, accept: "text/html" },
241241 }).then((p) => p.text());
242242 expect(page).toContain("one file needs a decision: README.md");
243 expect(page).toContain("Nobody is on the crew");
243 // The refused take told the crew: one issue carries the files, unassigned
244 // because nobody is on the crew yet.
245 expect(page).toContain("Told to the crew on");
246 const told = listIssues(app.db, fork.id, { state: "open" }).filter(
247 (i) => i.title === convergeTitle(parent),
248 );
249 expect(told.length).toBe(1);
250 expect(told[0]!.body).toContain("README.md");
251 expect(told[0]!.assigneeId).toBeNull();
244252 });
245253
246254 test("the page form refuses a reader who cannot write, and opens nothing", async () => {
@@ -259,7 +267,7 @@ describe("a fork that follows its parent", () => {
259267 expect(listIssues(app.db, fork.id, { state: "open" }).length).toBe(before);
260268 });
261269
262 test("without a crew, converging is refused honestly", async () => {
270 test("without a crew, converging tells the crew and doubles nothing", async () => {
263271 const res = await fetch(
264272 `${base}/api/v1/repos/bob/game/following/converge`,
265273 {
@@ -267,8 +275,13 @@ describe("a fork that follows its parent", () => {
267275 headers: as(bobToken),
268276 },
269277 );
270 expect(res.status).toBe(409);
271 expect(((await res.json()) as { kind: string }).kind).toBe("no_crew");
278 expect(res.status).toBe(200);
279 expect(((await res.json()) as { kind: string }).kind).toBe("told");
280 expect(
281 listIssues(app.db, fork.id, { state: "open" }).filter(
282 (i) => i.title === convergeTitle(parent),
283 ).length,
284 ).toBe(1);
272285 });
273286
274287 test("with a crew, converging opens one issue, stages the parent, queues one run", async () => {
@@ -606,11 +619,11 @@ describe("a fork that follows its parent", () => {
606619 expect(k.opened).toBe(false);
607620 expect(k.number).toBe(j.number);
608621
609 // The card offers the way to it now, not another proposal.
622 // The forks page offers the way to it now, not another proposal.
610623 const page = await (
611 await fetch(`${base}/bob/game`, { headers: as(bobToken) })
624 await fetch(`${base}/bob/game/forks`, { headers: as(bobToken) })
612625 ).text();
613 expect(page).toContain("See the upstream proposal");
626 expect(page).toContain("See the offer");
614627 expect(page).not.toContain('value="propose"');
615628 });
616629
test/mcp.test.ts +2 −1
@@ -170,6 +170,7 @@ describe("the forge over MCP", () => {
170170 "outsiders",
171171 "probe",
172172 "following",
173 "follow",
173174 "spawn",
174175 "forges",
175176 "claim_link",
@@ -374,7 +375,7 @@ describe("the forge over MCP", () => {
374375 ).toContain("write access");
375376 expect(
376377 (await tool(bobRw, "converge", { repo: "bob/open" })).value.kind,
377 ).toBe("no_crew");
378 ).toBe("told");
378379 });
379380
380381 test("probe only reads, yet needs the access the page needs", async () => {

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs