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
Copy Markdown

@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
@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
Copy Markdown
Author

Nava2 commented Mar 19, 2026

Some gain feedback:

image

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 20, 2026

CLA assistant check
All committers have signed the CLA.

@aeppling
Copy link
Copy Markdown
Contributor

Hey

We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes src/ from a flat layout into subfolders.

No logic changes — only file moves and import path updates.

What you need to do

Rebase your branch on develop when receiving this comment:

git fetch origin && git rebase origin/develop

Git detects renames automatically. If you get import conflicts, update the paths:

use crate::git;        // now: use crate::cmds::git::git;
use crate::tracking;   // now: use crate::core::tracking;
use crate::config;     // now: use crate::core::config;
use crate::init;       // now: use crate::hooks::init;
use crate::gain;       // now: use crate::analytics::gain;

Need help rebasing? Tag @aeppling

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) <noreply@anthropic.com>
Signed-off-by: Kevin Brightwell <kevin.brightwell@faire.com>
@Nava2 Nava2 force-pushed the feat/gradle-config branch from f922de2 to cdcf230 Compare March 26, 2026 19:51
@Nava2
Copy link
Copy Markdown
Author

Nava2 commented Mar 26, 2026

@aeppling rebased and reorganized :)

@osipxd
Copy link
Copy Markdown

osipxd commented Mar 30, 2026

Probably related to #381

@Nava2
Copy link
Copy Markdown
Author

Nava2 commented Mar 30, 2026

@osipxd yes, though we definitely took it a few steps further for more in-depth layout and better reporting :)

@Nava2
Copy link
Copy Markdown
Author

Nava2 commented Mar 31, 2026

@aeppling is there somewhere to collaborate on this better? I know this, like most open source repos are being spammed. We're using this in our background agent infra to great success. I want to make sure it's also in the right style of both for review and for delivery.

:)

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.

5 participants