test(docs-symbols): allow an empty KNOWN_STALE_DOC_REFS allowlist

Removing the two now-fixed stale entries (/api/chat, /api/settings/tunnels) in the
prior commit emptied the allowlist, tripping the two structural-guard tests that
assumed size > 0. An empty allowlist is a valid (ideal) state — every previously-
stale ref is fixed. Drop the non-empty assertions; keep the meaningful invariant
that any present entry is an /api/ path.
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-07-07 09:59:40 -03:00
parent a1a5df0970
commit 5d0cf47e29

View File

@@ -156,8 +156,11 @@ test("collectRouteFiles finds the real route tree (non-empty, all route.ts)", ()
for (const f of files) assert.match(f, /route\.tsx?$/);
});
test("KNOWN_STALE_DOC_REFS is a frozen, documented allowlist (non-empty)", () => {
assert.ok(allowlist.size > 0);
test("KNOWN_STALE_DOC_REFS is a frozen, documented allowlist (/api/ paths; may be empty)", () => {
// The allowlist legitimately empties once every previously-stale ref is fixed — v3.8.46
// removed the last two entries (/api/chat, /api/settings/tunnels) because the gate's
// stale-enforcement flagged them as no longer suppressing a live miss. The structural
// invariant is only that any present entry is an /api/ path (not a minimum count).
for (const p of allowlist) assert.match(p, /^\/api\//);
});
@@ -183,7 +186,8 @@ test("stale-enforcement: all current KNOWN_STALE_DOC_REFS entries look like /api
// Structural invariant: every allowlist entry must be an /api/ path, not a file path
// or a prose snippet. Live staleness is enforced at gate runtime by assertNoStale().
const al = allowlist as Set<string>;
assert.ok(al.size > 0, "KNOWN_STALE_DOC_REFS should be non-empty");
// May be empty once all stale refs are fixed (v3.8.46); the invariant is structural —
// any present entry is an /api/ path — not a minimum count.
for (const entry of al) {
assert.match(entry, /^\/api\//, `every allowlist entry must start with /api/: ${entry}`);
}