Skip to content

Commit 6b8efe3

Browse files
claude[bot]claude
andauthored
fix(devx): build tenant-audit-census self-test's unenforced-prose fixture from the page's own number (#17661)
The `⭐ a stale unenforced prose number is NOT a finding` / `an unenforced prose claim reworded off the page IS a finding` self-test cases built their `.replace()` search string from the LIVE census (`census.declaredObjects`). The gate itself declares this figure unenforced -- value free, sentence required -- so once the page's stated number and the live tree disagree, that search string stops matching the page, `.replace()` becomes a no-op, and the second case fails for the PAGE rather than for the classifier it exists to pin. Build the fixture from the page's own stated number instead (read with the same `UNENFORCED_PROSE_COUNTS[0]` pattern the classifier itself uses), so the pair of cases test the classifier's behaviour regardless of whether the page and the live census currently agree. Claude-Session: https://claude.ai/code/session_012GKcPZbMoGq7WPzKLfRBTU Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8955995 commit 6b8efe3

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

scripts/check-tenant-audit-census.mjs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,13 +837,30 @@ export function selfTest() {
837837
check(page.replace(UNENFORCED_MEASURED_AT.pattern, 'Measured on 2001-01-01 at `0000000ab`.'), counts)
838838
.length === 0);
839839

840-
// The unenforced PROSE figure: value free, sentence required.
840+
// The unenforced PROSE figure: value free, sentence required. ⛔ The fixture is
841+
// built from the PAGE's OWN stated number -- read with the exact same pattern
842+
// the classifier uses (`UNENFORCED_PROSE_COUNTS[0]`) -- never from the live
843+
// `census.declaredObjects`. That figure is declared unenforced precisely so it
844+
// may drift from the tree without being a finding; a fixture pinned to the
845+
// LIVE count made `.replace()` a silent no-op the moment page and tree
846+
// disagreed, so this case failed for the PAGE rather than for the classifier
847+
// it exists to pin (#17437).
848+
const declaredObjectsRow = UNENFORCED_PROSE_COUNTS[0];
849+
const declaredObjectsMatch = declaredObjectsRow.pattern.exec(page);
850+
if (!declaredObjectsMatch) {
851+
throw new Error(
852+
`self-test fixture: the page no longer states "${declaredObjectsRow.name}" in the shape `
853+
+ `${declaredObjectsRow.pattern} looks for -- fix the page, or this pair of cases can no `
854+
+ 'longer build its fixture.',
855+
);
856+
}
857+
const declaredObjectsSentence = declaredObjectsMatch[0];
841858
t('⭐ a stale unenforced prose number is NOT a finding',
842-
check(page.replace(`Across ${census.declaredObjects} declared objects`, 'Across 4 declared objects'))
859+
check(page.replace(declaredObjectsSentence, 'Across 4 declared objects'))
843860
.length === 0,
844-
check(page.replace(`Across ${census.declaredObjects} declared objects`, 'Across 4 declared objects')).join(' | '));
861+
check(page.replace(declaredObjectsSentence, 'Across 4 declared objects')).join(' | '));
845862
t('an unenforced prose claim reworded off the page IS a finding',
846-
check(page.replace(`Across ${census.declaredObjects} declared objects`, 'Across the declared objects'))
863+
check(page.replace(declaredObjectsSentence, 'Across the declared objects'))
847864
.some((p) => p.startsWith('[unenforced-prose-missing]')));
848865

849866
// ── refusals ───────────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)