chore: harden CLI review contracts - #61
Merged
Merged
Conversation
tiye
force-pushed
the
chore/review-hardening
branch
from
August 22, 2026 18:28
794f50f to
ced23c1
Compare
There was a problem hiding this comment.
Pull request overview
This PR hardens QuickCoffee’s CLI contracts by introducing qcoffee --json single-result output (including structured errors), improving qtest collection diagnostics to include offending paths, and making TAP path assertions platform-independent across OS path separators.
Changes:
- Add
qcoffee --jsonoutput mode with deterministic JSON serialization for values and structured error reporting. - Strengthen CLI argument conflict handling/tests (including order-independent conflict scenarios) and expand integration test coverage for JSON output.
- Improve
qtestfile collection error messages by attaching the failing path; adjust TAP tests to comparePath::display()output.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/cli_tools.rs | Updates TAP assertions to be platform-independent; adds CLI integration tests for qcoffee --json and additional conflict-order coverage. |
| src/main.rs | Implements --json mode, JSON value/error formatting, and new conflict handling paths for CLI parsing. |
| src/bin/qtest.rs | Adds path context to filesystem errors during test file collection/canonicalization. |
| RFCs/0117-qcoffee-json-output.md | Introduces an RFC defining the qcoffee --json CLI contract and acceptance criteria. |
| RFCs/0000-project-scope.md | Extends the documented RFC baseline to include RFC 0117. |
| README.md | Updates top-level RFC range and adds a qcoffee --json usage example. |
| manuals/manual.*.qc | Documents the new qcoffee --json behavior in all manual locales. |
| docs/syntax.*.md | Updates syntax index to include qcoffee --json. |
| docs/manual.*.(md | html) |
Suppressed comments (4)
src/main.rs:235
- The
--checkoption rejects--json, but the current error message groups--jsontogether with--statsas mutually exclusive execution-mode alternatives. Since--jsonis intended to work alongside--stats, this wording is misleading and differs from the later post-parse conflict message when--jsonappears after--check. Consider emitting a dedicated--jsonconflict message here so the behavior/message is order-independent and doesn’t imply--statsconflicts with--json.
if source.is_some() || dump || check || fingerprint || stats || json {
eprintln!(
"-e, --check, --dump-bytecode, --fingerprint, --json, and --stats are execution-mode alternatives"
);
return ExitCode::from(2);
}
src/main.rs:261
- The
--fingerprintconflict check uses a single error message for both--statsand--jsonconflicts. Because--jsonis allowed with--stats, this can mislead users into thinking those flags are incompatible, and it produces different messages depending on whether--jsoncomes before or after--fingerprint. Split out thejsoncase and use a dedicated message consistent with the post-parse check.
if source.is_some() || dump || check || fingerprint || stats || json {
eprintln!(
"-e, --check, --dump-bytecode, --fingerprint, --json, and --stats are execution-mode alternatives"
);
return ExitCode::from(2);
}
src/main.rs:246
- In the
--checkbranch, the read-source error handler includes aif json { ... }path, but--checkis already rejected whenjsonis set (and when--jsonappears after--check,jsonis still false at this point). This makes the JSON printing branch effectively unreachable and adds confusing dead code to a user-facing path.
This issue also appears on line 310 of the same file.
Err(error) => {
if json {
println!("{}", json_io_error("read", &error));
} else {
eprintln!("{error}");
}
return ExitCode::from(1);
src/main.rs:314
- This post-parse
--jsonconflict check currently emits a different error message than the earlier per-flag conflict checks, soqcoffee --json --check FILEandqcoffee --check FILE --jsoncan produce different diagnostics. To match the PR goal of order-independent, accurately diagnosed conflicts, use the same dedicated--jsonincompatibility message in both places.
if json && (dump || check || fingerprint) {
eprintln!(
"--check, --dump-bytecode, --fingerprint, and --json are execution-mode alternatives"
);
return ExitCode::from(2);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
tiye
force-pushed
the
feat/qtest-selection
branch
from
August 22, 2026 18:35
2f35c37 to
db7d796
Compare
tiye
force-pushed
the
chore/review-hardening
branch
2 times, most recently
from
August 22, 2026 18:51
a53fedc to
9094259
Compare
tiye
force-pushed
the
feat/qtest-selection
branch
from
August 23, 2026 03:44
db7d796 to
1bcc853
Compare
Base automatically changed from
feat/qtest-selection
to
feat/context-builder-api
August 23, 2026 04:13
tiye
force-pushed
the
feat/context-builder-api
branch
from
August 23, 2026 07:03
6ab7a33 to
c5296d4
Compare
tiye
force-pushed
the
chore/review-hardening
branch
3 times, most recently
from
August 23, 2026 07:40
289e1c7 to
2a79f1e
Compare
Base automatically changed from
feat/context-builder-api
to
feat/program-fingerprint
August 23, 2026 07:45
tiye
force-pushed
the
chore/review-hardening
branch
from
August 23, 2026 07:48
2a79f1e to
1e2c403
Compare
tiye
force-pushed
the
chore/review-hardening
branch
from
August 23, 2026 08:02
1e2c403 to
9a8d887
Compare
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
This maintenance PR consolidates concrete review fixes from the existing stack:
-e/file/mode conflicts order-independent and accurately diagnosedVerification
CARGO_TARGET_DIR=/tmp/qcoffee-hardening cargo test --locked --test cli_tools