Skip to content

Make AddProfile idempotent#7356

Merged
timtebeek merged 1 commit intomainfrom
tim/fix-yaml-sequence-7355
Apr 12, 2026
Merged

Make AddProfile idempotent#7356
timtebeek merged 1 commit intomainfrom
tim/fix-yaml-sequence-7355

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented Apr 12, 2026

Summary

AddProfile unconditionally removed and re-added a profile with the same id on every recipe cycle, even when the existing profile already matched. This uses SemanticallyEqual to compare the existing profile to the desired one and returns early when they already match, making the recipe idempotent.

Changes

  • Build the desired profile tag before checking for an existing one
  • Compare existing profile using SemanticallyEqual.areEqual() and skip modification when content matches
  • Remove expectedCyclesThatMakeChanges(2) workaround from all tests
  • Add preExistingIdenticalProfile test verifying no changes when profile already matches

AddProfile unconditionally removed and re-added a profile with the same
id on every recipe cycle. Use SemanticallyEqual to compare the existing
profile to the desired one and return early when they already match.
@timtebeek
Copy link
Copy Markdown
Member Author

@timtebeek timtebeek merged commit 245278a into main Apr 12, 2026
1 check passed
@timtebeek timtebeek deleted the tim/fix-yaml-sequence-7355 branch April 12, 2026 20:03
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Apr 12, 2026
timtebeek added a commit to openrewrite/rewrite-spring-to-quarkus that referenced this pull request Apr 12, 2026
AddProfile is now idempotent (openrewrite/rewrite#7356), so tests can
use the default single cycle. Also restore the idempotency test to
verify no changes when profiles already exist.
timtebeek added a commit to openrewrite/rewrite-spring-to-quarkus that referenced this pull request Apr 12, 2026
* Fix AddProfile generating malformed XML structure (Issue #68)

The AddProfile recipe expects wrapping elements (<activation>, <properties>)
in its parameters, but the YAML was passing only inner content. Added the
wrapping elements so the generated profile XML is valid.

Also enabled the previously @disabled test and added a test for
ConfigureNativeBuild.

* Remove expectedCyclesThatMakeChanges workaround

AddProfile is now idempotent (openrewrite/rewrite#7356), so tests can
use the default single cycle. Also restore the idempotency test to
verify no changes when profiles already exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

AddProfile is not idempotent: removes and re-adds profile every cycle

1 participant