Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

fix(docs-check): catch the retired branch naming in both spellings

Etienne Lescot8cf444b3054c
diff --git a/scripts/check-docs.mjs b/scripts/check-docs.mjs
index 2fb5bb930..fc798edb2 100644
--- a/scripts/check-docs.mjs
+++ b/scripts/check-docs.mjs
@@ -41,12 +41,20 @@ const LEGACY = [
"provider-parity-plan",
"github-actions-workflows",
"ux-ui-spec",
- // Pre-#90 release-branch naming. One branch per *stable* version now
- // (`release/vX.Y.Z`), created at rc.1 and reused, because prerelease.yml and
- // promote.yml have to resolve the same ref. Docs that reintroduce the
- // suffixed name send a maintainer to a branch that was never created.
- "release/vX.Y.Z-rc.N",
];
+
+// Pre-#90 release-branch naming. One branch per *stable* version now
+// (`release/vX.Y.Z`), created at rc.1 and reused, because prerelease.yml and
+// promote.yml have to resolve the same ref; a doc that reintroduces the
+// suffixed name sends a maintainer to a branch nothing ever creates.
+//
+// A LEGACY substring entry is not enough here: the rot used BOTH spellings, and
+// the one that mattered was the concrete `release/v1.5.0-rc.1` sitting in a
+// copy-pasteable shell block, not the `release/vX.Y.Z-rc.N` placeholder in the
+// prose. Someone restoring that block from git history would have passed the
+// lint. Matches the branch form only — the RC *tags* (`v1.6.0-rc.1`, no
+// `release/` prefix) are current and appear in the v1.6.0 postmortem.
+const RETIRED_BRANCH = /release\/v(?:X\.Y\.Z|\d+\.\d+\.\d+)-(?:rc|beta|alpha)\.(?:N|\d+)/g;
const LEGACY_ALLOWED = new Set(["technical-documentation/architecture/decisions.md"]);
const REQUIRED = [
@@ -139,6 +147,10 @@ for (const file of files) {
for (const name of LEGACY) {
if (text.includes(name)) errors.push(`${rel}: mentions removed "${name}"`);
}
+
+ for (const [match] of text.matchAll(RETIRED_BRANCH)) {
+ errors.push(`${rel}: retired release-branch naming "${match}" (it is release/vX.Y.Z)`);
+ }
}
if (errors.length) {
diff --git a/scripts/check-docs.test.mjs b/scripts/check-docs.test.mjs
index 30fba4321..9227c691c 100644
--- a/scripts/check-docs.test.mjs
+++ b/scripts/check-docs.test.mjs
@@ -39,16 +39,43 @@ describe("check-docs", () => {
expect(code).toBe(0);
});
- it("rejects the retired release-branch naming inside .harness/", () => {
- // .harness/ specifically: technical-documentation/ was never the tree that
- // went stale, so planting there would pass even if the walk lost .harness/.
+ // Both spellings, because the rot used both and the first version of this
+ // guard only caught one. The prose said `release/vX.Y.Z-rc.N`, but the
+ // copy-pasteable shell block said `release/v1.5.0-rc.1` — and that block is
+ // what an operator restores from git history when the dispatch UI is down.
+ // A substring check on the placeholder waves the concrete one straight
+ // through, which is the more dangerous of the two.
+ for (const naming of ["release/vX.Y.Z-rc.N", "release/v1.5.0-rc.1"]) {
+ it(`rejects the retired release-branch naming "${naming}" inside .harness/`, () => {
+ // .harness/ specifically: technical-documentation/ was never the tree that
+ // went stale, so planting there would pass even if the walk lost .harness/.
+ const probe = path.join(ROOT, ".harness", "docs", "_check-docs-probe.md");
+ writeFileSync(probe, `# probe\n\n\`\`\`bash\ngit checkout ${naming}\n\`\`\`\n`);
+ try {
+ const { code, out } = run();
+ expect(out).toContain("_check-docs-probe.md");
+ expect(out).toContain(naming);
+ expect(code).toBe(1);
+ } finally {
+ rmSync(probe, { force: true });
+ }
+ });
+ }
+
+ // A guard that over-fires gets switched off, so pin what must NOT trip it:
+ // RC *tags* carry the `-rc.N` suffix and are current, the stable release
+ // branch and its ephemeral sync branch are current, and backport lines use
+ // `release/1.4.x`.
+ it("accepts the naming that is still current", () => {
const probe = path.join(ROOT, ".harness", "docs", "_check-docs-probe.md");
- writeFileSync(probe, "# probe\n\nCut from `release/vX.Y.Z-rc.N`.\n");
+ writeFileSync(
+ probe,
+ "# probe\n\nTag `v1.6.0-rc.1` on `release/v1.6.0`, synced via `release/v1.6.0-sync`; backports on `release/1.4.x`.\n",
+ );
try {
const { code, out } = run();
- expect(out).toContain("_check-docs-probe.md");
- expect(out).toContain("release/vX.Y.Z-rc.N");
- expect(code).toBe(1);
+ expect(out).toContain("check-docs: OK");
+ expect(code).toBe(0);
} finally {
rmSync(probe, { force: true });
}