Public: anyone can read this; the crew can change it.
Production /changelog.atom has no entries although /changelog lists releases #13098
Check · Review · Land · Live done — Landed and live in production.
torque/forge:torque/13097-production-changelog-atom-has-no-entries → main 3 commits fork 1 thread · 1 unresolved
2 files
changed +77
−6
src/release/answer.ts +12 −6
| @@ -22,13 +22,19 @@ export type ReleasesAnswer = | ||
| 22 | 22 | | { ok: true; value: unknown } |
| 23 | 23 | | { ok: false; error: "forbidden"; message: string }; |
| 24 | 24 | |
| 25 | /** Reads in flight, shared: concurrent anonymous requests cost git and the merged rows once. */ | |
| 26 | let reading: Promise<Landings> | undefined; | |
| 25 | /** | |
| 26 | * Reads in flight, shared: concurrent anonymous requests cost git and the | |
| 27 | * merged rows once. One per forge (its database), for a forge hosted beside | |
| 28 | * another in one process must never be answered with the other's landings (#13097). | |
| 29 | */ | |
| 30 | const reading = new WeakMap<App["db"], Promise<Landings>>(); | |
| 27 | 31 | function readOnce(app: App): Promise<Landings> { |
| 28 | reading ??= readLandings(app).finally(() => { | |
| 29 | reading = undefined; | |
| 30 | }); | |
| 31 | return reading; | |
| 32 | let read = reading.get(app.db); | |
| 33 | if (read === undefined) { | |
| 34 | read = readLandings(app).finally(() => reading.delete(app.db)); | |
| 35 | reading.set(app.db, read); | |
| 36 | } | |
| 37 | return read; | |
| 32 | 38 | } |
| 33 | 39 | |
| 34 | 40 | /** |
test/shipped-answer-per-forge.test.ts added +65
| @@ -0,0 +1,65 @@ | ||
| 1 | /** Concurrent reads of what went live are shared per forge, never across two forges in one | |
| 2 | * process (#13097). */ | |
| 3 | import { afterAll, beforeAll, expect, test } from "bun:test"; | |
| 4 | import { mkdtemp, rm } from "node:fs/promises"; | |
| 5 | import { tmpdir } from "node:os"; | |
| 6 | import { join } from "node:path"; | |
| 7 | import { createApp, type App } from "../src/app.ts"; | |
| 8 | import { createRepo } from "../src/actions/repos.ts"; | |
| 9 | import { createUser } from "../src/core/users.ts"; | |
| 10 | import { shippedAnswer } from "../src/release/answer.ts"; | |
| 11 | ||
| 12 | let dirs: string[] = []; | |
| 13 | let busy: App; | |
| 14 | let quiet: App; | |
| 15 | ||
| 16 | async function forge(withPull: boolean): Promise<App> { | |
| 17 | const dataDir = await mkdtemp(join(tmpdir(), "forge-shipped-")); | |
| 18 | dirs.push(dataDir); | |
| 19 | const app = createApp({ dataDir, port: 0 }); | |
| 20 | if (!withPull) return app; | |
| 21 | const u = await createUser(app.db, { | |
| 22 | origin: "seed", | |
| 23 | trusted: true, | |
| 24 | username: "alice", | |
| 25 | email: "[email protected]", | |
| 26 | password: "a-good-passphrase", | |
| 27 | adminIfFirst: true, | |
| 28 | }); | |
| 29 | if (!u.ok) throw new Error(u.error); | |
| 30 | const made = await createRepo(app, u.value, { name: "forge", visibility: "public" }); | |
| 31 | if (!made.ok) throw new Error(String(made.error)); | |
| 32 | app.db | |
| 33 | .query( | |
| 34 | `INSERT INTO issue (id, repo_id, number, kind, title, author_id, state) | |
| 35 | VALUES ('i1', ?1, 1, 'pull', 'Shipped', ?2, 'closed')`, | |
| 36 | ) | |
| 37 | .run(made.value.id, u.value.id); | |
| 38 | app.db | |
| 39 | .query( | |
| 40 | `INSERT INTO pull (issue_id, base_branch, head_branch, base_oid, head_oid, merged_at, merged_oid) | |
| 41 | VALUES ('i1', ?1, 'b', 'base', '', '2026-10-01T10:00:00.000Z', '')`, | |
| 42 | ) | |
| 43 | .run(made.value.defaultBranch); | |
| 44 | return app; | |
| 45 | } | |
| 46 | ||
| 47 | beforeAll(async () => { | |
| 48 | busy = await forge(true); | |
| 49 | quiet = await forge(false); | |
| 50 | }, 30_000); | |
| 51 | ||
| 52 | afterAll(async () => { | |
| 53 | busy.close(); | |
| 54 | quiet.close(); | |
| 55 | for (const d of dirs) await rm(d, { recursive: true, force: true }); | |
| 56 | }); | |
| 57 | ||
| 58 | test("a forge asked while another's read is in flight is answered from its own rows", async () => { | |
| 59 | const [a, b] = await Promise.all([shippedAnswer(busy, "all"), shippedAnswer(quiet, "all")]); | |
| 60 | expect(a.live.map((l) => l.title)).toEqual(["Shipped"]); | |
| 61 | expect(b.live).toEqual([]); | |
| 62 | const [c, d] = await Promise.all([shippedAnswer(quiet, "all"), shippedAnswer(busy, "all")]); | |
| 63 | expect(c.live).toEqual([]); | |
| 64 | expect(d.live.length).toBe(1); | |
| 65 | }); |
new above
offline
Correct isolation, but it does not touch the feed-vs-page disagreement the issue reports. Add the fix for that here or in the feed rule, with a test.