feat: adopt clap-ext (Verbosity, ConfigArg, setup_tracing)#61
feat: adopt clap-ext (Verbosity, ConfigArg, setup_tracing)#61KooshaPari wants to merge 1 commit into
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.
Reviewed by Cursor Bugbot for commit bcc71f6. Configure here.
| setup_tracing(cli.verbosity.to_filter()); | ||
| if let Some(cfg) = &cli.config.config { | ||
| tracing::debug!(config = %cfg.display(), "config override"); | ||
| } |
There was a problem hiding this comment.
Global config override unused
Medium Severity
Cli now accepts --config/-c and PHENOTYPE_CONFIG, but main only emits a tracing::debug! and never passes that path into any command handler. Users and automation that set a global config override get the same behavior as without it.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit bcc71f6. Configure here.
| if let Some(cfg) = &cli.config.config { | ||
| tracing::debug!(config = %cfg.display(), "config override"); |
There was a problem hiding this comment.
Suggestion: The new global config override is parsed but never propagated to any command handler, so --config/PHENOTYPE_CONFIG is effectively a no-op at runtime. Users will think they selected a config file, but all subcommands still run with their normal defaults/explicit args. Wire the parsed override into the execution path (for example by applying it to command args before dispatch, or by loading shared config once and passing it into handlers). [incomplete implementation]
Severity Level: Major ⚠️
- ⚠️ --config flag has no effect on analytics commands.
- ⚠️ PHENOTYPE_CONFIG env var silently ignored at runtime.
- ⚠️ Users may assume wrong configuration file is active.Steps of Reproduction ✅
1. Build the `tokenledger` binary defined at `crates/tokenledger/src/main.rs:16-35`, which
uses `Cli::parse()` from `crates/tokenledger/src/cli.rs:7-21`.
2. Run any subcommand with `--config path/to/custom.toml`, for example `tokenledger
monthly --config my.cfg ...`; `Cli` parses `config: ConfigArg` at
`crates/tokenledger/src/cli.rs:15-17`.
3. In `main()` (`crates/tokenledger/src/main.rs:16-21`), the code executes
`setup_tracing(cli.verbosity.to_filter());` and then only logs the override in the `if let
Some(cfg) = &cli.config.config { ... }` block at lines 19-20.
4. Execution then dispatches directly to the chosen handler in the `match cli.command` at
`crates/tokenledger/src/main.rs:22-34`; those handlers (`run_monthly`, `run_daily`,
`run_pricing_*`, etc.) take only their specific args (see
`crates/tokenledger/src/cli.rs:39-200`) and never receive or consult `cli.config`, so the
selected config file is never used and program behavior is identical to running without
`--config`.Fix in Cursor | Fix in VSCode Claude
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** crates/tokenledger/src/main.rs
**Line:** 19:20
**Comment:**
*Incomplete Implementation: The new global config override is parsed but never propagated to any command handler, so `--config`/`PHENOTYPE_CONFIG` is effectively a no-op at runtime. Users will think they selected a config file, but all subcommands still run with their normal defaults/explicit args. Wire the parsed override into the execution path (for example by applying it to command args before dispatch, or by loading shared config once and passing it into handlers).
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix|
CodeAnt AI finished reviewing your PR. |
|
Superseded by main (work was rebased+merged in feat/clap-ext-adopt-rebased-2026-06-14). |
Consolidates CLI boilerplate to clap-ext v0.1.0. Adopts 3 shared primitives: - `Cli` struct now flattens `clap_ext::prelude::Verbosity` (`-v`, `-vv`, `-vvv`, `--quiet/-q`, with proper tracing filter mapping) - `Cli` struct now flattens `clap_ext::prelude::ConfigArg` (`--config/-c` plus `PHENOTYPE_CONFIG` env var) - `main()` initializes logging via `clap_ext::prelude::setup_tracing()` (was previously no logging setup at all - tracing went to /dev/null) All 59 existing tests still pass (4 in pareto-rs, 55 in tokenledger). This is a greenfield adoption: tokenledger had no verbosity flag, no config flag, and no tracing init. clap-ext gives us all three for ~5 new lines of code. Ref: FLEET_100TASK_DAG_V4.md §86 (V9-T3-5) clap-ext v0.1.0: https://github.com/KooshaPari/clap-ext/releases/tag/v0.1.0
bcc71f6 to
f1156df
Compare
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |


User description
Consolidates CLI boilerplate to clap-ext v0.1.0. Adopts 3 shared primitives:
What changed
Clistruct now flattensclap_ext::prelude::Verbosity(-v,-vv,-vvv,--quiet/-q, with proper tracing filter mapping)Clistruct now flattensclap_ext::prelude::ConfigArg(--config/-cplusPHENOTYPE_CONFIGenv var)main()initializes logging viaclap_ext::prelude::setup_tracing()(was previously no logging setup at all — tracing went to /dev/null)Why
This is a greenfield adoption: tokenledger had no verbosity flag, no config flag, and no tracing init. clap-ext gives us all three for ~5 new lines of code. The wins:
-v,-vv,-vvvfor variable log verbosity--quiet/-qto silence non-error output--config/-cfor runtime config overridePHENOTYPE_CONFIGenv var supportTest results
All 59 existing tests still pass.
Refs: FLEET_100TASK_DAG_V4.md §86 (V9-T3-5)
clap-ext v0.1.0: https://github.com/KooshaPari/clap-ext/releases/tag/v0.1.0
Note
Low Risk
Surface-level CLI and logging only; no analytics, pricing, or ingest logic changes, and config override is logged but not applied to subcommands yet.
Overview
Adds the shared clap-ext crate (git tag
v0.1.0) to the workspace and wires it into the tokenledger binary.The root
Clinow flattens Verbosity (-v/-vv/-vvv, quiet) and ConfigArg (--config/-c,PHENOTYPE_CONFIG). main callssetup_tracingwith the verbosity-derived filter so tracing is actually initialized (previously unused), and emits a debug log when a config path override is present. Subcommand behavior is unchanged; config is not yet consumed beyond that log.Reviewed by Cursor Bugbot for commit bcc71f6. Bugbot is set up for automated code reviews on this repo. Configure here.
CodeAnt-AI Description
Add CLI verbosity, config override, and live tracing output
What Changed
-v/-vv/-vvvand-qso users can increase or silence command output--config/-candPHENOTYPE_CONFIGto point the app at a config fileImpact
✅ Clearer command output✅ Easier config-file overrides✅ Fewer "missing logs" runs💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.