Skip to content

Audit unused and hotspots result-volume and suppression-boundary behavior #4344

Description

@Widthdom

Context

Dogfooding the graph-derived analysis commands found large result-volume surfaces around unused and hotspots. These are useful commands, but their count, limit, suppression, and JSON output behavior needs tighter contract coverage for automation.

Representative commands:

dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll unused --count --limit 200
dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll unused --by-bucket --json --limit 200
dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll hotspots --count --limit 200
dotnet ./src/CodeIndex/bin/Debug/net8.0/cdidx.dll hotspots --format count --limit 200

Observed baseline:

  • unused --count --limit 200 returned 928 and reported 10462 low-confidence contract-domain candidates suppressed by default.
  • Suppressed domains included test_contract: 7021, documentation_surface: 1280, cli_contract: 946, public_api_surface: 541, json_contract: 357, mcp_contract: 99, lsp_contract: 17, and others.
  • unused --by-bucket --json --limit 200 returned 200 rows plus a very large payload that the caller truncated at roughly 61k tokens. The returned rows included .agent_harness, docs, Dockerfile, Makefile, and README symbols under maybe_unused_nonpublic.
  • hotspots --count --limit 200 printed progress and then 11371; progress included phase=write_output limit=200 group_by=symbol rows=11371, so the count/limit relationship is hard to infer.
  • hotspots --format count is rejected; the supported shape is --count, unlike search-oriented commands that accept --format count.

Audit questions

  • Are unused suppression categories stable enough for machine triage and support docs?
  • Should unused --by-bucket --json have --max-json-bytes, compact summary, or top-path-only projections comparable to recipe output?
  • Should generated/docs/test/build artifacts be easier to suppress when the user wants production runtime dead-code candidates?
  • Should hotspots --count --limit clarify whether the limit affects counted rows, emitted rows, or progress rows?
  • Can unused and hotspots share count/format conventions with search where practical?

Acceptance criteria

  • Large unused and hotspots runs have bounded, automation-friendly JSON summary modes.
  • Limit semantics are documented and tested for count and JSON modes.
  • Default suppression metadata is stable, compact, and sufficient to explain omitted candidates.
  • Production-only or source-scope triage is possible without manual filtering of docs, tests, and build metadata.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions