test(humanizer): default-output snapshot test (SC-5) [skip-docs]
Step 12 of v5.1.0 humanizer Wave 4. Adds tests/snapshot-default-output
.test.mjs and seeds three snapshots in tests/snapshots/default-output/
that capture humanized default-mode output for representative CLIs.
Coverage:
- scan-orchestrator: stdout JSON envelope (humanized findings); time
fields normalized.
- token-hotspots-cli: stdout JSON envelope (humanized payload.findings);
duration_ms normalized.
- posture: stderr humanized scorecard; (Xms) durations normalized.
Snapshot envelope is uniform on disk: { kind: 'json', payload: ... }
for JSON streams and { kind: 'text', payload: '...' } for stderr text.
This keeps the snapshot files self-describing and easy to read.
Re-seeding requires UPDATE_SNAPSHOT=1 — drift fails the test by design,
so any humanizer prose change is intentional and re-approved.
Tests: 764 to 767 (+3 SC-5 cases). Full suite passes.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
20b867adc1
commit
07629e9dae
4 changed files with 877 additions and 0 deletions
|
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
"kind": "json",
|
||||
"payload": {
|
||||
"scanner": "TOK",
|
||||
"status": "ok",
|
||||
"files_scanned": 2,
|
||||
"duration_ms": 0,
|
||||
"total_estimated_tokens": 1809,
|
||||
"hotspots": [
|
||||
{
|
||||
"source": "mcp:memory (.mcp.json)",
|
||||
"estimated_tokens": 500,
|
||||
"rank": 1,
|
||||
"recommendations": [
|
||||
"Review whether this source needs to load on every turn."
|
||||
]
|
||||
},
|
||||
{
|
||||
"source": "mcp:sadhguru-wisdom (plugin:sadhguru-wisdom)",
|
||||
"estimated_tokens": 500,
|
||||
"rank": 2,
|
||||
"recommendations": [
|
||||
"Review whether this source needs to load on every turn."
|
||||
]
|
||||
},
|
||||
{
|
||||
"source": "mcp:vegnorm-rag (plugin:vegnormalene)",
|
||||
"estimated_tokens": 500,
|
||||
"rank": 3,
|
||||
"recommendations": [
|
||||
"Review whether this source needs to load on every turn."
|
||||
]
|
||||
},
|
||||
{
|
||||
"source": "CLAUDE.md",
|
||||
"estimated_tokens": 116,
|
||||
"rank": 4,
|
||||
"recommendations": [
|
||||
"Move volatile top-of-file content to the bottom or extract to an @import-ed file.",
|
||||
"Split overlong CLAUDE.md into focused @imports (≤200 lines each)."
|
||||
],
|
||||
"path": "/Users/ktg/.claude/plugins/marketplaces/ktg-plugin-marketplace/plugins/config-audit/tests/fixtures/marketplace-medium/CLAUDE.md"
|
||||
},
|
||||
{
|
||||
"source": "hooks/hooks.json",
|
||||
"estimated_tokens": 81,
|
||||
"rank": 5,
|
||||
"recommendations": [
|
||||
"Deduplicate overlapping entries — each duplicate inflates the per-turn schema payload.",
|
||||
"Move rarely-used permissions to a project-local override."
|
||||
],
|
||||
"path": "/Users/ktg/.claude/plugins/marketplaces/ktg-plugin-marketplace/plugins/config-audit/tests/fixtures/marketplace-medium/hooks/hooks.json"
|
||||
},
|
||||
{
|
||||
"source": ".claude/settings.json",
|
||||
"estimated_tokens": 59,
|
||||
"rank": 6,
|
||||
"recommendations": [
|
||||
"Deduplicate overlapping entries — each duplicate inflates the per-turn schema payload.",
|
||||
"Move rarely-used permissions to a project-local override."
|
||||
],
|
||||
"path": "/Users/ktg/.claude/plugins/marketplaces/ktg-plugin-marketplace/plugins/config-audit/tests/fixtures/marketplace-medium/.claude/settings.json"
|
||||
},
|
||||
{
|
||||
"source": ".mcp.json",
|
||||
"estimated_tokens": 53,
|
||||
"rank": 7,
|
||||
"recommendations": [
|
||||
"Deduplicate overlapping entries — each duplicate inflates the per-turn schema payload.",
|
||||
"Move rarely-used permissions to a project-local override."
|
||||
],
|
||||
"path": "/Users/ktg/.claude/plugins/marketplaces/ktg-plugin-marketplace/plugins/config-audit/tests/fixtures/marketplace-medium/.mcp.json"
|
||||
}
|
||||
],
|
||||
"findings": [
|
||||
{
|
||||
"id": "CA-TOK-001",
|
||||
"scanner": "TOK",
|
||||
"severity": "low",
|
||||
"title": "A connected service exposes many tools, all loading on every turn",
|
||||
"description": "Each tool a connected service exposes adds its description to every turn. Services with many tools eat space fast.",
|
||||
"file": ".mcp.json",
|
||||
"line": null,
|
||||
"evidence": "tool_count=unknown; server=\"memory\"; source=\".mcp.json\" — severity reflects estimated tokens/turn based on structural heuristic; not measured against runtime telemetry",
|
||||
"category": "token-efficiency",
|
||||
"recommendation": "Limit which tools the service exposes (often via a `tools` allow-list), or disconnect services you rarely use.",
|
||||
"autoFixable": false,
|
||||
"userImpactCategory": "Wasted tokens",
|
||||
"userActionLanguage": "Optional cleanup",
|
||||
"relevanceContext": "affects-everyone"
|
||||
}
|
||||
],
|
||||
"counts": {
|
||||
"critical": 0,
|
||||
"high": 0,
|
||||
"medium": 0,
|
||||
"low": 1,
|
||||
"info": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue