Skip to content

docs: say that an Android test run after a branch switch needs --no-build-cache --rerun-tasks - #2458

Merged
ryanbr merged 1 commit into
mainfrom
rb-gradle-docs
Sep 25, 2026
Merged

ryanbr merged 1 commit into
mainfrom
rb-gradle-docs

Conversation

@ryanbr

@ryanbr ryanbr commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Gradle's cache is keyed on inputs it can see, and a branch switch can leave generated sources, Room DAOs and KSP output, from the previous branch in place. The suite then runs against code that is not the code you have checked out, and reports failures in classes your change never touched.

Nothing contributor-facing said so. CONTRIBUTING.md, the pull-request template, AGENTS.md and android/README.md all give the bare ./gradlew testFullDebugUnitTest, and --no-build-cache --rerun-tasks appears in none of them.

Why now

The cost is not hypothetical. Two contributors in two days have filed pull requests containing a paragraph explaining away Android failures as pre-existing on main:

Main is green. The same suite runs 6430 tests with no failures here, and CI has been green throughout. Both contributors spent time on it, then wrote a defence of their own branch into a PR body, for a cache artefact nobody had told them about. Neither was doing anything wrong.

The change

The flags are now in all four places a contributor might look, with the reason rather than only the incantation, and with the specific advice that a failure only you can see is usually this. CI always builds clean, which is why it never shows there.

Docs only. No code, no workflow change.

…uild-cache --rerun-tasks

Gradle's cache is keyed on inputs it can see, and a branch switch can leave generated sources, Room
DAOs and KSP output, from the previous branch in place. The suite then runs against code that is not
the code checked out, and reports failures in classes the contributor never touched.

Nothing contributor-facing said so. CONTRIBUTING, the pull-request template, AGENTS and
android/README all give the bare `./gradlew testFullDebugUnitTest`, and the flags appear in none of
them.

The cost is not hypothetical. Two contributors in two days have filed pull requests containing a
paragraph explaining away Android failures as pre-existing on main: one reported two failures in
RecoveryDriversTest, the other eight across RecoveryDrivers, StandardHrSensorFormat,
StepsDetailIntegration and TodayExplainability, described as "the same failures as untouched
upstream/main". Main is green: the same suite runs 6430 tests with no failures here, and CI has been
green throughout. Both of them spent time on it, then wrote a defence of their own branch into a PR
body, for a cache artefact nobody had told them about.

So it is written in all four places a contributor might look, with the reason rather than only the
incantation, and with the actionable form: re-run clean before concluding a red test is pre-existing
on main.

The docs state the MECHANISM as a possibility and stop there. Whether stale generated sources explain
those particular failures is not established: RecoveryDrivers is pure arithmetic with no Room or KSP
dependency, so a stale DAO is not an obvious cause for it. What is established is that the suite is
green here and in CI, and that the flags are required after a branch switch in this repo. The
permanent docs say only that; the incident belongs in this pull request, where it is the reason for
the change rather than a diagnosis of anyone's environment.
@ryanbr
ryanbr merged commit b412b9b into main Sep 25, 2026
4 checks passed
@ryanbr
ryanbr deleted the rb-gradle-docs branch September 25, 2026 12:36
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