test: prune redundant and implementation-coupled coverage

This commit is contained in:
morluto committed 2026-11-17 18:48:24 -05:00
1 parent 14b15ba8a5
commit 48e27e19b7
191 files changed
+2757 -5418

No files matched your search

+1 -1
View File
@@ -948,7 +948,7 @@ checkCounted(
// `find` on a parsed section, program-header or load-command table silently
// keeps the first of repeated declarations. Select keyed entries through
// src/domain/keyedCollection (`uniqueKeyed`, `allKeyed`, or
// `firstKeyed`/`lastKeyed` with the format's precedence rule); an
// `firstKeyed` with the format's precedence rule); an
// address-containment test that selects nothing uses `some`. GuidanceAccess
// looks up a guidance document's heading section by its locator identity,
// not a parsed binary section table.
+1 -19
View File
@@ -1,29 +1,11 @@
/** Relative path of the registry. Its text is a declaration, not a producer. */
export const NUMERIC_LIMIT_DECLARATION: "src/domain/numericLimitRegistry.ts";
/** Roots scanned for the removed restart-field names. */
export const FORBIDDEN_FIELD_SCAN_ROOTS: readonly string[];
/** File extensions, without the dot, scanned under those roots. */
export const FORBIDDEN_FIELD_SCAN_EXTENSIONS: readonly string[];
/** True for a numeric `REA_` limit, including the documented endpoint-candidate count. */
export function isNumericLimit(name: string): boolean;
/** Statically declared environment seeds owned by ANALYSIS_SETTINGS. */
export function parseRuntimeSettingEnvironments(source: string): Set<string>;
/** Detect stale or newly introduced temporary per-call exceptions. */
export function perCallLimitFailures(
listed: ReadonlyMap<string, string>,
temporary: ReadonlySet<string>,
): string[];
/** Parse static registry declarations, including external-reader provenance. */
export function parseNumericLimitRegistry(source: string): Array<{
name: string;
update_mode: "restart";
policy: "restart-only" | "per-call";
policy: "restart-only";
read: "startup" | "per-call" | "construction";
reason: string;
provenance?: {
+9 -96
View File
@@ -6,14 +6,15 @@ import ts from "typescript6";
// Recognized numeric REA_ limit reads must be an analysis setting or a
// documented exception with a reason. External behavioral witnesses are
// reported separately and are not verified by this Node-only scan.
// restart-only is durable. per-call is a
// launch-captured limit whose runtime migration deletes the registry entry.
// Per-call limits belong to ANALYSIS_SETTINGS.
// The three limits moving on #9868, #9865, and #9836 are not in this tree;
// once their names appear here they must join ANALYSIS_SETTINGS.
const root = fileURLToPath(new URL("../../", import.meta.url));
const definitionsPath = join(root, "src/domain/analysisSettingDefinitions.ts");
const registryPath = join(root, "src/domain/numericLimitRegistry.ts");
// Registry text declares an exception. It does not prove a reader exists.
const NUMERIC_LIMIT_DECLARATION = "src/domain/numericLimitRegistry.ts";
const registryPath = join(root, NUMERIC_LIMIT_DECLARATION);
const listFiles = async (dir) => {
const output = [];
@@ -33,32 +34,6 @@ const listFiles = async (dir) => {
return output;
};
/** Registry text is a declaration, not a producer that uses the limit. */
export const NUMERIC_LIMIT_DECLARATION = "src/domain/numericLimitRegistry.ts";
/**
* Where the removed restart-field names cannot return: these roots, files with
* these extensions. The cached `lint` task's inputs in turbo.json must cover
* every such file, or a cached pass would hide a reintroduced name.
*/
export const FORBIDDEN_FIELD_SCAN_ROOTS = [
"src",
"tests",
".agents",
"scripts",
];
export const FORBIDDEN_FIELD_SCAN_EXTENSIONS = [
"ts",
"tsx",
"mjs",
"js",
"md",
"json",
"py",
"yml",
"yaml",
];
/**
* These limits are moving onto runtime analysis settings on their own PRs.
* A producer or a registry entry cannot satisfy that requirement.
@@ -409,7 +384,7 @@ const rememberNumericArgument = (
}
};
export const isNumericLimit = (name) =>
const isNumericLimit = (name) =>
REQUIRED_RUNTIME_LIMITS.includes(name) ||
/(?:_BYTES|_MS|_MIB|_SECONDS|_POLLS|_JOBS|_ELEMENTS|_COUNT|_SESSIONS|_COMMANDS)$/u.test(
name,
@@ -769,10 +744,13 @@ export const parseNumericLimitRegistry = (source) => {
if (
exactLimit(name) === undefined ||
update_mode !== "restart" ||
!["restart-only", "per-call"].includes(policy) ||
!["startup", "per-call", "construction"].includes(read)
)
throw new Error(`Invalid numeric limit registry entry ${name}`);
if (policy !== "restart-only")
throw new Error(
`${name} must use a restart-only policy in the registry. Move per-call limits into ANALYSIS_SETTINGS.`,
);
const source = value.get("provenance");
if (source === undefined)
return { name, update_mode, policy, read, reason };
@@ -918,28 +896,6 @@ export const parseRuntimeSettingEnvironments = (source) => {
return names;
};
/**
* Names still registered as per-call while they move into ANALYSIS_SETTINGS.
* This branch has moved those limits, so the allowlist is empty.
*/
const TEMPORARY_PER_CALL_LIMITS = new Set([]);
/** Temporary exceptions must be removed from both the registry and allowlist. */
export const perCallLimitFailures = (listed, temporary) => {
const failures = [];
for (const [name, policy] of listed)
if (policy === "per-call" && !temporary.has(name))
failures.push(
`${name} is a new per-call exception. Move it into ANALYSIS_SETTINGS instead of extending the temporary list.`,
);
for (const name of temporary)
if (listed.get(name) !== "per-call")
failures.push(
`${name} is no longer a temporary per-call exception; remove it from the allowlist`,
);
return failures;
};
const direct =
process.argv[1] !== undefined &&
import.meta.url === pathToFileURL(resolve(process.argv[1])).href;
@@ -963,12 +919,6 @@ if (direct) {
if (read !== "startup" && read !== "construction")
failures.push(`${name} is restart-only but is not read at startup`);
}
failures.push(
...perCallLimitFailures(
new Map([...listed].map(([name, entry]) => [name, entry.policy])),
TEMPORARY_PER_CALL_LIMITS,
),
);
const discovered = discoverNumericLimitUses(
await Promise.all(
@@ -1056,43 +1006,6 @@ if (direct) {
failures.push(`${relativePath} must report update_mode parameter`);
}
const forbidden =
/(?<![A-Za-z0-9_])(?:rea_restart_required|restartRequired|restart_required)(?![A-Za-z0-9_])|effect:\s*"(?:immediate|next_process)"|SettingChangeEffect/gu;
// Docs and verification receipts keep the field names they recorded.
// Source, tests, skills, and scripts cannot reintroduce those names.
const scanRoots = FORBIDDEN_FIELD_SCAN_ROOTS.map((dir) => join(root, dir));
const scanned = new Set(FORBIDDEN_FIELD_SCAN_EXTENSIONS);
const skipDir = new Set([
"node_modules",
"dist",
".turbo",
".cache",
"rea-numeric-limits.mjs",
]);
const listText = async (dir) => {
const output = [];
const entries = await readdir(dir, { withFileTypes: true });
for (const entry of entries) {
if (skipDir.has(entry.name)) continue;
const path = join(dir, entry.name);
if (entry.isDirectory()) output.push(...(await listText(path)));
else if (scanned.has(entry.name.slice(entry.name.lastIndexOf(".") + 1)))
output.push(path);
}
return output;
};
for (const dir of scanRoots) {
for (const path of await listText(dir)) {
if (path.endsWith(`${sep}rea-numeric-limits.mjs`)) continue;
const source = await readFile(path, "utf8");
const hit = source.match(forbidden);
if (hit)
failures.push(
`${relative(root, path).split(sep).join("/")} still uses ${[...new Set(hit)].join(", ")}`,
);
}
}
if (failures.length > 0) {
console.error(`Numeric REA_ limit check failed:\n${failures.join("\n")}`);
process.exit(1);