Skip to content

fix(gradle): match normalized gradlew/gradle basename lookups (#1177, #1178)#2482

Open
ousamabenyounes wants to merge 1 commit into
rtk-ai:developfrom
ousamabenyounes:fix/gradle-1177
Open

fix(gradle): match normalized gradlew/gradle basename lookups (#1177, #1178)#2482
ousamabenyounes wants to merge 1 commit into
rtk-ai:developfrom
ousamabenyounes:fix/gradle-1177

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

Fixes #1177. Fixes #1178.

RTK normalises command lookups by stripping a leading ./ and using the basename, so rtk ./gradlew tasks becomes the lookup string "gradlew tasks" (not "./gradlew tasks"). The gradle filter's match_command never matched that basename form, so every real rtk ./gradlew / rtk gradle invocation fell through to passthrough — keeping the generic Gradle runtime chatter that isn't build signal (#1178).

Fix

  • Update src/filters/gradle.toml match_command to match the normalised basename lookups (gradlew …, gradle …).
  • Add a Rust regression test (test_gradle_filter_matches_normalized_lookup) that builds the real BUILTIN_TOML filter set and asserts the gradle filter matches the exact strings RTK produces at runtime, plus inline [[tests.gradle]] cases.

Test verification (RED → GREEN)

RED — gradle.toml reverted to develop:

test core::toml_filter::tests::test_gradle_filter_matches_normalized_lookup ... FAILED
test result: FAILED. 0 passed; 1 failed

GREEN — with the basename match fix:

test core::toml_filter::tests::test_gradle_filter_matches_normalized_lookup ... ok
test result: ok. 66 passed; 0 failed

(Re-proposes the accidentally-closed #1193, rebased onto current develop.)

The `match_command` regex `^(gradle|gradlew|\\./)gradlew?\b` only
matched `./gradlew …` (the literal-path form), never the normalised
basename string that RTK actually looks up at runtime.  When a user
runs `rtk ./gradlew tasks`, RTK strips the leading `./` and looks up
`"gradlew tasks"` — which the old regex never matched, so every
Gradle invocation fell through to unfiltered passthrough.

Fix: replace with `^gradlew?\b` which matches both `gradle …` and
`gradlew …` as produced by RTK's basename normalisation.

Also strip three common configuration-cache noise lines that are not
build signal (fixes rtk-ai#1178):
  - `Calculating task graph …`
  - `Reusing configuration cache.`
  - `Configuration cache entry stored/reused.`

Add two inline filter tests and a unit test that asserts the filter
is discoverable via the normalised lookup string (regression guard
for rtk-ai#1177).

Closes rtk-ai#1177, closes rtk-ai#1178

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant