Default includeUncommitted/Staged to false (committed-only)#26
Merged
vedanthvdev merged 1 commit intomasterfrom Apr 22, 2026
Merged
Default includeUncommitted/Staged to false (committed-only)#26vedanthvdev merged 1 commit intomasterfrom
vedanthvdev merged 1 commit intomasterfrom
Conversation
…Staged to false The plugin's job is "what tests does *this commit* touch", and the plugin's answer should not depend on what happens to be sitting in the dev's working tree. Previously both includeUncommitted and includeStaged defaulted to true, which meant a local `./gradlew affectedTest` on a given HEAD would select a different test set than CI would on the same HEAD, and two back-to-back runs on the same commit could disagree with each other depending on what was saved or staged in between. The inclusion was also invisible in the summary log, so there was no trail. Flip both conventions to false so the default matches CI semantics exactly (the tree is already clean after checkout there, so the flags were always inert on CI) and two runs on the same commit are deterministic. Adopters who iterate on tests locally and want WIP to seed the diff boundary flip the two knobs back on explicitly in build.gradle — it is a one-line opt-in and the config resolver has always preferred the explicit value over the convention, so no migration is required for anyone who was already setting these. Flips apply at both layers so programmatic Java callers and Gradle callers land in the same place: AffectedTestsPlugin conventions are false, and the core AffectedTestsConfig.Builder initialises both fields to false. Javadoc on the extension and task properties, the README configuration section, and the CHANGELOG all carry the new default and the rationale so operators who only read the docs still find a committed-only story. A matching "Changed — behaviour flip" callout in the CHANGELOG will surface on the GitHub release notes automatically.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
includeUncommitted/includeStageddefaults fromtrue→falseat both layers (plugin convention + coreAffectedTestsConfig.Builder), so a local./gradlew affectedTeston a given HEAD selects the same tests CI will on the same HEAD.AffectedTestsExtension/AffectedTestTask, the README configuration block, and the CHANGELOG "Unreleased" section with a clear behaviour-change callout.assertTrue(...)toassertFalse(...)with comments pointing at the rationale; everything else (AffectedTestsConfigTest,AffectedTestsPluginTest, engine/git tests) still passes unchanged.Why
Every MR adopter who deploys the plugin to CI immediately overrides both flags to
false. The default didn't match the shipping environment, and worse: on a local dev machine the inclusion was silent — nothing in the summary log or--explainoutput said "by the way, I've also added your unstaged edits". Two runs on the same commit could pick different tests based on whether a file was saved in between. The CI-safe default is the determinism-friendly default; adopters who iterate on tests locally and want WIP to seed the diff flip the two knobs back on with a one-line opt-in.Behaviour-change callout (for release notes)
Before: zero-config users got
includeUncommitted = includeStaged = true. Unstaged local edits silently expanded the diff.After: zero-config users get committed-only. Local runs match CI runs on the same HEAD, byte-for-byte, in which tests get selected.
Migration: if you were explicitly setting either knob, no action. If you relied on the
truedefault and want it back for local iteration, flip them back on inbuild.gradle:```groovy
affectedTests {
includeUncommitted = true
includeStaged = true
}
```
Test plan
./gradlew check— core + gradle + functional all greenAffectedTestsConfigTest.defaultsAreApplied()asserts the newfalsedefaultAffectedTestsPluginTest.extensionHasDefaults()asserts the newfalsedefault at the Gradle convention layertruedefault — verified by running the full suite after the flip