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

A tell through the API with variants: 2 starts two builders whose runs and pulls share one group id #1634

Closed opened this
Closed without merging

scout/forge:scout/1571-a-tell-through-the-api-with-variants-2-s → main 4 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
12 files changed +308 −26
docs/FEED.md +3 −1
@@ -88,7 +88,9 @@ a card, and paging past the first 20.
8888 - Browser sessions now honour `Idempotency-Key` on `/api/v1/` mutations, scoped
8989 to the person (as tokens' are to the token): a replay returns the first
9090 answer. `POST /api/v1/feed/tells { app, text }` is the JSON tell the outbox
91 sends.
91 sends. Add `variants` (an integer 1–4; anything else is a 400) and the
92 tell opens that many issues, one builder run each, sharing a `variantGroup`
93 id that the pulls they open carry, with their `siblings` listed.
9294 - The live client reopens `/events?since=<last id>` when the browser gives up
9395 on the stream, and on `online`, and refreshes every region once.
9496 - Not done: steering a run offline (a plain form post, needs the network),
scripts/gate.ts +1
@@ -72,6 +72,7 @@ export const GATE: readonly string[] = [
7272 "test/passport-edge.test.ts",
7373 "test/crew-direction.test.ts",
7474 "test/crew-direction-autonomy.test.ts",
75 "test/variants.test.ts",
7576 "test/crew-guard.test.ts",
7677 "test/review-waits.test.ts",
7778 "test/scale.test.ts",
src/actions/issues.ts +2
@@ -291,6 +291,7 @@ export function assignIssue(
291291 repo: Repo,
292292 issue: Issue,
293293 assignee: User | null,
294 variantGroup?: string,
294295 ): Result<
295296 Issue,
296297 AccessError | "assignee_cannot_read" | "agent_not_on_crew" | "unverified"
@@ -322,6 +323,7 @@ export function assignIssue(
322323 number: issue.number,
323324 assignee: assignee?.username ?? null,
324325 agent: assignee?.kind === "agent",
326 ...(variantGroup === undefined ? {} : { variantGroup }),
325327 },
326328 });
327329 return ok(updated);
src/actions/pulls.ts +3
@@ -85,6 +85,8 @@ export interface OpenPullInput {
8585 /** The issue id of the pull this one reverts ("Take it back"). Native
8686 * repos only — a mirror's pull is the origin's, which has no such field. */
8787 revertsIssueId?: string;
88 /** The variant group of the run opening this pull (#1571). */
89 variantGroup?: string;
8890 /**
8991 * A person's deliberate yes to fixing a sealed report from a branch that
9092 * is already public (this repository, or a public fork). Without it such
@@ -217,6 +219,7 @@ export async function openPull(
217219 }
218220 : {}),
219221 ...(input.revertsIssueId ? { revertsIssueId: input.revertsIssueId } : {}),
222 ...(input.variantGroup ? { variantGroup: input.variantGroup } : {}),
220223 },
221224 );
222225 if (!created.ok) return created;
src/actions/tell.ts +43 −15
@@ -14,6 +14,7 @@ import { listRuns } from "../core/runs.ts";
1414 import type { User } from "../core/users.ts";
1515 import { mayDirectCrew } from "../crew/direct.ts";
1616 import { routeIssue, type Routed } from "../crew/route.ts";
17 import { id } from "../kernel/id.ts";
1718 import { err, ok, type Result } from "../kernel/result.ts";
1819 import { requireParticipant } from "./access.ts";
1920 import { assignIssue, openIssue, type MirrorError } from "./issues.ts";
@@ -25,8 +26,14 @@ export interface Told {
2526 readonly routed: Routed | undefined;
2627 /** Whether the builder could be assigned (and so a run will start). */
2728 readonly assigned: boolean;
29 /** With variants: the shared group id, and every variant's tell (this one first). */
30 readonly variantGroup?: string;
31 readonly variants?: readonly Told[];
2832 }
2933
34 /** Most builders one tell may start side by side. */
35 export const VARIANTS_MAX = 4;
36
3037 export type TellError =
3138 | "empty"
3239 | "not_found"
@@ -44,6 +51,7 @@ export async function tell(
4451 actor: User | undefined,
4552 repo: Repo,
4653 said: string,
54 variants = 1,
4755 ): Promise<Result<Told, TellError>> {
4856 // A tell is a run: only someone who may direct the crew here says one,
4957 // and a refused tell opens nothing (`crew/direct.ts`).
@@ -58,27 +66,47 @@ export async function tell(
5866 const firstLine = text.split(/\n/)[0]!.trim();
5967 const title =
6068 firstLine.length <= 80 ? firstLine : `${firstLine.slice(0, 77).trimEnd()}…`;
61 const opened = openIssue(app, actor, repo, {
62 title,
63 body: text === firstLine ? "" : text,
64 });
65 if (!opened.ok) return opened;
69 const group = variants > 1 ? id() : undefined;
6670 const crew = listCrewRoles(app.db, repo.id);
6771 const inFlight = new Map<string, number>();
6872 for (const r of listRuns(app.db, repo.id, { kind: "agent", limit: 50 }))
6973 if ((r.state === "running" || r.state === "queued") && r.actorId !== null)
7074 inFlight.set(r.actorId, (inFlight.get(r.actorId) ?? 0) + 1);
71 const routed = await routeIssue(app, repo, opened.value, crew, inFlight);
72 if (routed === undefined)
73 return ok({ issue: opened.value, routed: undefined, assigned: false });
74 const assigned = assignIssue(
75 app,
76 actor,
77 repo,
78 opened.value,
79 routed.builder.user,
75 // One issue per variant: an issue belongs to one builder, so each variant
76 // is its own issue, run and pull, tied by the group id alone (#1571).
77 const told: Told[] = [];
78 for (let n = 0; n < variants; n++) {
79 const opened = openIssue(app, actor, repo, {
80 title,
81 body: text === firstLine ? "" : text,
82 });
83 if (!opened.ok) {
84 if (told.length === 0) return opened;
85 break;
86 }
87 const routed = await routeIssue(app, repo, opened.value, crew, inFlight);
88 if (routed === undefined) {
89 told.push({ issue: opened.value, routed: undefined, assigned: false });
90 break;
91 }
92 const taken = routed.builder.user.id;
93 inFlight.set(taken, (inFlight.get(taken) ?? 0) + 1);
94 const assigned = assignIssue(
95 app,
96 actor,
97 repo,
98 opened.value,
99 routed.builder.user,
100 group,
101 );
102 told.push({ issue: opened.value, routed, assigned: assigned.ok });
103 }
104 const first = told[0]!;
105 return ok(
106 group === undefined
107 ? first
108 : { ...first, variantGroup: group, variants: told },
80109 );
81 return ok({ issue: opened.value, routed, assigned: assigned.ok });
82110 }
83111
84112 /** What every door says when a tell is refused for an unverified address. */
src/core/pulls.ts +27 −5
@@ -57,6 +57,10 @@ export interface Pull extends Issue {
5757 readonly originHeadRepo: string | null;
5858 /** The pull this one reverts, when it was opened by "Take it back". */
5959 readonly revertsPullId: string | null;
60 /** The group of variants this pull is one of (#1571); null for an ordinary pull. */
61 readonly variantGroup: string | null;
62 /** The other pulls of that group, by number; empty for an ordinary pull. */
63 readonly siblings: readonly number[];
6064 }
6165
6266 interface PullRow {
@@ -69,9 +73,22 @@ interface PullRow {
6973 head_repo_id: string | null;
7074 origin_head_repo: string | null;
7175 reverts_issue_id: string | null;
76 variant_group: string | null;
7277 }
7378
74 function fromRow(issue: Issue, row: PullRow): Pull {
79 /** The numbers of the other pulls in a variant group, oldest first. */
80 function siblingsOf(db: Database, issue: Issue, group: string | null): number[] {
81 if (group === null) return [];
82 return db
83 .query<{ number: number }, [string, string]>(
84 `SELECT issue.number AS number FROM pull JOIN issue ON issue.id = pull.issue_id
85 WHERE pull.variant_group = ?1 AND pull.issue_id != ?2 ORDER BY issue.number`,
86 )
87 .all(group, issue.id)
88 .map((r) => r.number);
89 }
90
91 function fromRow(db: Database, issue: Issue, row: PullRow): Pull {
7592 const headRepoId = row.head_repo_id ?? issue.repoId;
7693 return {
7794 ...issue,
@@ -85,6 +102,8 @@ function fromRow(issue: Issue, row: PullRow): Pull {
85102 crossRepo: headRepoId !== issue.repoId,
86103 originHeadRepo: row.origin_head_repo,
87104 revertsPullId: row.reverts_issue_id,
105 variantGroup: row.variant_group,
106 siblings: siblingsOf(db, issue, row.variant_group),
88107 };
89108 }
90109
@@ -92,7 +111,7 @@ function join(db: Database, issue: Issue): Pull | undefined {
92111 const row = db
93112 .query<PullRow, [string]>("SELECT * FROM pull WHERE issue_id = ?1")
94113 .get(issue.id);
95 return row ? fromRow(issue, row) : undefined;
114 return row ? fromRow(db, issue, row) : undefined;
96115 }
97116
98117 export type CreatePullError =
@@ -120,6 +139,8 @@ export interface CreatePullInput {
120139 headDir?: string;
121140 /** The issue id of the pull this one reverts ("Take it back"). */
122141 revertsIssueId?: string;
142 /** The variant group of the run that opens this pull (#1571). */
143 variantGroup?: string;
123144 }
124145
125146 /**
@@ -234,8 +255,8 @@ export async function createPull(
234255
235256 const headRepoId = input.headRepoId ?? input.repoId;
236257 db.query(
237 `INSERT INTO pull (issue_id, base_branch, head_branch, base_oid, head_oid, head_repo_id, reverts_issue_id)
238 VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7)`,
258 `INSERT INTO pull (issue_id, base_branch, head_branch, base_oid, head_oid, head_repo_id, reverts_issue_id, variant_group)
259 VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)`,
239260 ).run(
240261 issue.value.id,
241262 input.baseBranch,
@@ -244,6 +265,7 @@ export async function createPull(
244265 headOid,
245266 headRepoId,
246267 input.revertsIssueId ?? null,
268 input.variantGroup ?? null,
247269 );
248270
249271 // A durable, fetchable ref for the PR head — the way tooling addresses it,
@@ -427,7 +449,7 @@ export function joinMany(db: Database, issues: readonly Issue[]): Pull[] {
427449 const out: Pull[] = [];
428450 for (const issue of issues) {
429451 const row = rows.get(issue.id);
430 if (row !== undefined) out.push(fromRow(issue, row));
452 if (row !== undefined) out.push(fromRow(db, issue, row));
431453 }
432454 return out;
433455 }
src/core/runs.ts +9 −2
@@ -78,6 +78,8 @@ export interface Run {
7878 readonly sandboxNote: string;
7979 /** A failed check's own detail, when its output was recognised; null otherwise. */
8080 readonly checkDetail: CheckDetail | null;
81 /** The group a tell with variants started this run in; null for any other run. */
82 readonly variantGroup: string | null;
8183 readonly createdAt: string;
8284 readonly startedAt: string | null;
8385 /** When this deploy's environment started serving — set once, at the swap-in. */
@@ -106,6 +108,7 @@ interface RunRow {
106108 sandbox_enforced: number | null;
107109 sandbox_note: string;
108110 check_detail: string;
111 variant_group: string | null;
109112 created_at: string;
110113 started_at: string | null;
111114 serving_at: string | null;
@@ -134,6 +137,7 @@ const toRun = (r: RunRow): Run => ({
134137 r.sandbox_enforced === null ? null : r.sandbox_enforced !== 0,
135138 sandboxNote: r.sandbox_note,
136139 checkDetail: r.check_detail ? (JSON.parse(r.check_detail) as CheckDetail) : null,
140 variantGroup: r.variant_group,
137141 createdAt: r.created_at,
138142 startedAt: r.started_at,
139143 servingAt: r.serving_at,
@@ -154,14 +158,16 @@ export interface CreateRunInput {
154158 attempt?: number | undefined;
155159 /** What the card says while it waits. */
156160 summary?: string | undefined;
161 /** The variant group of the tell that started this run. */
162 variantGroup?: string | undefined;
157163 }
158164
159165 export function createRun(db: Database, input: CreateRunInput): Run {
160166 const runId = id();
161167 db.query(
162168 `INSERT INTO run (id, repo_id, kind, issue_id, env, commit_oid, branch, actor_id, reason,
163 not_before, attempt, summary)
164 VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12)`,
169 not_before, attempt, summary, variant_group)
170 VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)`,
165171 ).run(
166172 runId,
167173 input.repoId,
@@ -175,6 +181,7 @@ export function createRun(db: Database, input: CreateRunInput): Run {
175181 input.notBefore ?? null,
176182 input.attempt ?? 0,
177183 input.summary ?? "",
184 input.variantGroup ?? null,
178185 );
179186 return getRun(db, runId)!;
180187 }
src/core/schema.ts +7
@@ -1631,6 +1631,13 @@ export const migrations: readonly string[] = [
16311631 scopes TEXT NOT NULL
16321632 );
16331633 `,
1634 // 78 — variants (#1571): one tell that starts several builders marks their
1635 // runs and the pulls those open with one group id. Null for anything else.
1636 `
1637 ALTER TABLE pull ADD COLUMN variant_group TEXT;
1638 ALTER TABLE run ADD COLUMN variant_group TEXT;
1639 CREATE INDEX pull_variant_group ON pull(variant_group) WHERE variant_group IS NOT NULL;
1640 `,
16341641 ];
16351642
16361643 /**
src/crew/dispatch.ts +6
@@ -259,6 +259,7 @@ export function queueAgentRun(
259259 reason: RunReason,
260260 actorId?: string,
261261 again?: { notBefore: string; attempt: number; summary: string },
262 variantGroup?: string,
262263 ): Run | undefined {
263264 // A suspended or removed owner's repositories run nothing, whoever asks.
264265 if (!accountActive(app.db, repo.ownerId)) return undefined;
@@ -327,6 +328,7 @@ export function queueAgentRun(
327328 actorId: agent.user.id,
328329 reason,
329330 ...again,
331 ...(variantGroup === undefined ? {} : { variantGroup }),
330332 });
331333 });
332334 if (run !== undefined) announceRun(app, run, actorId);
@@ -401,6 +403,10 @@ function route(app: App, event: ForgeEvent): void {
401403 agent,
402404 "assigned",
403405 event.actorId ?? undefined,
406 undefined,
407 typeof event.payload["variantGroup"] === "string"
408 ? event.payload["variantGroup"]
409 : undefined,
404410 );
405411 return;
406412 }
src/crew/runner.ts +3
@@ -1243,6 +1243,7 @@ async function work(
12431243 : `Budget reached at $${stoppedAt.toFixed(2)}; this is where it stopped.`,
12441244 write,
12451245 Object.values(grant.env),
1246 run.variantGroup ?? undefined,
12461247 );
12471248 return {
12481249 state: result.ok || landed.pushed ? "ok" : "failed",
@@ -1511,6 +1512,7 @@ async function landWork(
15111512 note: string | undefined,
15121513 write: (line: string) => void,
15131514 granted: readonly string[] = [],
1515 variantGroup?: string,
15141516 ): Promise<{ pushed: boolean; summary: string }> {
15151517 // A model may echo a granted value into a file; the tree is scrubbed
15161518 // before the forge commits it, and the agent's own commits are searched
@@ -1655,6 +1657,7 @@ async function landWork(
16551657 baseBranch: repo.defaultBranch,
16561658 headBranch: branch,
16571659 headRepo: fork,
1660 ...(variantGroup === undefined ? {} : { variantGroup }),
16581661 });
16591662 if (!opened.ok) {
16601663 write(`could not open the pull: ${JSON.stringify(opened.error)}`);
src/http/feed.ts +28 −3
@@ -3,7 +3,7 @@
33 * are the signed-in viewer's own — there is no way to ask for another's.
44 */
55
6 import { tell, UNVERIFIED_WORDS } from "../actions/tell.ts";
6 import { tell, UNVERIFIED_WORDS, VARIANTS_MAX } from "../actions/tell.ts";
77 import { DIRECTION_NOTE } from "../crew/direct.ts";
88 import { audienceFilter } from "../core/event_audience.ts";
99 import { getEvent } from "../core/events.ts";
@@ -154,20 +154,38 @@ export function feedRoutes(router: Router<Handler>): void {
154154 const text = str(input.text).trim();
155155 if (text === "" || text.length > 2000)
156156 return apiError("invalid_text", 422, "text is 1 to 2000 characters");
157 const variants = parseVariants(input.variants);
158 if (variants === undefined)
159 return apiError(
160 "invalid_variants",
161 400,
162 `variants is an integer from 1 to ${VARIANTS_MAX}`,
163 );
157164 const [owner, name, extra] = str(input.app).split("/");
158165 const repo =
159166 owner && name && extra === undefined
160167 ? getRepo(ctx.app.db, owner, name)
161168 : undefined;
162169 if (!repo || !canRead(ctx.app.db, repo, viewer)) return notFound();
163 const told = await tell(ctx.app, viewer, repo, text);
170 const told = await tell(ctx.app, viewer, repo, text, variants);
164171 if (!told.ok)
165172 return told.error === "forbidden"
166173 ? apiError("forbidden", 403, DIRECTION_NOTE)
167174 : told.error === "unverified"
168175 ? apiError("unverified", 403, UNVERIFIED_WORDS)
169176 : apiError("refused", told.error === "unauthorized" ? 403 : 422, "that could not be told");
170 return json({ issue: told.value.issue.number }, 201);
177 return json(
178 {
179 issue: told.value.issue.number,
180 ...(told.value.variantGroup === undefined
181 ? {}
182 : {
183 variantGroup: told.value.variantGroup,
184 issues: (told.value.variants ?? []).map((t) => t.issue.number),
185 }),
186 },
187 201,
188 );
171189 });
172190
173191 router.add("POST", "/api/v1/share", async (ctx) => {
@@ -190,6 +208,13 @@ export function feedRoutes(router: Router<Handler>): void {
190208 });
191209 }
192210
211 /** `variants` as 1–4: absent is 1; a string, a fraction or out of range is undefined. */
212 export function parseVariants(raw: unknown): number | undefined {
213 if (raw === undefined) return 1;
214 if (typeof raw !== "number" || !Number.isInteger(raw)) return undefined;
215 return raw >= 1 && raw <= VARIANTS_MAX ? raw : undefined;
216 }
217
193218 /** `to` as a list of usernames: absent, one, or a few; anything else is no. */
194219 export function parseTargets(raw: unknown): string[] | undefined {
195220 if (raw === undefined || raw === null) return [];
test/variants.test.ts added +176
@@ -0,0 +1,176 @@
1 /**
2 * A tell through the API with `variants` (#1571): n builders' runs share one
3 * group id and the pulls they open carry it. No real agent runs here.
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 { addToCrew, createAgent } from "../src/actions/crew.ts";
11 import { openPull } from "../src/actions/pulls.ts";
12 import { commitToBranch, createRepo } from "../src/actions/repos.ts";
13 import { getPull } from "../src/core/pulls.ts";
14 import { type Repo } from "../src/core/repos.ts";
15 import { listRuns } from "../src/core/runs.ts";
16 import { createToken } from "../src/core/tokens.ts";
17 import { createUser, type User } from "../src/core/users.ts";
18 import { startCrew } from "../src/crew/dispatch.ts";
19 import { serve, type Servers } from "../src/http/server.ts";
20 import { quietLogs } from "./helpers/globals.ts";
21
22 quietLogs();
23
24 let dataDir: string;
25 let app: App;
26 let servers: Servers;
27 let alice: User;
28 let repo: Repo;
29 let auth: Record<string, string>;
30 let crew: Awaited<ReturnType<typeof startCrew>> | undefined;
31
32 const ok = <T>(
33 r: { ok: true; value: T } | { ok: false; error: unknown },
34 ): T => {
35 if (!r.ok) throw new Error(JSON.stringify(r.error));
36 return r.value;
37 };
38
39 const say = (extra: Record<string, unknown>) =>
40 fetch(`${servers.url}/api/v1/feed/tells`, {
41 method: "POST",
42 headers: { ...auth, "content-type": "application/json" },
43 body: JSON.stringify({ app: "alice/square", text: "Round it", ...extra }),
44 });
45
46 const runs = () => listRuns(app.db, repo.id, { kind: "agent" });
47
48 beforeAll(async () => {
49 dataDir = await mkdtemp(join(tmpdir(), "forge-variants-"));
50 app = createApp({ dataDir, port: 0 });
51 servers = await serve(app);
52 // A crew whose Claude Code does not exist: dispatch queues for real and
53 // no agent runs.
54 crew = await startCrew(app, {
55 forgeUrl: servers.url,
56 localUrl: servers.url,
57 binary: join(dataDir, "no-such-claude"),
58 concurrency: 1,
59 budgetUsd: 1,
60 runTimeoutMs: 60_000,
61 });
62 alice = ok(
63 await createUser(app.db, {
64 trusted: true,
65 username: "alice",
66 email: "[email protected]",
67 password: "a-good-passphrase",
68 adminIfFirst: true,
69 }),
70 );
71 ok(await createAgent(app, alice, { username: "mason" }));
72 repo = ok(await createRepo(app, alice, { name: "square", visibility: "public" }));
73 ok(
74 await commitToBranch(app, alice, repo, {
75 message: "Start",
76 files: [{ path: "README.md", content: "# square\n" }],
77 }),
78 );
79 expect(addToCrew(app, alice, repo, "mason").ok).toBe(true);
80 auth = {
81 authorization: `Bearer ${createToken(app.db, alice.id, "t", "rw").token}`,
82 };
83 }, 30_000);
84
85 afterAll(async () => {
86 await crew?.stop();
87 servers?.stop();
88 app?.close();
89 await rm(dataDir, { recursive: true, force: true });
90 });
91
92 describe("variants on a tell", () => {
93 test("a plain tell has no group", async () => {
94 const res = await say({});
95 expect(res.status).toBe(201);
96 const body = (await res.json()) as Record<string, unknown>;
97 expect(body["variantGroup"]).toBeUndefined();
98 expect(runs().length).toBe(1);
99 expect(runs()[0]!.variantGroup).toBeNull();
100 });
101
102 test("variants: 2 makes two runs in one group", async () => {
103 const before = runs().length;
104 const res = await say({ variants: 2 });
105 expect(res.status).toBe(201);
106 const body = (await res.json()) as { variantGroup: string; issues: number[] };
107 expect(body.issues.length).toBe(2);
108 const made = runs().filter((r) => r.variantGroup === body.variantGroup);
109 expect(runs().length).toBe(before + 2);
110 expect(made.length).toBe(2);
111 expect(new Set(made.map((r) => r.issueId)).size).toBe(2);
112 });
113
114 test.each([0, 9, "2", 2.5, null, -1])("variants %p is a 400", async (bad) => {
115 const before = runs().length;
116 const res = await say({ variants: bad });
117 expect(res.status).toBe(400);
118 expect(((await res.json()) as { error: string }).error).toBe(
119 "invalid_variants",
120 );
121 expect(runs().length).toBe(before);
122 });
123
124 test("the pulls of one group carry it and name each other", async () => {
125 const group = runs().find((r) => r.variantGroup !== null)!.variantGroup!;
126 const numbers: number[] = [];
127 for (const branch of ["one", "two"]) {
128 ok(
129 await commitToBranch(app, alice, repo, {
130 branch,
131 base: "main",
132 message: branch,
133 files: [{ path: `${branch}.txt`, content: `${branch}\n` }],
134 }),
135 );
136 const pull = ok(
137 await openPull(app, alice, repo, {
138 title: branch,
139 baseBranch: "main",
140 headBranch: branch,
141 variantGroup: group,
142 }),
143 );
144 numbers.push(pull.number);
145 }
146 const [a, b] = numbers as [number, number];
147 expect(getPull(app.db, repo.id, a)!.siblings).toEqual([b]);
148 const res = await fetch(
149 `${servers.url}/api/v1/repos/alice/square/pulls/${b}`,
150 { headers: auth },
151 );
152 const json = (await res.json()) as { variantGroup: string; siblings: number[] };
153 expect(json.variantGroup).toBe(group);
154 expect(json.siblings).toEqual([a]);
155 });
156
157 test("an ordinary pull has no group and no siblings", async () => {
158 ok(
159 await commitToBranch(app, alice, repo, {
160 branch: "plain",
161 base: "main",
162 message: "plain",
163 files: [{ path: "p.txt", content: "p\n" }],
164 }),
165 );
166 const pull = ok(
167 await openPull(app, alice, repo, {
168 title: "plain",
169 baseBranch: "main",
170 headBranch: "plain",
171 }),
172 );
173 expect(pull.variantGroup).toBeNull();
174 expect(pull.siblings).toEqual([]);
175 });
176 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs