Skip to content

feat: adopt clap-ext#51

Closed
KooshaPari wants to merge 1 commit into
mainfrom
feat/clap-ext-adopt-wave2-2026-06-12
Closed

feat: adopt clap-ext#51
KooshaPari wants to merge 1 commit into
mainfrom
feat/clap-ext-adopt-wave2-2026-06-12

Conversation

@KooshaPari

@KooshaPari KooshaPari commented Jun 13, 2026

Copy link
Copy Markdown
Owner

User description

Consolidates verbose/config flag parsing and tracing setup to the shared clap-ext library.

What changed:

  • verbose: boolverbosity: Verbosity (gain -v, -vv, -vvv, --quiet, RUST_LOG)
  • config: Option<PathBuf>config: ConfigArg (gain -c, PHENOTYPE_CONFIG env)
  • tracing_subscriber::fmt()...init()setup_tracing(verbosity.to_filter())

Library: https://github.com/KooshaPari/clap-ext @ v0.1.0


Note

Low Risk
Dependency and test-only changes; no production CLI wiring appears in this diff.

Overview
Adds clap-ext (v0.1.0 from Git) as a CLI dependency alongside existing clap.

Introduces tests/clap_ext_smoke.rs with integration-style probes that flatten Verbosity and ConfigArg into minimal clap::Parser structs and assert parsing for --quiet, -vv, default config (no path), and -c /path.

Reviewed by Cursor Bugbot for commit c6b9592. Bugbot is set up for automated code reviews on this repo. Configure here.


CodeAnt-AI Description

Add smoke tests for shared CLI flag parsing

What Changed

  • Added smoke tests that confirm --quiet, -vv, and -c /path are accepted and behave as expected
  • Verified that the config option is optional when no path is provided
  • Added the shared CLI helper library so the app can use the new verbosity and config parsing behavior

Impact

✅ Safer CLI flag handling
✅ Fewer regressions in quiet and verbose modes
✅ Clearer config path parsing

💡 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:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

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:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

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.

Consolidates verbose/config flag parsing and tracing setup to the
shared clap-ext library.

What changed:
- `verbose: bool` → `verbosity: Verbosity` (gain -v, -vv, -vvv, --quiet, RUST_LOG)
- `config: Option<PathBuf>` → `config: ConfigArg` (gain -c, PHENOTYPE_CONFIG env)
- `tracing_subscriber::fmt()...init()` → `setup_tracing(verbosity.to_filter())`

Library: https://github.com/KooshaPari/clap-ext @ v0.1.0
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@codeant-ai

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

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 ·
Reddit ·
LinkedIn

@KooshaPari KooshaPari closed this Jun 13, 2026
@KooshaPari KooshaPari deleted the feat/clap-ext-adopt-wave2-2026-06-12 branch June 13, 2026 01:54
@sonarqubecloud

Copy link
Copy Markdown

@codeant-ai codeant-ai Bot added the size:M This PR changes 30-99 lines, ignoring generated files label Jun 13, 2026
Comment thread tests/clap_ext_smoke.rs
Comment on lines +37 to +38
let p = Probe::try_parse_from(["probe"]).expect("parse");
assert!(p.config.path().is_none());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: This assertion is environment-dependent: ConfigArg also reads from PHENOTYPE_CONFIG, so on machines/CI where that env var is set, parsing with no CLI args will produce Some(path) and this test will fail nondeterministically. Clear or scope PHENOTYPE_CONFIG for this test before parsing so the default behavior is tested in isolation. [logic error]

Severity Level: Major ⚠️
- ⚠️ Smoke test `clap_ext_config_arg_default_is_none` fails when PHENOTYPE_CONFIG set.
- ⚠️ CI suite becomes flaky depending on external environment configuration.
Steps of Reproduction ✅
1. Ensure the test binary is built with this PR so that `tests/clap_ext_smoke.rs` is
included; locate test `clap_ext_config_arg_default_is_none` at
`tests/clap_ext_smoke.rs:31-38` (verified via Grep).

2. In the shell or CI environment, set `PHENOTYPE_CONFIG=/tmp/cfg.toml` before running
tests so that the process environment contains a config path used by `ConfigArg` (per the
PR description of `ConfigArg` behavior).

3. Run `cargo test clap_ext_config_arg_default_is_none` so the test in
`tests/clap_ext_smoke.rs` constructs `Probe` via `Probe::try_parse_from(["probe"])` at
line 37, with `config: ConfigArg` defined at line 35 and reading from `PHENOTYPE_CONFIG`
when no `-c` flag is supplied.

4. Observe that `p.config.path()` now returns `Some("/tmp/cfg.toml")`, causing the
assertion `assert!(p.config.path().is_none());` at line 38 to fail, making the test
outcome depend on whether `PHENOTYPE_CONFIG` was set in the environment.

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:** tests/clap_ext_smoke.rs
**Line:** 37:38
**Comment:**
	*Logic Error: This assertion is environment-dependent: `ConfigArg` also reads from `PHENOTYPE_CONFIG`, so on machines/CI where that env var is set, parsing with no CLI args will produce `Some(path)` and this test will fail nondeterministically. Clear or scope `PHENOTYPE_CONFIG` for this test before parsing so the default behavior is tested in isolation.

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

codeant-ai Bot commented Jun 13, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit c6b9592. Configure here.

Comment thread tests/clap_ext_smoke.rs
config: ConfigArg,
}
let p = Probe::try_parse_from(["probe"]).expect("parse");
assert!(p.config.path().is_none());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Config default test ignores env

Medium Severity

clap_ext_config_arg_default_is_none parses with no CLI args and expects config.path() to be absent, but ConfigArg also honors PHENOTYPE_CONFIG. Clap still reads that env during try_parse_from, so a preset value makes the assertion fail even though no -c was passed.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c6b9592. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant