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

The preview seed holds a wave and a milestone, so the Story pages are seen filled on every preview #8884

Parked opened this
Closed without merging

scout/forge:scout/8868-the-preview-seed-holds-a-wave-and-a-mile → main 4 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
7 files changed +77 −13
docs/APPS.md +1 −1
@@ -1228,7 +1228,7 @@ When a deploy comes up green the forge takes a picture of it — every page
12281228 (390×844), a laptop's (1280×800), and a thumb's (200×125, desktop's own
12291229 aspect, small), and keeps the pictures beside the commit they are of, so a
12301230 person judges a change from what it is rather than from what it says.
1231 `app.looks` may name at most 24 pages: a browser start per picture per
1231 `app.looks` may name at most 26 pages: a browser start per picture per
12321232 width is the heaviest thing the forge does, and more is a manifest error
12331233 rather than a silent, slower deploy. The pull page shows the phone and
12341234 desktop pair under the checks, with the commit and a word when the head has
forge.json +2 −2
@@ -3,8 +3,8 @@
33 "api.anthropic.com"
44 ],
55 "app": {
6 "looks": ["/", "/forges", "/family", "/front", "/explore", "/board", "/notes", "/feed", "/review", "/new", "/audit", "/releases", "/apps", "/repos", "/map", "/system", "/talk", "/flow", "/resilience", "/settings", "/preview-admin/sample", "/preview-admin/sample/pulls/3", "/preview-admin/sample/next", "/preview-admin/sample/bets"],
7 "looksAsOwner": ["/", "/flow", "/talk", "/system", "/resilience", "/preview-admin/sample", "/preview-admin/sample/pulls/3", "/preview-admin/sample/next", "/preview-admin/sample/bets"],
6 "looks": ["/", "/forges", "/family", "/front", "/explore", "/board", "/notes", "/feed", "/review", "/new", "/audit", "/releases", "/apps", "/repos", "/map", "/system", "/talk", "/flow", "/resilience", "/settings", "/preview-admin/sample", "/preview-admin/sample/pulls/3", "/preview-admin/sample/next", "/preview-admin/sample/bets", "/preview-admin/sample/waves", "/preview-admin/sample/milestones"],
7 "looksAsOwner": ["/", "/flow", "/talk", "/system", "/resilience", "/preview-admin/sample", "/preview-admin/sample/pulls/3", "/preview-admin/sample/next", "/preview-admin/sample/bets", "/preview-admin/sample/waves", "/preview-admin/sample/milestones"],
88 "run": "bun run src/main.ts",
99 "install": "",
1010 "health": "/healthz",
src/apps/manifest.ts +1 −1
@@ -79,7 +79,7 @@ const COMMAND_MAX = 1_000;
7979 /** More than this many pages is a manifest error: a browser start per
8080 * picture per width is the heaviest thing the forge does. Room for every
8181 * top-level page of the forge itself. */
82 const LOOKS_MAX = 24;
82 const LOOKS_MAX = 26;
8383 const LOOK_PATH_MAX = 200;
8484
8585 /**
src/spawn/preview-seed.ts +50 −1
@@ -25,6 +25,8 @@ import { openPull } from "../actions/pulls.ts";
2525 import { commitToBranch, createRepo } from "../actions/repos.ts";
2626 import { turnValveFor } from "../actions/valves.ts";
2727 import { insertBet } from "../core/bets.ts";
28 import { addDependency } from "../core/dependencies.ts";
29 import { writeWave, type Wave } from "../story/wave.ts";
2830 import { claimRun, createRun, finishRun } from "../core/runs.ts";
2931 import { noteLimit } from "../core/standing.ts";
3032 import { addSubscription } from "../core/subscriptions.ts";
@@ -45,6 +47,21 @@ export const PREVIEW_REPO = "sample";
4547 export const PREVIEW_PULL = 3;
4648 /** The board whose panels are pinned to home. */
4749 const PREVIEW_BOARD = "preview";
50 /** The wave the sample repository holds: it names the seeded pull. */
51 export const PREVIEW_WAVE_HEADLINE = "A greeting lands";
52 /** The milestone the seeded issues hold up. */
53 export const PREVIEW_MILESTONE = "Say hello everywhere";
54 const PREVIEW_WAVE: Wave = {
55 version: "0.1.0",
56 date: "2026-11-01",
57 headline: PREVIEW_WAVE_HEADLINE,
58 highlights: [
59 { title: "A greeting", why: "The sample says hello" },
60 { title: "A flow week", why: "A reviewer sees the pipes" },
61 { title: "Bets", why: "The week is shared out" },
62 ],
63 pulls: [{ title: "#3 Say hello", url: `https://preview.invalid/${PREVIEW_ADMIN}/${PREVIEW_REPO}/pulls/${String(PREVIEW_PULL)}` }],
64 };
4865 const SEEDED = "preview_seeded";
4966
5067 type Env = Record<string, string | undefined>;
@@ -109,9 +126,14 @@ async function seedWorld(app: App, admin: User): Promise<Result<void, string>> {
109126 description: "A preview's sample repository",
110127 });
111128 if (!repo.ok) return err(`the sample repository: ${String(repo.error)}`);
129 const wave = writeWave(PREVIEW_WAVE);
130 if (!wave.ok) return err(`the wave: ${wave.error.message}`);
112131 const start = await commitToBranch(app, admin, repo.value, {
113132 message: "Start",
114 files: [{ path: "README.md", content: "# sample\n\nA preview's sample repository.\n" }],
133 files: [
134 { path: "README.md", content: "# sample\n\nA preview's sample repository.\n" },
135 { path: `waves/${PREVIEW_WAVE.version}.md`, content: wave.value },
136 ],
115137 });
116138 if (!start.ok) return err(`the first commit: ${JSON.stringify(start.error)}`);
117139 const branch = await commitToBranch(app, admin, repo.value, {
@@ -168,6 +190,8 @@ async function seedWorld(app: App, admin: User): Promise<Result<void, string>> {
168190 if (!priced.ok) return priced;
169191 const bets = seedBets(app, admin, repo.value, open);
170192 if (!bets.ok) return bets;
193 const milestone = seedMilestone(app, admin, repo.value, issues);
194 if (!milestone.ok) return milestone;
171195 const valve = turnValveFor(app, admin, `${PREVIEW_ADMIN}/${PREVIEW_REPO}`, 60);
172196 if (!valve.ok) return err(`the valve: ${valve.error}`);
173197
@@ -268,3 +292,28 @@ function seedBets(app: App, admin: User, repo: Repo, open: readonly Issue[]): Re
268292 const result = backBet(app, admin, repo, backed.id, 20);
269293 return result.ok ? ok() : err(`backing a bet: ${result.error.message}`);
270294 }
295
296 /** A milestone that waits for the first two issues, one of them done: half way. */
297 function seedMilestone(
298 app: App,
299 admin: User,
300 repo: Repo,
301 held: readonly Result<Issue, unknown>[],
302 ): Result<void, string> {
303 const top = openIssue(app, admin, repo, {
304 title: PREVIEW_MILESTONE,
305 body: "Done when the pages greet and the week shows.",
306 });
307 if (!top.ok) return err(`the milestone: ${String(top.error)}`);
308 const beneath = held.flatMap((h) => (h.ok ? [h.value] : []));
309 for (const b of beneath) {
310 const linked = addDependency(app.db, top.value, b, admin.id);
311 if (!linked.ok) return err(`the milestone's link: ${linked.error}`);
312 }
313 const first = beneath[0];
314 if (first !== undefined) {
315 const closed = setIssueState(app, admin, repo, first, "closed", { reason: "done" });
316 if (!closed.ok) return err(`closing a held issue: ${String(closed.error)}`);
317 }
318 return ok();
319 }
test/apps-adversarial.test.ts +4 −4
@@ -366,16 +366,16 @@ describe("manifest: parseManifest edge cases", () => {
366366 if (result.ok) expect(result.value.looks).toEqual(["/"]);
367367 });
368368
369 test("app.looks names up to 24 pages, enough for every top-level page of the forge", () => {
370 const looks = Array.from({ length: 24 }, (_, i) => `/p${i}`);
369 test("app.looks names up to 26 pages, enough for every top-level page of the forge", () => {
370 const looks = Array.from({ length: 26 }, (_, i) => `/p${i}`);
371371 const result = parseManifest(JSON.stringify({ app: { run: "x", looks } }), undefined);
372372 expect(result.ok).toBe(true);
373373 if (result.ok) expect(result.value.looks).toEqual(looks);
374374 });
375 test("app.looks with more than 24 paths is refused", () => {
375 test("app.looks with more than 26 paths is refused", () => {
376376 const result = parseManifest(
377377 JSON.stringify({
378 app: { run: "x", looks: Array.from({ length: 25 }, (_, i) => `/p${i}`) },
378 app: { run: "x", looks: Array.from({ length: 27 }, (_, i) => `/p${i}`) },
379379 }),
380380 undefined,
381381 );
test/forge-looks.test.ts +2 −2
@@ -120,9 +120,9 @@ test("every listed path answers 200 to an admin", async () => {
120120 for (const p of declared()) expect([p, (await get(p)).status]).toEqual([p, 200]);
121121 });
122122
123 test("app.looks stays within 24 paths, each once", () => {
123 test("app.looks stays within 26 paths, each once", () => {
124124 const { looks } = manifest();
125 expect(looks.length).toBeLessThanOrEqual(24);
125 expect(looks.length).toBeLessThanOrEqual(26);
126126 expect(new Set(looks).size).toBe(looks.length);
127127 });
128128
test/looks-owner.test.ts +17 −2
@@ -34,7 +34,7 @@ import { ok } from "../src/kernel/result.ts";
3434 import type { Capture, LookInput } from "../src/looks/capture.ts";
3535 import { startLooks, type LooksHandle } from "../src/looks/service.ts";
3636 import { previewIdentityKey } from "../src/spawn/preview-owner.ts";
37 import { PREVIEW_ADMIN, PREVIEW_PULL, PREVIEW_REPO, seedPreview } from "../src/spawn/preview-seed.ts";
37 import { PREVIEW_ADMIN, PREVIEW_MILESTONE, PREVIEW_PULL, PREVIEW_WAVE_HEADLINE, PREVIEW_REPO, seedPreview } from "../src/spawn/preview-seed.ts";
3838 import { quietLogs } from "./helpers/globals.ts";
3939
4040 quietLogs();
@@ -110,7 +110,7 @@ describe("the preview seed", () => {
110110 const issues = app.db
111111 .query<{ n: number }, [string]>("SELECT COUNT(*) AS n FROM issue WHERE repo_id = ?1 AND kind = 'issue'")
112112 .get(repo.id);
113 expect(issues?.n).toBe(11);
113 expect(issues?.n).toBe(12);
114114 expect(listPulls(app.db, repo.id).length).toBe(1);
115115 expect(listRuns(app.db, repo.id, { kind: "agent" }).every((r) => r.state === "ok")).toBe(true);
116116 const pipes = readPipes(app.db, admin.id);
@@ -295,6 +295,21 @@ describe("the forge's own owner looks, over the preview seed", () => {
295295 expect(page).toContain(`href="${repoHome}">${PREVIEW_REPO}`);
296296 });
297297
298 test("the waves and milestones pages are looked at as the owner, and are filled", async () => {
299 const manifest = parseManifest(readFileSync(join(import.meta.dir, "..", "forge.json"), "utf8"), undefined);
300 if (!manifest.ok) throw new Error(JSON.stringify(manifest.error));
301 for (const page of [`${repoHome}/waves`, `${repoHome}/milestones`]) {
302 expect(manifest.value.looks).toContain(page);
303 expect(manifest.value.looksAsOwner).toContain(page);
304 }
305 const waves = await asOwner(`${repoHome}/waves`);
306 expect(waves).toContain(PREVIEW_WAVE_HEADLINE);
307 expect(waves).toContain("1 pull");
308 const milestones = await asOwner(`${repoHome}/milestones`);
309 expect(milestones).toContain(PREVIEW_MILESTONE);
310 expect(milestones).toContain("1 of 2 done");
311 });
312
298313 test("the pull's page carries the Ship decision", async () => {
299314 const page = await asOwner(pullPage);
300315 const decide = page.indexOf('id="decide"');

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs