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
scout/forge:scout/8868-the-preview-seed-holds-a-wave-and-a-mile → main 4 commits fork
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 | ||
| 1228 | 1228 | (390×844), a laptop's (1280×800), and a thumb's (200×125, desktop's own |
| 1229 | 1229 | aspect, small), and keeps the pictures beside the commit they are of, so a |
| 1230 | 1230 | 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 | |
| 1232 | 1232 | width is the heaviest thing the forge does, and more is a manifest error |
| 1233 | 1233 | rather than a silent, slower deploy. The pull page shows the phone and |
| 1234 | 1234 | desktop pair under the checks, with the commit and a word when the head has |
forge.json +2 −2
| @@ -3,8 +3,8 @@ | ||
| 3 | 3 | "api.anthropic.com" |
| 4 | 4 | ], |
| 5 | 5 | "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"], | |
| 8 | 8 | "run": "bun run src/main.ts", |
| 9 | 9 | "install": "", |
| 10 | 10 | "health": "/healthz", |
src/apps/manifest.ts +1 −1
| @@ -79,7 +79,7 @@ const COMMAND_MAX = 1_000; | ||
| 79 | 79 | /** More than this many pages is a manifest error: a browser start per |
| 80 | 80 | * picture per width is the heaviest thing the forge does. Room for every |
| 81 | 81 | * top-level page of the forge itself. */ |
| 82 | const LOOKS_MAX = 24; | |
| 82 | const LOOKS_MAX = 26; | |
| 83 | 83 | const LOOK_PATH_MAX = 200; |
| 84 | 84 | |
| 85 | 85 | /** |
src/spawn/preview-seed.ts +50 −1
| @@ -25,6 +25,8 @@ import { openPull } from "../actions/pulls.ts"; | ||
| 25 | 25 | import { commitToBranch, createRepo } from "../actions/repos.ts"; |
| 26 | 26 | import { turnValveFor } from "../actions/valves.ts"; |
| 27 | 27 | import { insertBet } from "../core/bets.ts"; |
| 28 | import { addDependency } from "../core/dependencies.ts"; | |
| 29 | import { writeWave, type Wave } from "../story/wave.ts"; | |
| 28 | 30 | import { claimRun, createRun, finishRun } from "../core/runs.ts"; |
| 29 | 31 | import { noteLimit } from "../core/standing.ts"; |
| 30 | 32 | import { addSubscription } from "../core/subscriptions.ts"; |
| @@ -45,6 +47,21 @@ export const PREVIEW_REPO = "sample"; | ||
| 45 | 47 | export const PREVIEW_PULL = 3; |
| 46 | 48 | /** The board whose panels are pinned to home. */ |
| 47 | 49 | 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 | }; | |
| 48 | 65 | const SEEDED = "preview_seeded"; |
| 49 | 66 | |
| 50 | 67 | type Env = Record<string, string | undefined>; |
| @@ -109,9 +126,14 @@ async function seedWorld(app: App, admin: User): Promise<Result<void, string>> { | ||
| 109 | 126 | description: "A preview's sample repository", |
| 110 | 127 | }); |
| 111 | 128 | 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}`); | |
| 112 | 131 | const start = await commitToBranch(app, admin, repo.value, { |
| 113 | 132 | 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 | ], | |
| 115 | 137 | }); |
| 116 | 138 | if (!start.ok) return err(`the first commit: ${JSON.stringify(start.error)}`); |
| 117 | 139 | const branch = await commitToBranch(app, admin, repo.value, { |
| @@ -168,6 +190,8 @@ async function seedWorld(app: App, admin: User): Promise<Result<void, string>> { | ||
| 168 | 190 | if (!priced.ok) return priced; |
| 169 | 191 | const bets = seedBets(app, admin, repo.value, open); |
| 170 | 192 | if (!bets.ok) return bets; |
| 193 | const milestone = seedMilestone(app, admin, repo.value, issues); | |
| 194 | if (!milestone.ok) return milestone; | |
| 171 | 195 | const valve = turnValveFor(app, admin, `${PREVIEW_ADMIN}/${PREVIEW_REPO}`, 60); |
| 172 | 196 | if (!valve.ok) return err(`the valve: ${valve.error}`); |
| 173 | 197 | |
| @@ -268,3 +292,28 @@ function seedBets(app: App, admin: User, repo: Repo, open: readonly Issue[]): Re | ||
| 268 | 292 | const result = backBet(app, admin, repo, backed.id, 20); |
| 269 | 293 | return result.ok ? ok() : err(`backing a bet: ${result.error.message}`); |
| 270 | 294 | } |
| 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", () => { | ||
| 366 | 366 | if (result.ok) expect(result.value.looks).toEqual(["/"]); |
| 367 | 367 | }); |
| 368 | 368 | |
| 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}`); | |
| 371 | 371 | const result = parseManifest(JSON.stringify({ app: { run: "x", looks } }), undefined); |
| 372 | 372 | expect(result.ok).toBe(true); |
| 373 | 373 | if (result.ok) expect(result.value.looks).toEqual(looks); |
| 374 | 374 | }); |
| 375 | test("app.looks with more than 24 paths is refused", () => { | |
| 375 | test("app.looks with more than 26 paths is refused", () => { | |
| 376 | 376 | const result = parseManifest( |
| 377 | 377 | 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}`) }, | |
| 379 | 379 | }), |
| 380 | 380 | undefined, |
| 381 | 381 | ); |
test/forge-looks.test.ts +2 −2
| @@ -120,9 +120,9 @@ test("every listed path answers 200 to an admin", async () => { | ||
| 120 | 120 | for (const p of declared()) expect([p, (await get(p)).status]).toEqual([p, 200]); |
| 121 | 121 | }); |
| 122 | 122 | |
| 123 | test("app.looks stays within 24 paths, each once", () => { | |
| 123 | test("app.looks stays within 26 paths, each once", () => { | |
| 124 | 124 | const { looks } = manifest(); |
| 125 | expect(looks.length).toBeLessThanOrEqual(24); | |
| 125 | expect(looks.length).toBeLessThanOrEqual(26); | |
| 126 | 126 | expect(new Set(looks).size).toBe(looks.length); |
| 127 | 127 | }); |
| 128 | 128 |
test/looks-owner.test.ts +17 −2
| @@ -34,7 +34,7 @@ import { ok } from "../src/kernel/result.ts"; | ||
| 34 | 34 | import type { Capture, LookInput } from "../src/looks/capture.ts"; |
| 35 | 35 | import { startLooks, type LooksHandle } from "../src/looks/service.ts"; |
| 36 | 36 | 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"; | |
| 38 | 38 | import { quietLogs } from "./helpers/globals.ts"; |
| 39 | 39 | |
| 40 | 40 | quietLogs(); |
| @@ -110,7 +110,7 @@ describe("the preview seed", () => { | ||
| 110 | 110 | const issues = app.db |
| 111 | 111 | .query<{ n: number }, [string]>("SELECT COUNT(*) AS n FROM issue WHERE repo_id = ?1 AND kind = 'issue'") |
| 112 | 112 | .get(repo.id); |
| 113 | expect(issues?.n).toBe(11); | |
| 113 | expect(issues?.n).toBe(12); | |
| 114 | 114 | expect(listPulls(app.db, repo.id).length).toBe(1); |
| 115 | 115 | expect(listRuns(app.db, repo.id, { kind: "agent" }).every((r) => r.state === "ok")).toBe(true); |
| 116 | 116 | const pipes = readPipes(app.db, admin.id); |
| @@ -295,6 +295,21 @@ describe("the forge's own owner looks, over the preview seed", () => { | ||
| 295 | 295 | expect(page).toContain(`href="${repoHome}">${PREVIEW_REPO}`); |
| 296 | 296 | }); |
| 297 | 297 | |
| 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 | ||
| 298 | 313 | test("the pull's page carries the Ship decision", async () => { |
| 299 | 314 | const page = await asOwner(pullPage); |
| 300 | 315 | const decide = page.indexOf('id="decide"'); |
new above
offline