Skip to content

JavaSourceSetUpdater in dependency recipes breaks rewrite-spring CI #7367

@Jenson3210

Description

@Jenson3210

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.

Root Cause

  1. Cycle inflation: Marker updates in cycle 1 trigger unnecessary cycle 2
  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

Last passing scheduled run (April 10, pre-8.79.2): https://github.com/openrewrite/rewrite-spring/actions/runs/24258414542

Analysis

  1. Scanner phase: Records modulesWithOldDependency and moduleRepositories by scanning GradleProject configurations
  2. isAcceptable: Now also accepts JavaSourceFile instances so the editing visitor processes Java source files
  3. visit: For Java source files, calls updateJavaSourceSet() 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-webspring-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.java
  • rewrite-gradle/src/main/java/org/openrewrite/gradle/AddDependency.java
  • rewrite-gradle/src/main/java/org/openrewrite/gradle/UpgradeDependencyVersion.java
  • rewrite-maven/src/main/java/org/openrewrite/maven/utilities/JavaSourceSetUpdater.java
  • rewrite-java/src/main/java/org/openrewrite/java/marker/JavaSourceSet.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions