You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Gradle --global-prefix e2e tests pass without --global-prefix: the harness always sets GRADLE_USER_HOME, and no test asserts gradle_user_home_differs fires #1982
[agent] Filed by the scheduled architecture audit (audit-cli-tests). Register: register.
Kind: bug (fake tests). Register ID: T67.
Problem
Two Gradle tests claim to prove --global-prefix behavior, but the harness makes the flag irrelevant to their assertions.
e2e_gradle_discovery_build.rs.global_prefix_scan_says_nothing_about_the_user_home`` asserts that gradle_user_home_differs is absent. The warning can't appear in this harness, because:
the scan goes through jvm_env::isolate_cli, which always sets GRADLE_USER_HOME (jvm_env.rs L106-L109);
the core check returns None whenever GRADLE_USER_HOME is set (gradle_cache.rs L551-L566).```
Executed on cbbbdb9 with a scratch build, running scan --json in a Gradle project with HOME ≠ passwd home:
Case
warnings[] codes
GRADLE_USER_HOME unset
["gradle_user_home_differs"]
GRADLE_USER_HOME set (the harness)
[]
--global-prefix, GRADLE_USER_HOME unset
[]
So the assertion holds whether or not --global-prefix suppresses the warning. The suite's scan doc at L111 says None means "no GRADLE_USER_HOME", which is false. No CLI test anywhere asserts that gradle_user_home_differs fires.
e2e_gradle_agent_build.rs.gradle_agent_global_prefix runs through socket(), which sets GRADLE_USER_HOME to the same cache (L333).````` A plain apply --offline already patches that cache (L468), so a CLI that ignored `--global-prefix` would still pass. This one comes from reading the code and was not executed.
Proposed change
For the discovery test:
Remove GRADLE_USER_HOME after prepare_command.
Add a positive control: the same scan without --global-prefix asserts gradle_user_home_differs is present.
Then assert it is absent with the flag.
Fix the L111 doc.
For the agent test:
Remove GRADLE_USER_HOME, or point it at an empty dir, so only --global-prefix names the cache.
Assert the jar is patched there and untouched under the default home.
Size
2 test files. About +30/−10 lines.
Acceptance criteria
Each test fails when --global-prefix handling is stubbed out. Show this once by mutation in the PR description.
[agent] Triaged: priority:p3 (Gradle test coverage). Confirmed on main: jvm_env::isolate_cli always sets GRADLE_USER_HOME (tests/common/jvm_env.rs L109), so the --global-prefix assertion can't distinguish the flag. No open or merged PR addresses it.
jvm_env::isolate_cli always sets GRADLE_USER_HOME, so the harness only ever runs the second form.
The two agent tests pass without the flag because their socket() / run() helpers set GRADLE_USER_HOME to the very cache the prefix names: project discovery patches it either way. So no CLI test fails when apply, vex or rollback ignore --global-prefix for a Gradle cache. scan --global-prefix is covered: the discovery suite's queried assertions need the flag, because the harness's GRADLE_USER_HOME there points at an empty stand-in.
The fix proposed above still fits. For the two agent tests: run the three commands with GRADLE_USER_HOME pointing at an empty directory, so only the prefix names the cache. All three files are test code.
[agent] Claiming this for the architecture refactor routine. Branch: arch-refactor/1982-gradle-global-prefix-tests.
Re-run on main at cfc870f: with the Maven crawler changed to ignore --global-prefix for JVM caches, gradle_agent_cli::global_prefix_apply_vex_rollback and e2e_gradle_agent_build::gradle_agent_global_prefix (real Gradle 8.14.3) still pass. With scan changed to emit gradle_user_home_differs under --global-prefix, e2e_gradle_discovery_build::global_prefix_scan_says_nothing_about_the_user_home still passes.
Activity
mikolalysenko commentedon Nov 2, 2026
[agent] Triaged: priority:p3 (Gradle test coverage). Confirmed on main:
jvm_env::isolate_clialways setsGRADLE_USER_HOME(tests/common/jvm_env.rs L109), so the --global-prefix assertion can't distinguish the flag. No open or merged PR addresses it.Generated by Claude Code
mikolalysenko commentedon Nov 25, 2026
[agent] Checked on
mainatda012afby the architecture refactor routine: both claims hold, and a third test has the same gap.e2e_gradle_discovery_build::global_prefix_scan_says_nothing_about_the_user_homescan/mod.rs,--global-prefixno longer suppressesgradle_user_home_differs(the!prefixed &&guard removed)e2e_gradle_agent_build::gradle_agent_global_prefix(real Gradle 8.14.3, JDK 21)--global-prefix <p>dropped from theapply,vexandrollbackcallsgradle_agent_cli::global_prefix_apply_vex_rollback(fabricated cache, runs on every platform; not named in this issue)For the first row I checked that the mutated binary is broken, outside the harness:
jvm_env::isolate_clialways setsGRADLE_USER_HOME, so the harness only ever runs the second form.The two agent tests pass without the flag because their
socket()/run()helpers setGRADLE_USER_HOMEto the very cache the prefix names: project discovery patches it either way. So no CLI test fails whenapply,vexorrollbackignore--global-prefixfor a Gradle cache.scan --global-prefixis covered: the discovery suite'squeriedassertions need the flag, because the harness'sGRADLE_USER_HOMEthere points at an empty stand-in.The fix proposed above still fits. For the two agent tests: run the three commands with
GRADLE_USER_HOMEpointing at an empty directory, so only the prefix names the cache. All three files are test code.Generated by Claude Code
refactor: #2253, #2254 filed; #1982 confirmed
mikolalysenko commentedon Nov 26, 2026
[agent] Claiming this for the architecture refactor routine. Branch: arch-refactor/1982-gradle-global-prefix-tests.
Re-run on
mainatcfc870f: with the Maven crawler changed to ignore--global-prefixfor JVM caches,gradle_agent_cli::global_prefix_apply_vex_rollbackande2e_gradle_agent_build::gradle_agent_global_prefix(real Gradle 8.14.3) still pass. Withscanchanged to emitgradle_user_home_differsunder--global-prefix,e2e_gradle_discovery_build::global_prefix_scan_says_nothing_about_the_user_homestill passes.Generated by Claude Code
Make Gradle global-prefix tests need the flag
Say why the control apply found nothing
refactor: #2267 ready for #1982; L25 filed as #2271