Skip to content

Default includeUncommitted/Staged to false (committed-only)#26

Merged
vedanthvdev merged 1 commit intomasterfrom
chore/default-git-mode-to-committed-only
Apr 22, 2026
Merged

Default includeUncommitted/Staged to false (committed-only)#26
vedanthvdev merged 1 commit intomasterfrom
chore/default-git-mode-to-committed-only

Conversation

@vedanthvdev
Copy link
Copy Markdown
Owner

Summary

  • Flip includeUncommitted / includeStaged defaults from truefalse at both layers (plugin convention + core AffectedTestsConfig.Builder), so a local ./gradlew affectedTest on a given HEAD selects the same tests CI will on the same HEAD.
  • Update javadoc on AffectedTestsExtension / AffectedTestTask, the README configuration block, and the CHANGELOG "Unreleased" section with a clear behaviour-change callout.
  • Existing explicit-default tests were updated from assertTrue(...) to assertFalse(...) 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 --explain output 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 true default and want it back for local iteration, flip them back on in build.gradle:

```groovy
affectedTests {
includeUncommitted = true
includeStaged = true
}
```

Test plan

  • ./gradlew check — core + gradle + functional all green
  • AffectedTestsConfigTest.defaultsAreApplied() asserts the new false default
  • AffectedTestsPluginTest.extensionHasDefaults() asserts the new false default at the Gradle convention layer
  • No other tests depend on the old true default — verified by running the full suite after the flip

…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.
@vedanthvdev vedanthvdev merged commit ee45b97 into master Apr 22, 2026
1 check passed
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