Files
mesh-catalog/modules/gitea/test/no-ready-mark.test.ts
T
jschoubben 668444785d Ask the Approve as soon as the checks pass, with no ready mark (issue 1022)
The review finishes before the push and its record is a Reviewed-by line in the
description, so the mark repeated what the push meant. mesh-delivery asks the
operator when a pull request's checks pass, keeps an ask through a trunk move
by asking the check again at once, and hands the merge tool the approved heads,
which replace the forge review of each sibling.
2026-10-17 20:44:54 +02:00

32 lines
1.5 KiB
TypeScript

import { test } from "node:test";
import assert from "node:assert/strict";
import { readdirSync, readFileSync, statSync } from "node:fs";
import { join } from "node:path";
// **No ready mark is left in the forge module** (novox/hq ADR 0421 §4, issue 1022; how it is checked): no label, comment
// reading, trusted setting, file or merge rule of the mark stands in any of its sources, its manifest or its files. Tests
// are left out: they name the words to prove them gone.
const root = new URL("..", import.meta.url).pathname;
const FORBIDDEN = ["mesh/ready", "ready at", "ready-authors", "READY_AUTHORS", "readyAuthors", "readyMarkOf", "READY_LABEL", "approvedAt("];
function sources(dir: string): string[] {
const out: string[] = [];
for (const name of readdirSync(dir)) {
if (name === "node_modules" || name === "dist" || name === "test") continue;
const path = join(dir, name);
if (statSync(path).isDirectory()) out.push(...sources(path));
else if (/\.(ts|json|go)$/.test(name) || !name.includes(".")) out.push(path);
}
return out;
}
test("no ready mark, trusted ready-authors setting or approval-by-mark rule is left in the module", () => {
const found: string[] = [];
for (const file of sources(root)) {
if (/package-lock|go\.sum/.test(file)) continue;
const text = readFileSync(file, "utf8");
for (const word of FORBIDDEN) if (text.includes(word)) found.push(`${file.slice(root.length)} holds "${word}"`);
}
assert.deepEqual(found, [], "the ready mark is gone (ADR 0421 §4)");
});