fix: route legacy-usearch notices to stderr for clean structured output - #17
Merged
Conversation
Diagnostic notices ('Detected legacy usearch index...') were printed to
stdout via the Rich console, polluting --format json output and breaking
JSON consumers (the pi extension's result parser fell back to a raw dump
when JSON.parse hit the leading warning text).
Route these notices to a stderr Rich console (err_console) so stdout stays
pure JSON while the notices remain visible in the terminal. The existing
suppress_stdout_notices guard is preserved.
Verified: sia-code search --format json -k 5 -- '...' now emits clean
parseable JSON on stdout and the legacy-usearch notices on stderr.
- route CLI and MCP git context through shared index resolution - document and lock the complete MCP tool surface - preserve machine-readable non-TTY JSON and isolate tests
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.
Problem
--format jsonoutput was polluted by diagnostic notices (Detected legacy usearch index...) printed to stdout via the Rich console. This broke JSON consumers — e.g. the pisia-code-proactiveextension'sJSON.parsehit the leading warning text and fell back to dumping the raw stdout (warnings + pretty JSON) as the tool result, adding ~580 chars of ANSI warnings and defeating compact/projection formatting.Root cause
create_backend()incli.pyandruntime_context.pyemitted the legacy-usearch compatibility notices withconsole.print(...)(stdout), even in structured output mode.Fix
Route these notices to a stderr Rich console (
err_console = Console(stderr=True, ...)):--format json/ machine consumption.suppress_stdout_noticesguard is preserved unchanged.Files
sia_code/cli.py— adderr_console, 2 notice blocks →err_console.printsia_code/runtime_context.py— same (duplicate backend-resolution path)Verification
Diff: +10/-8 across 2 files. Imports verified.
Notes
sia-code index --clean .to sqlite-vec, which eliminates the legacy notices entirely.maybeJsonfinds the first{), so older CLI versions that still print notices to stdout won't break parsing.