Harden generated command group discovery - #4012
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 48 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThe PR hardens CLI command-group discovery while restoring support for multiline Cobra usage declarations.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/CliScraperBase.cs | Tightens command-group classification around Usage declarations and plural Commands headings while supporting multiline usage synopses. |
| tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator/Scrapers/Cli/CobraCliScraper.cs | Restricts section-header whitespace matching to spaces and tabs so command-table content cannot be swallowed across physical lines. |
| tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Scrapers/Cli/CliScraperTraversalTests.cs | Adds coverage for multiline group usage and warning emission when declared groups produce no subcommands. |
| tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Scrapers/CosignCliScraperTests.cs | Adds regression fixtures for multi-row and single-row all-word Cosign command tables. |
| tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Scrapers/PulumiCliScraperTests.cs | Verifies that Pulumi command operands are not misclassified as command groups. |
| tools/ModularPipelines.OptionsGenerator/src/ModularPipelines.OptionsGenerator.Tests/Scrapers/SnykCliScraperTests.cs | Verifies that descriptive and example text containing command syntax does not create a false command group. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
H[CLI help text] --> U{Usage contains command placeholder?}
H --> C{Plural Commands heading exists?}
U -->|Yes| G{Both conditions true?}
C -->|Yes| G
U -->|No| L[Handle as leaf command]
C -->|No| L
G -->|Yes| E[Extract and traverse subcommands]
G -->|No| L
E --> O[Generate typed command options]
L --> O
Reviews (5): Last reviewed commit: "fix(generator): parse multiline group us..." | Re-trigger Greptile
Code reviewNo blocking issues found. The regex changes are narrowly scoped and each is backed by a regression test that reproduces the exact failure mode from #3990:
One non-blocking follow-up: issue #3990 also lists Architectural note: this is not the first time a shared regex meant to serve many CLI dialects (Cobra, Cosign, Pulumi, Snyk, ...) has needed a targeted tweak because a fix motivated by one tool's help-text quirk risked affecting another's — this PR alone touches behavior shared by three unrelated tools to fix one. The per-tool regression-fixture discipline used here is a good mitigation, but as more CLIs get onboarded, a small explicit-state parser (e.g. a line-by-line state machine tracking "in Usage section" / "in Commands section") would likely be easier to reason about and extend safely than continuing to layer exceptions onto a handful of increasingly specific shared regexes. Worth considering if this class of cross-tool regression keeps recurring. |
|
Added the review's missing Cosign signing-config and rusted-root fixtures in 37c6bd0, using their exact failed workflow help layout. Both single-row all-word command tables now explicitly assert discovery of create. Validation: OptionsGenerator tests 820/820; Release build 0 warnings/errors. |
Code review (follow-up)The previous follow-up is addressed: Two small non-blocking observations on the fixes as they stand now:
Neither blocks merge — both are about locking in the other direction of this detector (avoiding false negatives) now that two rounds of fixes have tightened it against false positives. The per-tool fixture discipline in this PR is good; extending it to a "still detects a real group" case for the narrowed patterns would round it out. |
|
Rebased onto current main (13fd094). Validation: Cosign 7/7; Pulumi 4/4; Snyk 18/18; OptionsGenerator Release build clean. |
37c6bd0 to
a0d621a
Compare
Code review (follow-up)No new changes to review — this update is a rebase onto current Prior review stands: the narrowed Two previously-raised non-blocking observations remain open (not required for merge, just flagged again in case they get lost across the rebase):
Architectural note (repeated from before, still relevant): this shared regex-based parser has now needed three separate narrowing passes across Cobra/Cosign/Pulumi/Snyk to fix cross-tool false positives. As more CLI dialects get onboarded, a small explicit-state line-by-line parser (tracking "in Usage section" / "in Commands section" as distinct states) would likely scale better than continuing to layer exceptions onto a handful of increasingly specific shared regexes — worth considering if this pattern of fixes keeps recurring. |
|
Addressed both non-blocking follow-ups in
Validation: @claude review exact head |
Code review (follow-up)Reviewed exact head
No new issues in this delta. The architectural note from earlier still stands (regex narrowing has needed several rounds across Cobra/Cosign/Pulumi/Snyk; a small explicit-state parser would likely scale better as more CLI dialects are onboarded) — repeating it only for visibility, not blocking. Nothing else to flag. |
|
Validated new head a46a2b4 after the multiline Usage parsing fix: CliScraperTraversalTests passed 20/20; OptionsGenerator Release build succeeded with 0 warnings/errors; commit diff check clean. |
a46a2b4 to
d82e48d
Compare
Code reviewReviewed the diff (5 files, regex fixes in Assessment: solid, well-targeted fix. I traced through why each regex change matters rather than taking the PR description at face value:
One reuse suggestion (non-blocking): No correctness or CLAUDE.md-compliance issues found otherwise. The regex changes are narrowly scoped, each is backed by a fixture reproducing the real-world failure it fixes, and the PR's own validation (818/818 OptionsGenerator tests, clean Release build) lines up with what the diff should do. |
|
CI triage: the Ubuntu pipeline failure is an unrelated timeout in RunReportTests.DistributedMasterReconcilesMatchedMetricsPerWorker after 15m30s. The generator changes are outside that test, and the Windows build plus all generator-adjacent checks passed. The workflow still has a queued macOS job, so GitHub does not yet allow rerunning failed jobs; I will rerun the failed job once the run completes. |
|
Workflow is now terminal; re-ran the unrelated Ubuntu timeout once (run 32669378123, attempt 2). No branch mutation. |
Summary
Validation
Fixes #3990
Part of #3996