fix(scanners): retire the autoMode GAP dimension, a /doctor duplicate (D1)
CC 2.1.226's /doctor Check 8 covers auto mode with usage-weighted judgement. The binding positioning forbids carrying a feature whose whole value is duplicating a /doctor check, so the "adopt this feature" nudge goes. The deterministic side stays: SET still validates autoMode structure and still flags it as dead config in shared project settings. GAP dimensions 25 -> 24. The title lived in FOUR tables, not the two the removal was scoped against: the dimension list, scoring TITLE_TO_ID, the humanizer's static translations, and the scoring denominators (TIER_COUNTS t3 8->7, TOTAL_DIMENSIONS 25->24, MAX_WEIGHTED 42->41) -- the one that moves a user-visible number. findGapId falls back to 'unknown' silently, so a partial removal would have degraded without failing. A blanket sync invariant now asserts all four against GAP_CHECKS instead of comparing occurrences pairwise; each arm was verified red against its own defect (denominator drift, orphaned humanizer entry, resurrected dimension). Frozen tests/snapshots/v5.0.0/ stays untouched. strip-retired-gap.mjs is the removal twin of strip-added-scanner.mjs: it strips the retired dimension from whichever side still carries it and re-derives GAP IDs, since retiring a dimension from mid-list shifts every later ID by one. Derived utilization figures are dropped from comparison rather than recomputed -- recomputing them in a test helper would assert the new arithmetic against itself, and scoring.test.mjs already pins them exactly. Re-seeding was rejected: it would silently bake in any other drift across every scanner those four files cover. risk_score, risk_band, verdict, overallGrade, maturity and segment are byte-identical across the change (severity info carries zero risk weight; GAP is excluded from the overall grade). Utilization shifts 43 -> 44 on the fixture. D2 (CA-SKL-002) is NOT removed. Verified against the primary source first: the CC changelog carries exactly one budget-fraction statement (L3786, 2.1.32) and nothing supersedes it, so our 2% is current and 002 is not a duplicate with a stale figure. /doctor's ~1% could not be reconciled from the changelog and it discloses its own numbers as disk estimates, so it is recorded, not adopted. Left explicitly unverified in a code note: L3786 says "character budget" while we express tokens -- a 4x difference nobody can settle from the wording. Suite 1531 -> 1535, all green. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RsfPGxgwbR3MY54wDC6hat
This commit is contained in:
parent
182a37c1af
commit
4027cdcf54
17 changed files with 368 additions and 75 deletions
|
|
@ -7,6 +7,7 @@ import { promisify } from 'node:util';
|
|||
import { readFile, writeFile, unlink, mkdir, access } from 'node:fs/promises';
|
||||
import { hermeticEnv, HERMETIC_HOME } from '../helpers/hermetic-home.mjs';
|
||||
import { stripHotspotLoadPattern } from '../helpers/strip-hotspot-load-pattern.mjs';
|
||||
import { stripRetiredGap } from '../helpers/strip-retired-gap.mjs';
|
||||
|
||||
const exec = promisify(execFile);
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
|
@ -43,7 +44,7 @@ async function runCli(cliPath, args, env = {}) {
|
|||
function normalizeTokenHotspotsPayload(p) {
|
||||
const out = JSON.parse(JSON.stringify(p));
|
||||
out.duration_ms = 0;
|
||||
return stripHotspotLoadPattern(out);
|
||||
return stripRetiredGap(stripHotspotLoadPattern(out));
|
||||
}
|
||||
|
||||
function normalizeManifestOutput(o) {
|
||||
|
|
@ -76,7 +77,7 @@ function normalizePluginHealthOutput(o) {
|
|||
|
||||
function normalizeDriftOutput(o) {
|
||||
// Drift result has no time fields; just round-trip through JSON.
|
||||
return JSON.parse(JSON.stringify(o));
|
||||
return stripRetiredGap(JSON.parse(JSON.stringify(o)));
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
|
@ -318,14 +319,14 @@ describe('fix-cli humanizer (Step 7)', () => {
|
|||
const { stdout } = await runCli(CLI, [FIXTURE, '--json']);
|
||||
const actual = JSON.parse(stdout);
|
||||
const expected = JSON.parse(await readFile(SNAPSHOT, 'utf-8'));
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
assert.deepStrictEqual(stripRetiredGap(actual), stripRetiredGap(expected));
|
||||
});
|
||||
|
||||
it('--raw: stdout JSON byte-equal v5.0.0 snapshot', async () => {
|
||||
const { stdout } = await runCli(CLI, [FIXTURE, '--raw']);
|
||||
const actual = JSON.parse(stdout);
|
||||
const expected = JSON.parse(await readFile(SNAPSHOT, 'utf-8'));
|
||||
assert.deepStrictEqual(actual, expected);
|
||||
assert.deepStrictEqual(stripRetiredGap(actual), stripRetiredGap(expected));
|
||||
});
|
||||
|
||||
it('default mode stderr differs from --raw stderr when findings have humanizer translations', async () => {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ import { fileURLToPath } from 'node:url';
|
|||
import { mkdtemp, mkdir, writeFile, rm } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { resetCounter } from '../../scanners/lib/output.mjs';
|
||||
import { scan, opportunitySummary, bundledSkillsLeverFinding, cliOverMcpLeverFinding, filterHookLeverFinding } from '../../scanners/feature-gap-scanner.mjs';
|
||||
import { scan, opportunitySummary, bundledSkillsLeverFinding, cliOverMcpLeverFinding, filterHookLeverFinding, GAP_CHECKS } from '../../scanners/feature-gap-scanner.mjs';
|
||||
import { TITLE_TO_ID as GAP_TITLE_TO_ID, TIER_COUNTS, TOTAL_DIMENSIONS } from '../../scanners/lib/scoring.mjs';
|
||||
import { TRANSLATIONS } from '../../scanners/lib/humanizer-data.mjs';
|
||||
import { discoverConfigFiles } from '../../scanners/lib/file-discovery.mjs';
|
||||
import { withHermeticHome } from '../helpers/hermetic-home.mjs';
|
||||
|
||||
|
|
@ -506,3 +508,63 @@ describe('GAP scanner — test/demo data must not mask real gaps (M-BUG-13)', ()
|
|||
);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* D1 — retired GAP dimensions.
|
||||
*
|
||||
* The binding /doctor positioning (README «config-audit vs. the built-in
|
||||
* /doctor») forbids carrying a dimension whose whole value is duplicating a
|
||||
* /doctor check. `No autoMode classifier` was retired when CC 2.1.226's
|
||||
* /doctor Check 8 was measured to cover auto mode with usage-weighted
|
||||
* judgement (re-measured 2026-08-09; the deterministic SET `autoMode`
|
||||
* structure/dead-config validation is NOT a duplicate and stays).
|
||||
*
|
||||
* The title lived in THREE tables, not two: the dimension list, the scoring
|
||||
* title→id map, and the humanizer's static translations. `findGapId` falls
|
||||
* back to 'unknown' silently, so a partial removal degrades without failing —
|
||||
* hence the blanket sync invariant below rather than three separate absence
|
||||
* checks.
|
||||
*/
|
||||
describe('GAP scanner — retired dimensions (D1)', () => {
|
||||
const RETIRED_TITLES = ['No autoMode classifier'];
|
||||
|
||||
it('emits no retired dimension on a fixture that lacks the feature', async () => {
|
||||
resetCounter();
|
||||
const discovery = await fixtureDiscovery('healthy-project');
|
||||
const result = await withHermeticHome(
|
||||
() => scan(resolve(FIXTURES, 'healthy-project'), discovery),
|
||||
);
|
||||
const titles = result.findings.map(f => f.title);
|
||||
for (const t of RETIRED_TITLES) {
|
||||
assert.ok(!titles.includes(t), `retired dimension still emitted: ${t}`);
|
||||
}
|
||||
});
|
||||
|
||||
it('leaves no orphaned entry in any of the three tables', () => {
|
||||
for (const t of RETIRED_TITLES) {
|
||||
assert.ok(!GAP_CHECKS.some(g => g.title === t), `still in GAP_CHECKS: ${t}`);
|
||||
assert.ok(!(t in GAP_TITLE_TO_ID), `orphan in scoring TITLE_TO_ID: ${t}`);
|
||||
assert.ok(!(t in TRANSLATIONS.GAP.static), `orphan in humanizer TRANSLATIONS.GAP: ${t}`);
|
||||
}
|
||||
});
|
||||
|
||||
it('keeps the three title tables carrying exactly the same titles', () => {
|
||||
const checks = GAP_CHECKS.map(g => g.title).sort();
|
||||
const scoring = Object.keys(GAP_TITLE_TO_ID).sort();
|
||||
const humanizer = Object.keys(TRANSLATIONS.GAP.static).sort();
|
||||
assert.deepEqual(scoring, checks, 'scoring TITLE_TO_ID drifted from GAP_CHECKS');
|
||||
assert.deepEqual(humanizer, checks, 'humanizer TRANSLATIONS.GAP drifted from GAP_CHECKS');
|
||||
});
|
||||
|
||||
// The scoring denominators are a FOURTH copy of the dimension inventory, and
|
||||
// the one that silently moves every user's utilization score: the score is
|
||||
// presentWeight / MAX_WEIGHTED, derived from TIER_COUNTS. Adding or retiring a
|
||||
// dimension without updating these skews the score instead of failing.
|
||||
it('keeps the scoring denominators in step with the dimension inventory', () => {
|
||||
const perTier = { t1: 0, t2: 0, t3: 0, t4: 0 };
|
||||
for (const g of GAP_CHECKS) perTier[g.tier]++;
|
||||
assert.deepEqual(TIER_COUNTS, perTier, 'TIER_COUNTS drifted from GAP_CHECKS tiers');
|
||||
assert.equal(TOTAL_DIMENSIONS, GAP_CHECKS.length,
|
||||
'TOTAL_DIMENSIONS drifted from GAP_CHECKS length');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { readFile, unlink } from 'node:fs/promises';
|
|||
import { hermeticEnv } from '../helpers/hermetic-home.mjs';
|
||||
import { stripHotspotLoadPattern } from '../helpers/strip-hotspot-load-pattern.mjs';
|
||||
import { stripAddedScanners, stripAddedScannerStderr } from '../helpers/strip-added-scanner.mjs';
|
||||
import { stripRetiredGap, maskGapTallyStderr } from '../helpers/strip-retired-gap.mjs';
|
||||
|
||||
const exec = promisify(execFile);
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
|
@ -41,7 +42,7 @@ function normalizePosture(p) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return stripAddedScanners(stripHotspotLoadPattern(out));
|
||||
return stripRetiredGap(stripAddedScanners(stripHotspotLoadPattern(out)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -50,7 +51,7 @@ function normalizePosture(p) {
|
|||
* run matches the frozen 13-scanner v5.0.0 stderr scorecard.
|
||||
*/
|
||||
function normalizeStderr(s) {
|
||||
return stripAddedScannerStderr(s).replace(/\(\d+ms\)/g, '(0ms)');
|
||||
return maskGapTallyStderr(stripAddedScannerStderr(s)).replace(/\(\d+ms\)/g, '(0ms)');
|
||||
}
|
||||
|
||||
async function runPosture(flags) {
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import { readFile, unlink } from 'node:fs/promises';
|
|||
import { hermeticEnv } from '../helpers/hermetic-home.mjs';
|
||||
import { stripHotspotLoadPattern } from '../helpers/strip-hotspot-load-pattern.mjs';
|
||||
import { stripAddedScanners } from '../helpers/strip-added-scanner.mjs';
|
||||
import { stripRetiredGap } from '../helpers/strip-retired-gap.mjs';
|
||||
|
||||
const exec = promisify(execFile);
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
|
@ -38,7 +39,7 @@ function normalizeEnvelope(env) {
|
|||
}
|
||||
}
|
||||
}
|
||||
return stripAddedScanners(stripHotspotLoadPattern(out));
|
||||
return stripRetiredGap(stripAddedScanners(stripHotspotLoadPattern(out)));
|
||||
}
|
||||
|
||||
async function runOrchestrator(flags) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue