Skip to content

Add bounded JSON output to unused - #5009

Merged
Widthdom merged 1 commit into
mainfrom
fix-issue4905
Jul 31, 2026
Merged

Add bounded JSON output to unused#5009
Widthdom merged 1 commit into
mainfrom
fix-issue4905

Conversation

@Widthdom

Copy link
Copy Markdown
Owner

Summary

  • add --max-json-bytes support to unused through the shared bounded-response envelope
  • preserve whole UTF-8 rows, continuation/completion metadata, and generation-bound response:v2 cursors for full, compact, and --by-bucket output
  • recompute returned bucket, confidence, and contract-domain summaries after byte trimming
  • add focused Unicode, long-signature, exact-boundary, minimum-budget, final-page, and stale/mismatched-cursor coverage
  • document the contract in both English and Japanese and add changelog.d/unreleased/4905.added.md

Why

unused JSON previously had no whole-response byte budget, so large audits—especially --by-bucket output—could exceed automation and agent context limits. The command did not opt into the shared bounded-response path, and its query layer did not consume a shared response offset.

Impact

Callers can now request a hard JSON byte cap that includes the final newline. Partial responses contain only complete rows and can be resumed without gaps or duplicates. Budgets too small for metadata plus one row return a typed usage error with empty stdout. Uncapped output remains compatible.

Validation

  • dotnet test CodeIndex.sln -c Release -f net8.0 --no-restore -p:UseSharedCompilation=false --logger 'console;verbosity=minimal' — 11,012 passed, 7 skipped
  • dotnet test CodeIndex.sln -c Release -f net9.0 --no-restore -p:UseSharedCompilation=false --logger 'console;verbosity=minimal' — 10,538 passed, 420 skipped
  • dotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj --no-restore --filter 'FullyQualifiedName~Issue4905' — 5 passed on net8.0 and 5 passed on net9.0
  • broader QueryCommandRunnerUnused / JsonEnvelopeWrapper regression selection — 59 passed on net8.0
  • dotnet format CodeIndex.sln --no-restore --verify-no-changes
  • dotnet run --project tools/CodeIndex.Changelog -- check
  • cdidx status --check --json
  • mandatory codex review --base origin/main — no blocking or actionable issues found

Scope

Response-shape duplication remains separately tracked in #4904.

Fixes #4905

@Widthdom
Widthdom marked this pull request as ready for review July 31, 2026 08:48
@Widthdom
Widthdom merged commit a6d37b7 into main Jul 31, 2026
12 checks passed
@Widthdom
Widthdom deleted the fix-issue4905 branch July 31, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add bounded JSON output to unused analysis

1 participant