The workbench surface audit scrapes module names out of the web module registry and iterates two viewports, so its record count is a product, never a constant. Removing OpenSCAD dropped the registry from 32 to 31 modules and moved the expected count from 64 to 62, while 65 places in the tooling still asserted 64 - re-running the audit would have failed every gate with no actual regression behind it. Add tools/audit64.mjs as the single owner of the coverage rule: auditCoverage(), auditCoverageComplete() and audit64Satisfied(). The success test requires records === expectedRecords only when the snapshot carries an expectation, so freshly produced evidence (62 records plus expectedRecords 62) and historical evidence captured before the removal (64 records, no expectation) are both judged against their own coverage. The 111 archived CAM snapshots stay valid instead of being reclassified as regressions, and a real 62-vs-64 shortfall still fails. Converted callers: 56 build_cam_*_profile.mjs, 5 tools/mcp/replay-*.mjs, close-official-case.mjs, run_partdesign_official_suite.mjs, run_p6_assembly_testcore_chrome.mjs, run_p6_bim_arch_component_chrome.mjs and run-official-native-shape-profile.mjs. The producer in run_p6_cam_chrome.mjs now writes the derived expectedRecords so downstream gates compare against an authoritative expectation. Also fix artifacts that would have revived the removed module: sync-assets.mjs unconditionally re-copied the OpenSCAD runtime probe into public/kernel on every sync-kernel run, and its sources still exist in the build tree. Drop that loop, the dead displayOwners entry in audit-geometry-boundary.mjs, and the 14 MB vendored openscad-wasm. Keep the parity matrix self-consistent: module_count follows rows (31), and the business completion audit derives its expected module count from the matrix instead of hardcoding 32, which would otherwise make completion unreachable. Rebuilt dist and re-ran the audit against an ephemeral isolated static host: 31 modules, 2 viewports, 62 records, 0 failures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
1.8 KiB
JavaScript
40 lines
1.8 KiB
JavaScript
/**
|
|
* Shared owner for the workbench surface audit coverage rule.
|
|
*
|
|
* The record count is not a constant: it is modules x viewports.
|
|
* tools/ui-workbench-surface-audit.mjs scrapes module names out of
|
|
* web/src/module-registry.generated.ts and iterates two viewports, so removing a
|
|
* module changes the expected count (OpenSCAD removal moved 32x2=64 to 31x2=62).
|
|
* Every gate that used to hard-assert 64 must ask here instead.
|
|
*/
|
|
|
|
/** Derive the covered/expected matrix from an audit snapshot. */
|
|
export function auditCoverage(snapshot) {
|
|
const records = Array.isArray(snapshot?.records) ? snapshot.records : [];
|
|
const modules = new Set(records.map(record => record?.module)).size;
|
|
const viewports = new Set(records.map(record => record?.viewport?.name)).size;
|
|
return { modules, viewports, expected: modules * viewports, actual: records.length };
|
|
}
|
|
|
|
/** True when the snapshot covers every module x viewport pair exactly once. */
|
|
export function auditCoverageComplete(snapshot) {
|
|
const { modules, viewports, expected, actual } = auditCoverage(snapshot);
|
|
return modules > 0 && viewports > 0 && expected === actual;
|
|
}
|
|
|
|
/**
|
|
* Success test for a downstream audit64 summary.
|
|
*
|
|
* Accepts both freshly produced evidence (records=62, expectedRecords=62) and
|
|
* historical evidence captured before the module removal (records=64, expected
|
|
* unset or 64): each snapshot is judged against its own coverage rather than a
|
|
* frozen constant, so previously verified evidence is not reclassified as a
|
|
* regression.
|
|
*/
|
|
export function audit64Satisfied(summary) {
|
|
if (!summary || summary.status !== "passed") return false;
|
|
if ((summary.failures ?? 0) !== 0) return false;
|
|
if (summary.expectedRecords != null && summary.records !== summary.expectedRecords) return false;
|
|
return true;
|
|
}
|