Public: anyone can read this; the crew can change it.
Main's full check still runs 40+ minutes after #16613 landed #16623
Check · Review · Land · Live — Its check is running.
mason/forge:mason/16622-main-s-full-check-still-runs-40-minutes → main 6 commits fork
17 files
changed +107
−61
- scripts/unused-exports-allow.json
- src/checks/red_main.ts
- src/checks/revert_red.ts
- src/git/env.ts
- src/spawn/clients.ts
- src/spawn/door.ts
- src/spawn/reach.ts
- src/spawn/suite_defaults.ts
- src/tui/screens/entries.ts
- test/combined-check.test.ts
- test/displays-list.test.ts
- test/forge-link-reissue.test.ts
- test/helpers/preload.ts
- test/palette-entries.test.ts
- test/red-main-line.test.ts
- test/revert-red.test.ts
- test/tui-drift.test.ts
scripts/unused-exports-allow.json +1 −2
| @@ -162,18 +162,17 @@ | ||
| 162 | 162 | "src/snapshot/drill_job.ts markerLeft", |
| 163 | 163 | "src/spawn/births.ts provideHoldForTest", |
| 164 | 164 | "src/spawn/births.ts provideMemoryForTest", |
| 165 | "src/spawn/door.ts useWatchProbeByDefault", | |
| 166 | 165 | "src/spawn/child-apps.ts childRuntime", |
| 167 | 166 | "src/spawn/child_db.ts childDbReaders", |
| 168 | 167 | "src/spawn/clients.ts monthsSettled", |
| 169 | 168 | "src/spawn/clients.ts useChildFetch", |
| 170 | 169 | "src/spawn/door.ts usePlacement", |
| 170 | "src/spawn/door.ts useProbe", | |
| 171 | 171 | "src/spawn/host.ts provideCellsForTest", |
| 172 | 172 | "src/spawn/included_credit.ts worstCaseDailyUsd", |
| 173 | 173 | "src/spawn/parent_credential.ts keepParentCredential", |
| 174 | 174 | "src/spawn/pod.ts renderPod", |
| 175 | 175 | "src/spawn/rate.ts resetAnonSpawns", |
| 176 | "src/spawn/reach.ts useReachByDefault", | |
| 177 | 176 | "src/spawn/usage.ts forgetSelfCpu", |
| 178 | 177 | "src/story/records.ts isKnownRecord", |
| 179 | 178 | "src/story/records.ts parseRecords", |
src/checks/red_main.ts +13 −3
| @@ -34,6 +34,8 @@ export interface RedMain { | ||
| 34 | 34 | readonly branch: string; |
| 35 | 35 | /** The check was stopped by its cell's limit or its budget, not by a test: no pull shares it. */ |
| 36 | 36 | readonly limit: boolean; |
| 37 | /** Every failing file passed when re-run alone: load tripped it, no landing broke it (#16622). */ | |
| 38 | readonly flaky: boolean; | |
| 37 | 39 | readonly since: string; |
| 38 | 40 | } |
| 39 | 41 | |
| @@ -93,10 +95,17 @@ const LIMIT = /^(?:check failed: )?(?:stopped: |budget:|check stalled:|the forge | ||
| 93 | 95 | function toRed(row: Row): RedMain | undefined { |
| 94 | 96 | if (row.state !== "failed") return undefined; |
| 95 | 97 | let failing: string[] = []; |
| 98 | let flaky = false; | |
| 96 | 99 | try { |
| 97 | const detail = row.check_detail ? (JSON.parse(row.check_detail) as { names?: unknown }) : {}; | |
| 98 | if (Array.isArray(detail.names)) | |
| 99 | failing = detail.names.filter((n): n is string => typeof n === "string"); | |
| 100 | const detail = row.check_detail | |
| 101 | ? (JSON.parse(row.check_detail) as { names?: unknown; files?: unknown; flakyUnderLoad?: unknown }) | |
| 102 | : {}; | |
| 103 | const strings = (v: unknown): string[] => | |
| 104 | Array.isArray(v) ? v.filter((n): n is string => typeof n === "string") : []; | |
| 105 | failing = strings(detail.names); | |
| 106 | const files = strings(detail.files); | |
| 107 | const green = strings(detail.flakyUnderLoad); | |
| 108 | flaky = files.length > 0 && files.every((f) => green.includes(f)); | |
| 100 | 109 | } catch { |
| 101 | 110 | failing = []; |
| 102 | 111 | } |
| @@ -109,6 +118,7 @@ function toRed(row: Row): RedMain | undefined { | ||
| 109 | 118 | summary: row.summary, |
| 110 | 119 | branch: row.branch, |
| 111 | 120 | limit: LIMIT.test(row.summary), |
| 121 | flaky, | |
| 112 | 122 | since: row.finished_at ?? row.created_at, |
| 113 | 123 | }; |
| 114 | 124 | } |
src/checks/revert_red.ts +3 −2
| @@ -5,7 +5,8 @@ | ||
| 5 | 5 | * for the pull it takes back and naming the failing test. It is only ever |
| 6 | 6 | * proposed — a person lands it. A red that spans more than one landing (or a |
| 7 | 7 | * push no pull carried) is the alarm's, not this module's, and a landing |
| 8 | * already reverted, open or shipped or closed, is never proposed twice. | |
| 8 | * already reverted, open or shipped or closed, is never proposed twice. A red | |
| 9 | * the machine caused (a limit, a stall, or files that pass alone) proposes none. | |
| 9 | 10 | */ |
| 10 | 11 | |
| 11 | 12 | import type { App } from "../app.ts"; |
| @@ -88,7 +89,7 @@ export async function proposeRevert(app: App, repoId: string): Promise<Pull | un | ||
| 88 | 89 | working.add(repoId); |
| 89 | 90 | try { |
| 90 | 91 | const red = redMain(app.db, repoId); |
| 91 | if (red === undefined || red.limit || manifestError(red) !== undefined) return undefined; | |
| 92 | if (red === undefined || red.limit || red.flaky || manifestError(red) !== undefined) return undefined; | |
| 92 | 93 | const green = greenBefore(app, repoId, red.branch, red.runId); |
| 93 | 94 | if (green === undefined) return undefined; |
| 94 | 95 | const landed = await soleLanding(app, red, green); |
src/git/env.ts +7 −4
| @@ -368,6 +368,12 @@ export async function runGitRaw( | ||
| 368 | 368 | // Timed from before the gate: a wait for a permit is the queue #8158 names. |
| 369 | 369 | const start = performance.now(); |
| 370 | 370 | return gitGate.runUnless(options.signal, async () => { |
| 371 | // No time at all never starts a git: killing one right after its spawn | |
| 372 | // loses the race when the machine is loaded and a small git is already done. | |
| 373 | if ((options.timeoutMs ?? 30_000) <= 0) { | |
| 374 | noteGit(gitRecord, args, start); | |
| 375 | return err({ code: 137, stderr: "", args }); | |
| 376 | } | |
| 371 | 377 | let proc: Bun.Subprocess<"pipe" | "ignore", "pipe", "pipe">; |
| 372 | 378 | try { |
| 373 | 379 | proc = Bun.spawn(["git", ...args], { |
| @@ -388,10 +394,7 @@ export async function runGitRaw( | ||
| 388 | 394 | const timer = setTimeout(() => proc.kill("SIGKILL"), timeoutMs); |
| 389 | 395 | const stop = () => proc.kill("SIGKILL"); |
| 390 | 396 | let over = false; |
| 391 | // No time at all is killed now, not on the next turn of the event loop: a | |
| 392 | // timer of 0 fires only once the loop is free, and a busy one lets a small | |
| 393 | // git finish first and succeed past its deadline. | |
| 394 | if (options.signal?.aborted || timeoutMs <= 0) stop(); | |
| 397 | if (options.signal?.aborted) stop(); | |
| 395 | 398 | options.signal?.addEventListener("abort", stop, { once: true }); |
| 396 | 399 | try { |
| 397 | 400 | const [stdout, stderr, code] = await Promise.all([ |
src/spawn/clients.ts +2 −1
| @@ -39,6 +39,7 @@ import { billTo, personReading } from "./person_activity.ts"; | ||
| 39 | 39 | import { archiveProposal, type ArchiveProposal } from "./archive_proposal.ts"; |
| 40 | 40 | import { appLinkLines, type AppLinkLine } from "./app_links.ts"; |
| 41 | 41 | import { madeFromOf, type MadeFrom } from "./template_record.ts"; |
| 42 | import { servedWindow } from "./suite_defaults.ts"; | |
| 42 | 43 | import { NO_KEY_HELD, NO_KEY_HOST_LINE } from "../crew/no_key.ts"; |
| 43 | 44 | |
| 44 | 45 | /** What a spawned forge says about itself to anyone: nothing more. */ |
| @@ -580,7 +581,7 @@ const building = new WeakMap<App, Promise<ClientRow[]>>(); | ||
| 580 | 581 | * (the suite's setting) a read waits for a fresh one: a test changes a forge and reads the list at |
| 581 | 582 | * once. |
| 582 | 583 | */ |
| 583 | export const servedWindow = { ms: 15_000 }; | |
| 584 | export { servedWindow }; | |
| 584 | 585 | |
| 585 | 586 | /** |
| 586 | 587 | * Read every row now, off the request: what `servedRows` answers from. One at a time; a caller |
src/spawn/door.ts +2 −11
| @@ -12,6 +12,7 @@ import { contributeAnswer, wantsToContribute } from "./contribute_words.ts"; | ||
| 12 | 12 | import { nameShapeVerdict } from "./name_verdict.ts"; |
| 13 | 13 | import { linkRequestVisitor } from "../perf/visitor_link.ts"; |
| 14 | 14 | import { templateOfInput } from "../actions/template_timing.ts"; |
| 15 | import { watchProbeDefault } from "./suite_defaults.ts"; | |
| 15 | 16 | import { startWatch, probeOf, type Probe } from "./live.ts"; |
| 16 | 17 | import { firstProof, homeBudgetOf, proves, reachWords, settleChild, type ChildReach } from "./reach.ts"; |
| 17 | 18 | import { |
| @@ -92,16 +93,6 @@ export function probeFor(app: App, url: string, timeoutMs: number): Probe { | ||
| 92 | 93 | return swapped ? swapped(url) : probeOf(url, timeoutMs); |
| 93 | 94 | } |
| 94 | 95 | |
| 95 | let watchProbe: (url: string) => Probe = probeOf; | |
| 96 | /** | |
| 97 | * Tests: how a new child is asked whether it is live, for every forge, unless `useProbe` gave one. | |
| 98 | * The suite's children answer nowhere, so each would keep its place among the births for the whole | |
| 99 | * cap; `test/helpers/preload.ts` has them answer at once. | |
| 100 | */ | |
| 101 | export function useWatchProbeByDefault(probe: ((url: string) => Probe) | undefined): void { | |
| 102 | watchProbe = probe ?? probeOf; | |
| 103 | } | |
| 104 | ||
| 105 | 96 | /** Tests swap how a new child is asked whether it is live. */ |
| 106 | 97 | export function useProbe(app: App, probe: (url: string) => Probe): void { |
| 107 | 98 | probes.set(app, probe); |
| @@ -587,7 +578,7 @@ export async function spawnDoor( | ||
| 587 | 578 | let watching = false; |
| 588 | 579 | try { |
| 589 | 580 | up = bootHostedChild(ctx.app, made.value.name); |
| 590 | watching = startWatch(ctx.app, { name: made.value.name, startedAt, ...templateOfInput(raw["template"]), probe: (probes.get(ctx.app) ?? watchProbe)(made.value.url), onSettled: place.release }); | |
| 581 | watching = startWatch(ctx.app, { name: made.value.name, startedAt, ...templateOfInput(raw["template"]), probe: (probes.get(ctx.app) ?? watchProbeDefault.probe ?? probeOf)(made.value.url), onSettled: place.release }); | |
| 591 | 582 | } finally { |
| 592 | 583 | if (!watching) place.release(); |
| 593 | 584 | } |
src/spawn/reach.ts +2 −8
| @@ -30,6 +30,7 @@ import { uncleanInFirstMinutes } from "../kernel/boots.ts"; | ||
| 30 | 30 | import { lastStop, stoppedMark } from "./stopped.ts"; |
| 31 | 31 | import { readRecord } from "./cell_record.ts"; |
| 32 | 32 | import { during } from "../perf/jobs.ts"; |
| 33 | import { reachDefault } from "./suite_defaults.ts"; | |
| 33 | 34 | |
| 34 | 35 | export const APP_HEADER = "x-forge-app"; |
| 35 | 36 | |
| @@ -102,14 +103,7 @@ export function useReach(app: App, o: Options): void { | ||
| 102 | 103 | options.set(app, o); |
| 103 | 104 | } |
| 104 | 105 | |
| 105 | let fallback: Options = {}; | |
| 106 | ||
| 107 | /** What every app without its own `useReach` does; the test preload turns proving off. */ | |
| 108 | export function useReachByDefault(o: Options): void { | |
| 109 | fallback = o; | |
| 110 | } | |
| 111 | ||
| 112 | const optionsOf = (app: App): Options => options.get(app) ?? fallback; | |
| 106 | const optionsOf = (app: App): Options => options.get(app) ?? reachDefault; | |
| 113 | 107 | /** The most a spawn holds its reply for the new forge to come up and answer. */ |
| 114 | 108 | export const homeBudgetOf = (app: App): number => optionsOf(app).homeWaitMs ?? HOME_WAIT_MS; |
| 115 | 109 | const off = (app: App): boolean => optionsOf(app).fetch === undefined && optionsOf(app).off === true; |
src/spawn/suite_defaults.ts added +23
| @@ -0,0 +1,23 @@ | ||
| 1 | /** | |
| 2 | * What the test suite sets for every forge before any test file loads (`test/helpers/preload.ts`). | |
| 3 | * Plain state with no imports of the spawn modules that read it: the preload touches only this | |
| 4 | * file, so a test file that never reaches the spawn door does not pay to load it (#16622). | |
| 5 | */ | |
| 6 | ||
| 7 | import type { Probe } from "./live.ts"; | |
| 8 | ||
| 9 | /** How long a served list of children stays fresh; see `servedWindow` in `clients.ts`. */ | |
| 10 | export const servedWindow = { ms: 15_000 }; | |
| 11 | ||
| 12 | /** What every app without its own `useReach` does; see `useReachByDefault` in `reach.ts`. */ | |
| 13 | export const reachDefault: { | |
| 14 | off?: boolean; | |
| 15 | fetch?: (url: string, init?: RequestInit) => Promise<Response>; | |
| 16 | settleMs?: number; | |
| 17 | homeWaitMs?: number; | |
| 18 | pollMs?: number; | |
| 19 | confirmMs?: number; | |
| 20 | } = {}; | |
| 21 | ||
| 22 | /** How a new child is asked whether it is live, when set; see `door.ts`. */ | |
| 23 | export const watchProbeDefault: { probe?: (url: string) => Probe } = {}; |
src/tui/screens/entries.ts +16 −8
| @@ -47,20 +47,28 @@ export function entryFiles(dir: string = import.meta.dir): [string, string[]][] | ||
| 47 | 47 | }); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | /** Every entry the files declare, by rank, then file name, then export name. */ | |
| 51 | export const ENTRIES: readonly PaletteEntry[] = entryFiles() | |
| 52 | .flatMap(([f, names]) => { | |
| 53 | const mod = require(join(import.meta.dir, f)) as Record<string, PaletteEntry>; | |
| 54 | return [...names].sort().map((k) => mod[k]!); | |
| 55 | }) | |
| 56 | .sort((a, b) => a.rank - b.rank); | |
| 50 | let entries: readonly PaletteEntry[] | undefined; | |
| 51 | ||
| 52 | /** | |
| 53 | * Every entry the files declare, by rank, then file name, then export name. Read on first use, not | |
| 54 | * at load: the screen files import modules that may still be loading when this one is. | |
| 55 | */ | |
| 56 | export function allEntries(): readonly PaletteEntry[] { | |
| 57 | entries ??= entryFiles() | |
| 58 | .flatMap(([f, names]) => { | |
| 59 | const mod = require(join(import.meta.dir, f)) as Record<string, PaletteEntry>; | |
| 60 | return [...names].sort().map((k) => mod[k]!); | |
| 61 | }) | |
| 62 | .sort((a, b) => a.rank - b.rank); | |
| 63 | return entries; | |
| 64 | } | |
| 57 | 65 | |
| 58 | 66 | /** |
| 59 | 67 | * Put each entry the session is offered into `commands`, after the command it names or at the end. |
| 60 | 68 | */ |
| 61 | 69 | export function addEntries(commands: Command[], session: Session, ctx: Ctx): void { |
| 62 | 70 | const placed = new Map<string, number>(); |
| 63 | for (const e of ENTRIES) { | |
| 71 | for (const e of allEntries()) { | |
| 64 | 72 | if (!e.offered(session)) continue; |
| 65 | 73 | const command: Command = { id: e.id, title: e.title, hint: e.hint, run: () => e.run(session, ctx) }; |
| 66 | 74 | const anchor = e.after?.find((id) => commands.some((c) => c.id === id)); |
test/combined-check.test.ts +2 −2
| @@ -225,7 +225,7 @@ describe("a kept fork's pull is checked on its combined commit (#9932)", () => { | ||
| 225 | 225 | await git(["push", "origin", "main"], b); |
| 226 | 226 | const head = await git(["rev-parse", "HEAD"], b); |
| 227 | 227 | let combined = await readCombined(bare, number, head); |
| 228 | for (let i = 0; i < 200 && combined?.baseOid !== builtOn; i++) { | |
| 228 | for (let i = 0; i < 600 && combined?.baseOid !== builtOn; i++) { | |
| 229 | 229 | await Bun.sleep(50); |
| 230 | 230 | combined = await readCombined(bare, number, head); |
| 231 | 231 | } |
| @@ -246,5 +246,5 @@ describe("a kept fork's pull is checked on its combined commit (#9932)", () => { | ||
| 246 | 246 | expect(run.log).toContain(`fast base ${builtOn}`); |
| 247 | 247 | expect(run.log).toContain("changed bob2.txt"); |
| 248 | 248 | expect(run.log).not.toContain("changed late.txt"); |
| 249 | }, 60_000); | |
| 249 | }, 120_000); | |
| 250 | 250 | }); |
test/displays-list.test.ts +2 −2
| @@ -21,7 +21,7 @@ import { serve, type Servers } from "../src/http/server.ts"; | ||
| 21 | 21 | import { createForgeApp } from "../src/tui/forge.ts"; |
| 22 | 22 | import { DISPLAYS_SENTENCE } from "../src/display/known.ts"; |
| 23 | 23 | import { entry as displaysEntry, displaysScreen } from "../src/tui/screens/displays.ts"; |
| 24 | import { ENTRIES } from "../src/tui/screens/entries.ts"; | |
| 24 | import { allEntries } from "../src/tui/screens/entries.ts"; | |
| 25 | 25 | import { headlessTerminal } from "../src/tui/term/terminal.ts"; |
| 26 | 26 | import { settleApp } from "./helpers/tui.ts"; |
| 27 | 27 | import { statements } from "./helpers/statements.ts"; |
| @@ -198,7 +198,7 @@ describe("the displays list, page and terminal screen", () => { | ||
| 198 | 198 | expect(mine).toContain("display.json is invalid"); |
| 199 | 199 | expect(mine).toContain("alice/hidden"); |
| 200 | 200 | expect(await screenText(bob)).not.toContain("alice/hidden"); |
| 201 | expect(ENTRIES).toContain(displaysEntry); | |
| 201 | expect(allEntries()).toContain(displaysEntry); | |
| 202 | 202 | }); |
| 203 | 203 | |
| 204 | 204 | test("a stranger is sent to sign in", async () => { |
test/forge-link-reissue.test.ts +5 −2
| @@ -154,8 +154,11 @@ describe("sending a forge's link again", () => { | ||
| 154 | 154 | expect((await claim(before)).status).not.toBe(404); |
| 155 | 155 | k("enter"); |
| 156 | 156 | await settleApp(app); |
| 157 | await Bun.sleep(200); // real-timer: the terminal app settles on its own render loop | |
| 158 | await settleApp(app); | |
| 157 | // The terminal app settles on its own render loop: look until the link shows, not a fixed wait. | |
| 158 | for (let i = 0; i < 100 && !app.screen.toText().includes("/claim#"); i++) { | |
| 159 | await Bun.sleep(10); | |
| 160 | await settleApp(app); | |
| 161 | } | |
| 159 | 162 | expect(app.screen.toText()).toContain("/claim#"); |
| 160 | 163 | expect((await claim(before)).status).toBe(410); |
| 161 | 164 | }); |
test/helpers/preload.ts +3 −5
| @@ -7,8 +7,7 @@ import "../../src/kernel/bun_guard.ts"; | ||
| 7 | 7 | import { provideCpusForTest } from "../../src/core/capacity.ts"; |
| 8 | 8 | import { provideMirrorOutboundForTest } from "../../src/origins/git-mirror.ts"; |
| 9 | 9 | import { installCheapHash } from "./cheap-hash.ts"; |
| 10 | import { useReachByDefault } from "../../src/spawn/reach.ts"; | |
| 11 | import { servedWindow } from "../../src/spawn/clients.ts"; | |
| 10 | import { reachDefault, servedWindow, watchProbeDefault } from "../../src/spawn/suite_defaults.ts"; | |
| 12 | 11 | import "./roomy-disk.ts"; |
| 13 | 12 | import { provideEmptyImagesForTest } from "../../src/kernel/db.ts"; |
| 14 | 13 | import { emptyImagesIn } from "./empty-images.ts"; |
| @@ -31,7 +30,7 @@ provideEmptyImagesForTest(emptyImagesIn(join(SCRATCH_ROOT, "empty-db"))); | ||
| 31 | 30 | process.env.FORGE_DEV = "1"; |
| 32 | 31 | |
| 33 | 32 | // A suite has no public network to prove a child through (`spawn/reach.ts`); a test of reach injects its own fetch. |
| 34 | useReachByDefault({ off: true }); | |
| 33 | reachDefault.off = true; | |
| 35 | 34 | |
| 36 | 35 | // The /forges list is served from memory in production; a test reads what it just changed (`spawn/clients.ts`). |
| 37 | 36 | servedWindow.ms = 0; |
| @@ -57,5 +56,4 @@ const { provideMemoryForTest } = await import("../../src/spawn/births.ts"); | ||
| 57 | 56 | provideMemoryForTest(() => 64 * 1024 ** 3); |
| 58 | 57 | |
| 59 | 58 | // A new child of the suite answers its first look, so its place among the births is given back. |
| 60 | const { useWatchProbeByDefault } = await import("../../src/spawn/door.ts"); | |
| 61 | useWatchProbeByDefault(() => async () => true); | |
| 59 | watchProbeDefault.probe = () => async () => true; |
test/palette-entries.test.ts +6 −6
| @@ -1,6 +1,6 @@ | ||
| 1 | 1 | import { expect, test } from "bun:test"; |
| 2 | 2 | import type { Command } from "../src/tui/app/palette.ts"; |
| 3 | import { addEntries, ENTRIES, entryFiles, type PaletteEntry } from "../src/tui/screens/entries.ts"; | |
| 3 | import { addEntries, allEntries, entryFiles, type PaletteEntry } from "../src/tui/screens/entries.ts"; | |
| 4 | 4 | import { mkdtempSync, writeFileSync, rmSync } from "node:fs"; |
| 5 | 5 | import { tmpdir } from "node:os"; |
| 6 | 6 | import { join } from "node:path"; |
| @@ -10,12 +10,12 @@ const stub = (id: string, after?: string[], rank = 0): PaletteEntry => ({ | ||
| 10 | 10 | id, rank, title: id, hint: "", ...(after ? { after } : {}), offered: () => true, run: () => undefined, |
| 11 | 11 | }); |
| 12 | 12 | const place = (commands: Command[], entries: PaletteEntry[]): string[] => { |
| 13 | const saved = [...ENTRIES]; | |
| 14 | (ENTRIES as PaletteEntry[]).splice(0, ENTRIES.length, ...entries); | |
| 13 | const saved = [...allEntries()]; | |
| 14 | (allEntries() as PaletteEntry[]).splice(0, allEntries().length, ...entries); | |
| 15 | 15 | try { |
| 16 | 16 | addEntries(commands, {} as never, {} as never); |
| 17 | 17 | } finally { |
| 18 | (ENTRIES as PaletteEntry[]).splice(0, ENTRIES.length, ...saved); | |
| 18 | (allEntries() as PaletteEntry[]).splice(0, allEntries().length, ...saved); | |
| 19 | 19 | } |
| 20 | 20 | return commands.map((c) => c.id); |
| 21 | 21 | }; |
| @@ -40,7 +40,7 @@ test("an entry the session is not offered is left out", () => { | ||
| 40 | 40 | // The roster is built from the directory, not listed: these are known to be in it, including the |
| 41 | 41 | // entries a file exports under another name than `entry`, in the order the palette has always had. |
| 42 | 42 | test("the palette roster holds the known entries in their pinned order", () => { |
| 43 | const ids = ENTRIES.map((e) => e.id); | |
| 43 | const ids = allEntries().map((e) => e.id); | |
| 44 | 44 | expect(ids.length).toBeGreaterThan(100); |
| 45 | 45 | const known = ["bills", "payments", "sentinel", "boards", "drift", "model-grant", "model-ceiling", "claim-start", "claim-link", "recovery-link", "new-issue-anywhere"]; |
| 46 | 46 | expect(ids.filter((id) => known.includes(id))).toEqual(known.filter((id) => ids.includes(id))); |
| @@ -55,7 +55,7 @@ test("entries sort by rank, then by file name", () => { | ||
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | 57 | test("no two entries share an id", () => { |
| 58 | const ids = ENTRIES.map((e) => e.id); | |
| 58 | const ids = allEntries().map((e) => e.id); | |
| 59 | 59 | expect(new Set(ids).size).toBe(ids.length); |
| 60 | 60 | }); |
| 61 | 61 |
test/red-main-line.test.ts +1 −1
| @@ -4,7 +4,7 @@ import { mainLineFor, redMainLine, redOnMain } from "../src/checks/red_main_line | ||
| 4 | 4 | |
| 5 | 5 | const red = (over: Partial<RedMain> = {}): RedMain => ({ |
| 6 | 6 | repoId: "r", repo: "a/forge", runId: "x", commitOid: "abcdef0123456789", failing: ["sizes hold"], |
| 7 | summary: "check failed: 1 failed", branch: "main", limit: false, since: "2026-11-16T00:00:00Z", ...over, | |
| 7 | summary: "check failed: 1 failed", branch: "main", limit: false, flaky: false, since: "2026-11-16T00:00:00Z", ...over, | |
| 8 | 8 | }); |
| 9 | 9 | const failed = (names: string[]) => ({ state: "failed" as const, checkDetail: { passed: 1, failed: names.length, names } }); |
| 10 | 10 |
test/revert-red.test.ts +17 −2
| @@ -42,7 +42,12 @@ describe("a red main after one landing proposes its revert", () => { | ||
| 42 | 42 | return getPull(app.db, repo.id, opened.value.number)!; |
| 43 | 43 | }; |
| 44 | 44 | |
| 45 | const mainCheck = async (state: "ok" | "failed", names: string[] = [], summary?: string): Promise<void> => { | |
| 45 | const mainCheck = async ( | |
| 46 | state: "ok" | "failed", | |
| 47 | names: string[] = [], | |
| 48 | summary?: string, | |
| 49 | detail: object = {}, | |
| 50 | ): Promise<void> => { | |
| 46 | 51 | const oid = await resolveOid(repoDir(app.reposRoot, repo.ownerName, repo.name), "refs/heads/main"); |
| 47 | 52 | const run = createRun(app.db, { repoId: repo.id, kind: "check", env: "main", commitOid: oid ?? "" }); |
| 48 | 53 | app.db |
| @@ -51,7 +56,7 @@ describe("a red main after one landing proposes its revert", () => { | ||
| 51 | 56 | run.id, |
| 52 | 57 | state, |
| 53 | 58 | summary ?? (state === "ok" ? "check passed in 1s" : "check failed: 1 test failed"), |
| 54 | state === "ok" ? "" : JSON.stringify({ names }), | |
| 59 | state === "ok" ? "" : JSON.stringify({ names, ...detail }), | |
| 55 | 60 | new Date().toISOString(), |
| 56 | 61 | ); |
| 57 | 62 | }; |
| @@ -128,6 +133,16 @@ describe("a red main after one landing proposes its revert", () => { | ||
| 128 | 133 | expect(reverts()).toHaveLength(0); |
| 129 | 134 | }); |
| 130 | 135 | |
| 136 | test("a red whose every failing file passes alone opens none (#16622)", async () => { | |
| 137 | await mainCheck("ok"); | |
| 138 | await land("loaded", "load\n"); | |
| 139 | await mainCheck("failed", ["t"], undefined, { files: ["test/a.test.ts"], flakyUnderLoad: ["test/a.test.ts"] }); | |
| 140 | expect(await proposeRevert(app, repo.id)).toBeUndefined(); | |
| 141 | // one file red alone besides: that one is a test's failure, and the landing is proposed | |
| 142 | await mainCheck("failed", ["t"], undefined, { files: ["test/a.test.ts", "test/b.test.ts"], flakyUnderLoad: ["test/a.test.ts"] }); | |
| 143 | expect(await proposeRevert(app, repo.id)).toBeDefined(); | |
| 144 | }); | |
| 145 | ||
| 131 | 146 | test("a green main opens none", async () => { |
| 132 | 147 | await mainCheck("ok"); |
| 133 | 148 | await land("one", "beta\n"); |
test/tui-drift.test.ts +2 −2
| @@ -10,7 +10,7 @@ import { createApp, type App } from "../src/app.ts"; | ||
| 10 | 10 | import { createUser, type User } from "../src/core/users.ts"; |
| 11 | 11 | import type { Repo } from "../src/core/repos.ts"; |
| 12 | 12 | import { createForgeApp } from "../src/tui/forge.ts"; |
| 13 | import { ENTRIES } from "../src/tui/screens/entries.ts"; | |
| 13 | import { allEntries } from "../src/tui/screens/entries.ts"; | |
| 14 | 14 | import { askUpdate, driftRows, driftScreen, entry } from "../src/tui/screens/drift.ts"; |
| 15 | 15 | import { headlessTerminal } from "../src/tui/term/terminal.ts"; |
| 16 | 16 | import { quietLogs } from "./helpers/globals.ts"; |
| @@ -49,7 +49,7 @@ afterAll(async () => { | ||
| 49 | 49 | }); |
| 50 | 50 | |
| 51 | 51 | test("the entry is in the palette list and offered to a person admin alone", () => { |
| 52 | expect(ENTRIES).toContain(entry); | |
| 52 | expect(allEntries()).toContain(entry); | |
| 53 | 53 | const a = open(alice); |
| 54 | 54 | const b = open(bob); |
| 55 | 55 | expect(entry.offered(a.session)).toBe(true); |
new above
offline