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

The morning paper's schedule has run once and /edition prints its time, so the v1 probe's schedules line passes #15406

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

mason/forge:mason/15405-the-morning-paper-s-schedule-has-run-onc → main 0 commits fork

  • Merged. mason/15405-the-morning-paper-s-schedule-has-run-onc was merged into main as ecb42b6.

Review

Sign in to review this change.
2 files changed +51 −1
docs/OPERATING.md +1 −1
@@ -363,7 +363,7 @@ and an accessibility tree, which nothing dependency-free gives.
363363
364364 `bun scripts/v1-probe.ts https://forge.open-platform.sh` reads production (GETs and one MCP initialize, never signed in) and prints PASS, FAIL or UNKNOWN per v1.0.0 item with its URL and evidence.
365365 `--edition <url>` names a public page a scheduled app prints (the morning paper's latest edition): its newest `<time datetime>` proves the schedules line, PASS within 24 h, FAIL older, UNKNOWN when the page is not public. Without it that line is UNKNOWN, because the schedules API answers 404 to an anonymous read. No public page prints a dated edition yet: the morning paper posts only in the signed-in Captain thread. #15393 adds one, and that page is the URL to pass.
366 The `schedules ran in 24 h` line reads a public page's newest `<time datetime>`: pass `--edition https://forge.open-platform.sh/edition`. That page (`src/http/edition.ts`) prints when the newest morning paper ran and nothing of the thread it was posted in; before any paper has run it prints no `<time>`. Its ETag holds the newest run and the build, so a deploy never answers 304 to older markup; signed-in and flash responses are never tagged.
366 The `schedules ran in 24 h` line reads a public page's newest `<time datetime>`: pass `--edition https://forge.open-platform.sh/edition`. That page (`src/http/edition.ts`) prints when the newest morning paper ran and nothing of the thread it was posted in; before any paper has run it prints no `<time>`. Its ETag holds the newest run and the build, so a deploy never answers 304 to older markup; signed-in and flash responses are never tagged. The paper is written by the routine clock (`startRoutines` in `src/crew/routines.ts`, a pass every minute, the paper at 07:00 UTC), which starts only when the crew does: a preview, where the crew is held off, never prints one and its `/edition` stays without a `<time>`. Probe production, not a preview (#15405).
367367 The owner tags v1.0.0 only when every line is PASS; an UNKNOWN line names what a person must check, and is not a pass.
368368
369369 ## Secrets in the terminal
test/edition.test.ts +50
@@ -11,6 +11,10 @@ import { createUser } from "../src/core/users.ts";
1111 import { serve, type Servers } from "../src/http/server.ts";
1212 import { latestEdition } from "../src/core/edition.ts";
1313 import { editionTag } from "../src/http/edition.ts";
14 import { runDue } from "../src/crew/routines.ts";
15 import { quietLogs } from "./helpers/globals.ts";
16
17 quietLogs();
1418
1519 describe("GET /edition", () => {
1620 let dataDir: string;
@@ -53,6 +57,52 @@ describe("GET /edition", () => {
5357 });
5458 });
5559
60 // The proof the v1 probe reads (#15405): the minute clock's own pass, on a fake clock, prints the
61 // paper and `/edition` shows that instant to a stranger. No request runs it; no route is written
62 // to.
63 describe("GET /edition after the scheduled run", () => {
64 let dataDir: string;
65 let app: App;
66 let servers: Servers;
67
68 beforeAll(async () => {
69 dataDir = await mkdtemp(join(tmpdir(), "forge-edition-run-"));
70 app = createApp({ dataDir, port: 0 });
71 servers = await serve(app);
72 const u = await createUser(app.db, { origin: "seed", trusted: true, username: "carol", email: "[email protected]", password: "a-good-passphrase", adminIfFirst: true });
73 if (!u.ok) throw new Error(u.error);
74 }, 30_000);
75
76 afterAll(async () => {
77 servers.stop();
78 app.close();
79 await rm(dataDir, { recursive: true, force: true });
80 });
81
82 const edition = async (): Promise<string> => {
83 const res = await fetch(`${servers.url}/edition`, { redirect: "manual" });
84 expect(res.status).toBe(200);
85 return res.text();
86 };
87 const quiet = async (): Promise<boolean> => true;
88
89 test("the 07:00 pass prints the paper, and the page names its instant", async () => {
90 expect(await edition()).not.toContain("<time");
91 const first = await runDue(app, new Date("2026-11-20T07:00:30.000Z"), quiet);
92 expect(first.map((p) => p.kind)).toContain("paper");
93 expect(await edition()).toContain('datetime="2026-11-20T07:00:30.000Z"');
94 });
95
96 test("a later pass the same day leaves it; the next morning's pass moves it", async () => {
97 const later = await runDue(app, new Date("2026-11-20T18:00:00.000Z"), quiet);
98 expect(later.map((p) => p.kind)).not.toContain("paper");
99 expect(await edition()).toContain('datetime="2026-11-20T07:00:30.000Z"');
100 const next = await runDue(app, new Date("2026-11-21T07:00:30.000Z"), quiet);
101 expect(next.map((p) => p.kind)).toContain("paper");
102 expect(await edition()).toContain('datetime="2026-11-21T07:00:30.000Z"');
103 });
104 });
105
56106 describe("GET /edition caching", () => {
57107 let dataDir: string;
58108 let app: App;

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs