Skip to content

feat(gradle): Start implementing Gradle filter module with task-type detection#709

Open
Nava2 wants to merge 1 commit intortk-ai:developfrom
Faire:feat/gradle-config
Open

feat(gradle): Start implementing Gradle filter module with task-type detection#709
Nava2 wants to merge 1 commit intortk-ai:developfrom
Faire:feat/gradle-config

Conversation

@Nava2
Copy link

@Nava2 Nava2 commented Mar 18, 2026

Overview

This PR series adds a Rust-native Gradle filter module that replaces the existing src/filters/gradle.toml TOML filter (~60% savings) with 85-99% token savings through task-type detection, stack trace intelligence, and batch processing.

Tested on Faire's production Gradle monorepo. Upstreamed from Faire's fork where it has been in use since January 2026.

Value over existing gradle.toml

The upstream TOML filter does basic noise stripping. This Rust module adds:

  • Task-type detection (compile, test, detekt, health, proto, deps) with per-type filtering strategies
  • Stack trace intelligence — keeps user frames + first assertion frame, drops framework noise (configurable via drop_frame_packages)
  • Batch processing — splits multi-task output by > Task boundaries, applies per-section filters
  • Path normalization — converts absolute paths to repo-relative
  • Configurableuser_packages, extra_drop_patterns, drop_frame_packages via config.toml or .rtk.toml

Token Savings

Filter Savings Strategy
Global noise 70-90% RegexSet (37 patterns), Try-block removal, ANSI stripping
Compile 85%+ Drop kapt/KSP noise, normalize paths (RegexSet)
Test 90%+ Drop passing tests, truncate stack traces
Detekt 85%+ Group violations by rule (RegexSet)
Health 80% Passthrough (already concise after global)
Proto 75%+ Drop extraction noise
Deps 40%+ Truncate dependency tree to depth 0-1
Batch 95%+ Per-task routing on multi-task runs

Staging PRs (internal review)

Each filter is a separate PR for focused review in Faire/rtk:

# PR Scope Savings
3a #23 GradleConfig struct
3b-i #33 Global noise filters + path normalization + insta dep 70-90%
3b-ii #34 Command routing + task-type detection
3c #35 Compile filter 85%+
3d #36 Test filter 90%+
3e #37 Detekt filter 85%+
3f #38 Health filter 80%
3g #39 Proto filter 75%+
3h #40 Deps filter 40%+
3i #41 Batch processing 95%+
3j #42 Discover rule + retire TOML

Performance

  • All noise pattern matching uses RegexSet for single-pass matching (global: 37 patterns, compile: 4, detekt: 3)
  • Zero async — single-threaded, no tokio
  • All regexes compiled once via lazy_static!

Open Questions

  1. New dev-dependency: insta 1.46 for snapshot testing. Is this acceptable? Dev-only (not in release binary). Used for 16 snapshot files validating filter output format.

Size

~2,800 lines code + 13 fixtures + 16 snapshots (across 10 Rust files)

🤖 Generated with Claude Code

@Nava2 Nava2 closed this Mar 18, 2026
@Nava2 Nava2 reopened this Mar 18, 2026
@Nava2 Nava2 changed the title feat(config): add GradleConfig for gradle filter settings feat(gradle): Rust-native filter module with task-type detection Mar 18, 2026
Add GradleConfig struct with user_packages, extra_drop_patterns, and
drop_frame_packages for configurable gradle output filtering.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: Kevin Brightwell <[email protected]>
@Nava2 Nava2 force-pushed the feat/gradle-config branch from dcc8777 to f922de2 Compare March 18, 2026 20:38
@Nava2 Nava2 changed the title feat(gradle): Rust-native filter module with task-type detection feat(gradle): Start implementing Gradle filter module with task-type detection Mar 18, 2026
@Nava2 Nava2 marked this pull request as ready for review March 19, 2026 00:12
@Nava2
Copy link
Author

Nava2 commented Mar 19, 2026

Some gain feedback:

image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant