/** * No check runs twice on the same tree. * * Measured 29 Sep 2026 (the coordinator's analysis): every push to main ran * `checks.yml` again (to warm a turbo cache the train had already warmed — * TURBO_CACHE_DIR is shared on the host) and `rust-deep.yml` (a check of a * tree that had already landed, so a red one found main broken rather than * stopping it). The owner's target is 5x more landings an hour with no loss of * quality, so the repeats go and the deep pass moves BEFORE the landing: onto * every merge queue train, in `rust-lint`, beside `rust`. */ import { readFileSync } from "node:fs"; import path from "node:path"; import { parse as parseYaml } from "yaml"; import { describe, expect, it } from "vitest"; const ROOT = path.resolve(__dirname, "../.."); type Step = { name?: string; run?: string; env?: Record; if?: string }; type Workflow = { on: Record; jobs: Record }; const read = (file: string) => parseYaml(readFileSync(path.join(ROOT, ".forgejo/workflows", file), "utf8")) as Workflow; const deep = read("rust-deep.yml"); /** The `"label::command"` phases a step hands `cargo-phases.sh`, in order. */ const phases = (run: string | undefined) => [...(run ?? "").matchAll(/"((?:rust-lint|deep): [^"]+::[^"]+)"/g)].map((m) => m[1]); describe("a push to main re-runs no check the train already ran", () => { // RULE: rust-deep.yml does not run on a push to main — its phases run on the train; the nightly and a dispatch remain. it("rust-deep runs nightly and on dispatch only", () => { expect(Object.keys(deep.on).sort()).toEqual(["schedule", "workflow_dispatch"]); }); });