Make native query answers compact and honor output budgets - #352
Merged
Merged
Conversation
forhappy
marked this pull request as ready for review
October 2, 2026 08:46
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.
Native query answers currently spend space on audit envelopes, duplicate node inventories and empty sections. Default CLI and MCP text now shows a compact, source-located answer with uncertainty intact;
--verbose/--evidenceexposes the full paged audit ledger. Raw query, Agent View and MCP structured contracts are unchanged, and exploration retains isolated requested symbols.Finite commands share a strict UTF-8 output budget and an exact continuation. Commands without a native cursor save an immutable completed answer for
compass output, so continuation never repeats an action. Oversized JSON/JSONL fails intact, and streaming events/watch/serve/REPL reject finite budgets before starting. Complete native responses use a bounded, corruption-checked cache keyed by verified graph, Program IR, profiles, request limits and semantic mode. Partial responses and source excerpts remain native.Validation: workspace Clippy and native lib/bin tests passed (1,124 tests; two existing vendored grammar tests ignored), along with CLI product, all CLI suites (311 tests), renderer, MCP, store/query integration, CompassQL TCK/support and product-boundary gates. New regressions cover one-hop cost, Unicode budgets, immutable saved output, corruption/retention/redirected paths, machine output, init publication, cache invalidation and isolated exploration.
The fixed 50-question replay preserves all row verdicts (49/50) and reduces mean estimated output from 419 to 364 tokens, versus 550 for the installed comparator. The 25-question natural suite preserves 24/25 at 547 tokens versus 757. The qualification record includes source/artifact pins and both optimized binary hashes. On the four complete graphs, repeated-query medians are 30–34 ms versus 85–994 ms before; every raw JSON answer is byte-identical across binaries and repetitions. Partial Gson remains uncached, and some cold timings regress. These are source-reviewed text-recall panels over five pinned public repositories, not population-wide precision claims.
Compatibility and migration notes document compact defaults, the new output reader and
--budgetno longer selecting legacy traversal. JS/viewer and graph-publication qualification were not rerun locally because their contracts and source are unchanged; CI runs those broader gates.All 14 CI jobs pass on
4cafb0eb, including the six native platforms, full CLI integration tests, nextest, query relevance, code-graph fixtures, JavaScript/VS Code, publishable archives, cargo installation and standalone launch, Windows installers, and dependency checks. Legacy fixtures explicitly select--traverse; disposable caches are excluded from Git and crate archives at every working-directory depth. Workspace packaging also passes locally with the four test-generated cache records present.