Skip to content

Conversation

@sambsnyd
Copy link
Member

@sambsnyd sambsnyd commented Jan 17, 2026

Let's stop spending time executing recipes that shouldn't do anything anyway - because a copy of them earlier in the recipe list already did the work

When initializing DeclarativeRecipe instances, work with a copy of the
uninitialized list rather than modifying the original. This ensures that
when the same recipe instance is initialized in multiple contexts, the
modifications don't corrupt the instance state for other uses.

The fix:
1. Create a copy of the uninitialized list before iteration
2. Remove duplicates from the copy during deduplication
3. Clear the original uninitialized list at the end to mark initialization complete

This preserves recipe instance integrity across multiple initializations.
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Jan 17, 2026
@sambsnyd sambsnyd changed the title no-duplicate-declaratives Deduplicate declarative recipes Jan 17, 2026
@sambsnyd sambsnyd changed the title Deduplicate declarative recipes De-duplicate declarative recipes Jan 17, 2026
Copy link
Member

@jkschneider jkschneider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we please wait until at least Monday. I'm not saying it's wrong but would like to carefully consider. Very much worry about this.

@jkschneider
Copy link
Member

jkschneider commented Jan 18, 2026

One of my initial concerns: it feels pretty wrong to apply this uniquely to DeclarativeRecipe. Like using buildRecipe with a language that has less verbose syntax, I don't think YAML even has much attraction. And yet the same consideration should apply in those situations. Feels like the wrong place to solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

4 participants