fix(quickstart): route invalid --concurrency warning to stderr in --json mode - #204
Merged
Merged
Conversation
…son mode
Invalid --concurrency parsing emitted through stdout while quickstart's
options were being constructed, before quickstartCommand could enable JSON
quiet mode: argument expressions evaluate before the callee body runs, so
setQuiet(jsonMode) can never intercept this warning, and `quickstart --json
--concurrency eight` produced a yellow ANSI line ahead of the JSON envelope
while still exiting 0 — silently unparseable output for automated callers.
parseConcurrencyFlag now accepts an explicit diagnostic target: human
compile, refresh, watch, and quickstart calls retain stdout byte-for-byte,
while quickstart --json routes the warning to stderr so it stays visible to
the operator without contaminating the envelope. The parser still returns
undefined on invalid input, so the environment-variable and default
concurrency fallback is unchanged, and the command still exits 0.
Suppressing the warning outright was rejected: the diagnostic must remain
visible.
The new end-to-end test drives the built CLI in both modes: in --json mode
it is parameterized over all four rejection shapes ("eight", "0", "2.5",
"-1") and asserts exit 0, a single parseable envelope with exactly its
existing keys, a warning-free stdout, and the byte-exact warning on stderr;
in human mode it asserts the unchanged yellow warning bytes on stdout and a
clean stderr. Docs updated for the --json flag row and the
LLMWIKI_COMPILE_CONCURRENCY invalid-flag note.
Closes #191
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.
Closes #191.
What
In
--jsonmode, an invalid--concurrencyvalue (eight,0,2.5,-1) emitted ayellow ANSI warning on stdout before the JSON envelope while still exiting 0 — silently
unparseable output for any automated caller.
Root cause: the warning fires while Commander constructs
quickstartCommand's arguments —argument expressions evaluate before the callee body, so
setQuiet(jsonMode)insidequickstartCommandcan never intercept it. The channel has to be chosen at the call site.How
parseConcurrencyFlaggains an explicit diagnostic target (defaultstdout):quickstart --jsonroutes the warning to stderr — visible to the operator, stdoutstays a single parseable envelope.
compile/refresh/watch, which have no--json) keeps today's stdoutwarning byte-for-byte.
undefined, so the env-var/default fallback and the exitcode are unchanged. Suppressing the warning outright was rejected — the diagnostic must
remain visible.
Tests
New end-to-end test drives the built CLI:
--json, parameterized over all four rejection shapes (eight,0,2.5,-1):exit 0, stdout parses as one envelope with exactly its existing keys (no new diagnostic
field), stdout free of the warning, stderr carries the byte-exact warning.
LLMWIKI_COMPILE_CONCURRENCYblanked so ambientenvironment cannot perturb the fallback under test.
Full suite: 671 files, 5,033 tests passing.
Docs
Updated the
--jsonflag row (docs/cli/ingest.mdx) and the invalid-flag note indocs/configuration/environment-variables.mdx.Note: #201 addresses the same issue with an equivalent stderr routing; this PR additionally
covers all four rejection shapes, pins the envelope shape, preserves the human-mode warning
bytes exactly, and updates the docs — one of the two should close #191.