Add bounded JSON output to unused - #5009
Merged
Merged
Conversation
Widthdom
marked this pull request as ready for review
July 31, 2026 08:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--max-json-bytessupport tounusedthrough the shared bounded-response enveloperesponse:v2cursors for full, compact, and--by-bucketoutputchangelog.d/unreleased/4905.added.mdWhy
unusedJSON previously had no whole-response byte budget, so large audits—especially--by-bucketoutput—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 skippeddotnet test CodeIndex.sln -c Release -f net9.0 --no-restore -p:UseSharedCompilation=false --logger 'console;verbosity=minimal'— 10,538 passed, 420 skippeddotnet test tests/CodeIndex.Tests/CodeIndex.Tests.csproj --no-restore --filter 'FullyQualifiedName~Issue4905'— 5 passed on net8.0 and 5 passed on net9.0QueryCommandRunnerUnused/JsonEnvelopeWrapperregression selection — 59 passed on net8.0dotnet format CodeIndex.sln --no-restore --verify-no-changesdotnet run --project tools/CodeIndex.Changelog -- checkcdidx status --check --jsoncodex review --base origin/main— no blocking or actionable issues foundScope
Response-shape duplication remains separately tracked in #4904.
Fixes #4905