openrewrite / openrewrite/rewrite
JavaSourceSetUpdater in dependency recipes breaks rewrite-spring CI
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
Summary
Since rewrite 8.79.2, the scheduled CI in openrewrite/rewrite-spring has 5 consistently failing tests. The failures started on April 11, immediately after the 8.79.2 release (April 10, 23:25 UTC) was picked up by the latest.integration resolution. The last passing scheduled run was April 10 at 18:40 UTC.
- PR #7358 (shipped in 8.79.3) fixed the
flywayStarterOmitsVersionWhenManagedByParenttest but these 5 failures persist.
Root Cause
- PR #7202 ("Expand star imports in ChangePackage and related recipes") added
JavaSourceSetUpdaterintegration toAddDependency,ChangeDependency,RemoveDependency, andUpgradeDependencyVersionfor both Maven and Gradle. This causes:
- Cycle inflation: Marker updates in cycle 1 trigger unnecessary cycle 2
- Silent recipe failures: Dependency recipes fail to apply changes (ChangeDependency doesn't rename, AddDependency doesn't add)
Failing Tests
| Test | Error |
|---|---|
Boot3UpgradeTest.xmlBindMissing |
"Expected recipe to complete in 1 cycle, but took 2 cycles" |
RenameDeprecatedStartersManagedVersionsTest.renameStarterWithoutVersionWhenDepMgmtPluginPresent |
Starter not renamed — actual output still has spring-boot-starter-web instead of spring-boot-starter-webmvc |
RenameDeprecatedStartersManagedVersionsTest.renameStarterWithVersionWhenDepMgmtPluginAbsent |
Same |
MigrateToModularStartersTest.addFlywayStarterWhenDependencyPresent [flyway-database-postgresql] |
"Expecting actual not to be null" — recipe produced no changes |
MigrateToModularStartersTest.addFlywayStarterWhenDependencyPresent [flyway-mysql] |
Same |
Failing CI Runs
- April 13 scheduled: https://github.com/openrewrite/rewrite-spring/actions/runs/24361499711
- April 12 scheduled: https://github.com/openrewrite/rewrite-spring/actions/runs/24313556406
- April 11 scheduled: https://github.com/openrewrite/rewrite-spring/actions/runs/24288866962
- April 14 PR (with 8.79.3): https://github.com/openrewrite/rewrite-spring/actions/runs/24393073914 (same 5 failures)
Last passing scheduled run (April 10, pre-8.79.2): https://github.com/openrewrite/rewrite-spring/actions/runs/24258414542
Analysis
- The
JavaSourceSetUpdaterchanges in PR #7202 modified the Gradle dependency recipes in three ways:
- Scanner phase: Records
modulesWithOldDependencyandmoduleRepositoriesby scanningGradleProjectconfigurations isAcceptable: Now also acceptsJavaSourceFileinstances so the editing visitor processes Java source filesvisit: For Java source files, callsupdateJavaSourceSet()which downloads JARs and updates type information
The RenameDeprecatedStartersManagedVersionsTest failures are particularly telling: the UpgradeSpringBoot_4_0 recipe chain successfully upgrades the Spring Boot plugin version (from 3.4.1 to 4.0.5), but the subsequent ChangeDependency sub-recipe for renaming spring-boot-starter-web → spring-boot-starter-webmvc silently doesn't fire. This suggests the JavaSourceSetUpdater integration in either UpgradeDependencyVersion or ChangeDependency is interfering with the recipe chain execution.
Affected Files
rewrite-gradle/src/main/java/org/openrewrite/gradle/ChangeDependency.javarewrite-gradle/src/main/java/org/openrewrite/gradle/AddDependency.javarewrite-gradle/src/main/java/org/openrewrite/gradle/UpgradeDependencyVersion.javarewrite-maven/src/main/java/org/openrewrite/maven/utilities/JavaSourceSetUpdater.javarewrite-java/src/main/java/org/openrewrite/java/marker/JavaSourceSet.java
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the five named failures in rewrite-spring, then read JavaSourceSetUpdater.java and the dependency recipe files in rewrite-gradle listed under Affected Files. Trace the scanner, isAcceptable, and visit changes from PR #7202. Done means the five tests pass, dependency changes apply, and no unnecessary second cycle occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100