Skip to content

During declarative recipe loading filter out duplicate copies of singleton recipes.#7468

Merged
sambsnyd merged 1 commit intomainfrom
filter-singletons
Apr 24, 2026
Merged

During declarative recipe loading filter out duplicate copies of singleton recipes.#7468
sambsnyd merged 1 commit intomainfrom
filter-singletons

Conversation

@sambsnyd
Copy link
Copy Markdown
Member

@sambsnyd sambsnyd commented Apr 23, 2026

I had proposed something very similar to this before, here: #6560

That didn't get merged because it felt too magical / special case for DeclarativeRecipe to deduplicate as a silent implementation detail. Instead of doing this the first time we decided on creating Singleton.

But with Singleton alone I cannot find a way to guard the scanning phase without breaking ScanningRecipe.generate(). I tried several things. But a common usage for the scanning phase is to verify whether a file already exists, if I skip those then generate() will create files they shouldn't because their scanner was skipped by Singleton.

So I'm resurrecting the declarative recipe duplicate loading skip. This time I'm keying off the presence of Singleton, which explicitly opts-in a recipe to desiring this behavior.

…leton recipes.

I had proposed something very similar to this before, here: #6560

That didn't get merged because it felt too magical / special case for DeclarativeRecipe to deduplicate as a silent implementation detail. Instead of doing this the first time we decided on creating Singleton.

But with Singleton alone I cannot find a way to guard the scanning phase without breaking ScanningRecipe.generate(). I tried several things. But a common usage for scanning recipes is to verify whether a file already exists, if I skip those then generate() recipes will create files they shouldn't because their scanner was skipped by Singleton.

So I'm resurrecting the declarative recipe duplicate loading skip. But this time I'm keying off the presence of Singleton, which explicitly opts-in a recipe to desiring this behavior.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Apr 23, 2026
@sambsnyd sambsnyd merged commit ace0569 into main Apr 24, 2026
1 check passed
@sambsnyd sambsnyd deleted the filter-singletons branch April 24, 2026 01:47
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Apr 24, 2026
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.

1 participant