Annotate every ranked TOK hotspot with the load-pattern triple (loadPattern/survivesCompaction/derivationConfidence): - hotspotLoadPattern() maps each discovery `type` → a deriveLoadPattern kind. Rules reuse activeConfig.rules for precise `scoped` handling; claude-md maps by scope. Two new deriveLoadPattern kinds back the rest: `command` (on-demand — body loads on /invoke) and `harness-config` (external — settings/keybindings/.mcp.json/hooks.json/plugin.json configure the CLI, not the model context, so they cost no per-turn context tokens). Honest split: the .mcp.json FILE is external; the MCP server's tool schemas are a separate `always` hotspot. Byte-stability — the opposite of B1's manifest. token-hotspots IS a byte-equal SC-6/SC-7 CLI, and its hotspots ride inside scan-orchestrator + posture, so the change touched SIX frozen-v5.0.0 comparisons across five test files. Resolved by preserving the frozen baselines: a shared tests/helpers/strip-hotspot-load-pattern.mjs strips the additive triple before each byte-equal compare (proves the original schema is byte-identical). SC-5 default-output snapshots (scan-orchestrator + token-hotspots) regenerated — diff reviewed as additive-only. Tests 1008→1012. Self-audit A/A, scanner count unchanged at 13 (C bumps to 14). Completes v5.6 B (B1 manifest + B2 token-hotspots). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
/**
|
|
* v5.6 B2 added a load-pattern triple (loadPattern / survivesCompaction /
|
|
* derivationConfidence) to each TOK hotspot. The frozen v5.0.0 byte-equal
|
|
* baselines strip it before comparison so they still prove the ORIGINAL schema
|
|
* is byte-identical; the new fields are purely additive.
|
|
*
|
|
* TOK hotspots ride along inside scan-orchestrator and posture payloads too
|
|
* (`scanners[].hotspots`, `scannerEnvelope.scanners[].hotspots`), so this
|
|
* strips every hotspots array reachable in a CLI payload / envelope. Mutates
|
|
* in place and returns the payload for chaining inside a normalizer.
|
|
*
|
|
* @template T
|
|
* @param {T} payload
|
|
* @returns {T}
|
|
*/
|
|
export function stripHotspotLoadPattern(payload) {
|
|
const drop = (arr) => {
|
|
if (!Array.isArray(arr)) return;
|
|
for (const h of arr) {
|
|
delete h.loadPattern;
|
|
delete h.survivesCompaction;
|
|
delete h.derivationConfidence;
|
|
}
|
|
};
|
|
if (!payload || typeof payload !== 'object') return payload;
|
|
drop(payload.hotspots);
|
|
if (Array.isArray(payload.scanners)) {
|
|
for (const s of payload.scanners) drop(s.hotspots);
|
|
}
|
|
if (payload.scannerEnvelope) {
|
|
drop(payload.scannerEnvelope.hotspots);
|
|
if (Array.isArray(payload.scannerEnvelope.scanners)) {
|
|
for (const s of payload.scannerEnvelope.scanners) drop(s.hotspots);
|
|
}
|
|
}
|
|
return payload;
|
|
}
|