fix(cli): Improve logging control, exit codes, and input/output safety#186
Merged
Conversation
The log filter hardcoded the level from -v/-q and never consulted the environment, so RUST_LOG was ignored. Build the EnvFilter from RUST_LOG when it is set (standard EnvFilter syntax, full per-target control) and fall back to the verbosity-derived default level otherwise. This lets operators trace a single module, e.g. RUST_LOG=relune_introspect=debug.
Passing a live-DB DSN via --db-url leaks it into argv (ps) and shell history. For render/inspect/doc/export/lint, when no input flag is given, resolve the input from the DATABASE_URL environment variable instead; an explicit flag always wins. This required relaxing the clap input groups from required to optional, so input-presence validation now lives in the single resolve() path. An after_help note keeps the input contract discoverable in --help, and a clearer usage error names the env fallback.
Pixmap allocation for a huge diagram failed with a misleading 'image dimensions may be zero' message (or risked an OOM). Validate the target size against a 100-megapixel budget before allocating, with a clear error that distinguishes zero dimensions from an oversized image and suggests rendering to SVG instead.
This comment has been minimized.
This comment has been minimized.
Three related fixes to the post-execution output/exit pipeline: - lint --deny now exits 10 when an issue reaches the threshold, via a shared CliError::DenyThresholdReached (was exit 1, indistinguishable from a general failure). This matches diff --exit-code and the migration-risk deny gate so CI can tell a policy gate apart from a real failure. - --quiet now suppresses non-error diagnostics (warning/info/hint) on stderr, living up to its documented 'less non-error output'. Exit-code decisions still consider the full diagnostic set. - A missing --out parent directory is now reported as a usage error (exit 2) naming the path, instead of an opaque general failure; other I/O errors still surface as general failures. Adds tests for the lint deny gate, quiet suppression, and the --out directory check.
Schema reviewTip ✅ No risk findings — schema changes look safe to merge. |
mhiro2
force-pushed
the
fix/cli-operability-and-safety
branch
from
June 5, 2026 13:02
21173cb to
79b2e60
Compare
Update the CLI reference and the relune skill to cover the new behavior: an exit-codes table (0/1/2/3/10) with the shared deny/exit-code semantics, RUST_LOG precedence, the --quiet output contract, the DATABASE_URL input fallback (with a warning against DSNs on the command line), and the --out parent-directory usage error.
mhiro2
force-pushed
the
fix/cli-operability-and-safety
branch
from
June 5, 2026 13:04
79b2e60 to
b372402
Compare
Code Metrics Report
Details | | main (552e599) | #186 (cce5e30) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 94.4% | 94.5% | +0.0% |
| Files | 100 | 100 | 0 |
| Lines | 36683 | 36849 | +166 |
+ | Covered | 34657 | 34826 | +169 |
+ | Test Execution Time | 1m41s | 1m36s | -5s |Code coverage of files in pull request scope (92.1% → 93.3%)
Reported by octocov |
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
RUST_LOGin the log filter so operators can trace a single module (e.g.RUST_LOG=relune_introspect=debug);-v/-qset the level when it is unset.DATABASE_URLenvironment variable for live-DB input when no input flag is given, avoiding DSN exposure via argv/shell history; an explicit flag always wins.10so CI can distinguish a policy gate from a general failure.--quietsuppress non-error diagnostics (warning/info/hint) while keeping exit-code decisions on the full diagnostic set.--outparent directory as a usage error (exit2) that names the path, and cap PNG rasterization size with a clear message.Changes
EnvFilterfromRUST_LOGwhen set so a single module can be traced with full per-target control, falling back to the-v/-qverbosity level otherwise, with unit tests covering the precedence.DATABASE_URLwhen no input flag is passed (render/inspect/doc/export/lint), keeping the DSN out of argv and shell history; an explicit--sql/--schema-json/--db-urlalways wins.after_helpnote that keeps the input contract discoverable in--help.10via a sharedDenyThresholdReachedwhenlint --denyhits the threshold, matching the migration-risk deny gate anddiff --exit-codeso CI can tell a policy gate from a general failure.--quietwithout changing exit-code logic, and report a missing--outparent directory as a usage error that names the path.RUST_LOGprecedence, the--quietcontract, theDATABASE_URLfallback (with a warning against DSNs on the command line), and the--outdirectory check across the CLI reference, getting-started guide, and skill.