feat: add Gradle and Maven support with Surefire parser (75-90% savings)#782
feat: add Gradle and Maven support with Surefire parser (75-90% savings)#782romualdbassinot-efficy wants to merge 4 commits intortk-ai:developfrom
Conversation
Add rtk gradle and rtk mvn commands following the Go sub-enum pattern. - gradle_cmd.rs: test (state machine, 85-90%), build (noise filter, 75-85%), other (passthrough). Auto-detects ./gradlew wrapper vs gradle on PATH. - maven_cmd.rs: test (Surefire parser, 85-90%), compile/package (70-80%), other (passthrough). Strips [INFO] noise, groups failures with stack context. - 22 new unit tests (11 gradle + 11 maven), all passing with savings assertions. - Discover rules: Gradle rewrite rule added, Maven subcmd savings updated. - 8 real-world fixtures from E-deal (Maven) and hub-webservices (Gradle) output formats. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📊 Automated PR Analysis
SummaryAdds Gradle and Maven command support to rtk with output filtering that achieves 75-90% token savings. Includes Gradle wrapper auto-detection, Surefire XML test parser for Maven, discovery rules for both build tools, and comprehensive test fixtures. Review Checklist
Analyzed automatically by wshm · This is an automated analysis, not a human review. |
…support # Conflicts: # CHANGELOG.md
- Reorder [Unreleased] to match develop convention (Bug Fixes before Features) - Remove [0.31.0] section that came from master commits (not relevant for develop PR) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Integrate upstream changes up to v0.33.0-rc.54 - Resolve CHANGELOG conflict: keep [Unreleased] for Gradle/Maven only, move Ruby/cargo entries (already released in 0.33.0-rc.54) to their proper release section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pszymkowiak
left a comment
There was a problem hiding this comment.
Review — Gradle & Maven support
Good work — real fixtures, savings assertions, gradlew auto-detection, sub-enum pattern. A few things to fix before merge.
P0 — Must Fix
1. CHANGELOG rebase conflict
The diff deletes the Ruby feature entries and the ## [0.31.0] section. Looks like a merge artifact — the [Unreleased] block got duplicated and the old one was removed with its surrounding context. Please check that the full changelog history is intact after your upstream merge.
2. TOML filter conflict
src/filters/gradle.toml and src/filters/mvn-build.toml already exist on develop and match the same commands. The Rust modules are strictly better (Surefire parsing, gradlew detection, sub-enum routing), so please delete the two TOML filters to avoid undefined routing behavior.
P1 — Should Fix
3. Vec<Regex> for noise patterns — O(N×M) per line
Both modules define 17-19 separate Regex objects in a Vec, iterated for every output line. Collapse into a single alternation regex (like rspec_cmd.rs does). Not a blocker but measurable on large Maven reactor builds.
4. ^ - noise pattern too broad (gradle_cmd.rs)
This strips any line starting with -, which catches legitimate output beyond the Gradle welcome banner. Narrow to the welcome block context or use a more specific pattern.
5. run_other missing tee integration
Both gradle_cmd::run_other and maven_cmd::run_other skip tee::tee_and_hint() — if the filter produces wrong output for an unsupported subcommand, the raw output is lost with no recovery path. See run_test/run_build for the pattern to follow.
6. Missing test for compile-failure in filter_gradle_test
The total == 0 && !build_errors.is_empty() path in filter_gradle_test is never exercised. Add a test calling filter_gradle_test with the gradle_build_fail_raw.txt fixture.
P2 — Nice to Have
7. mvn verify falls through to Other instead of the Surefire parser — consider adding a Verify subcommand routing to run_test.
8. All fixtures from a single project — a multi-module reactor fixture would strengthen coverage.
Overall solid implementation. Fix P0 #1 and #2, and I'll re-review.
Summary
rtk gradlecommand with sub-commands:build,test,check,dependencies— filtering Gradle output to errors/failures only (75-90% savings)rtk mvncommand with sub-commands:compile,test,package,verify,install,dependency:tree— with Surefire XML parser for structured test failure output (75-90% savings)src/main.rsCommands enum following the Go sub-enum patternCHANGELOG.mdandsrc/discover/rules.rsfor missed-savings detectionTest plan
cargo testpassesrtk gradle buildfilters Gradle build output to errors onlyrtk gradle testshows only failed testsrtk mvn compilefilters Maven compile errorsrtk mvn testuses Surefire XML when available, falls back to text parser🤖 Generated with Claude Code