Support Postcondition in DeclarativeRecipe
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by reading DeclarativeRecipe and the existing Precondition feature to understand how filtering is represented and applied. Define the expected postcondition behavior, including how failed validation discards edits, and identify the tests needed to demonstrate that behavior.
Written by the indexing model from the issue text.
Description
What problem are you trying to solve?
The Precondition feature in DeclarativeRecipe is great for filtering out files that are either unsupported or skipped for some other reasons. However, identifying which files a recipe can or cannot migrate isn’t always straightforward. Even if we define a precondition accurately, we might still encounter issues due to bugs in edit recipes or missing type attribution caused by parsing errors.
In such cases, a Postcondition feature would be extremely helpful. Since I know what the expected end state of the code should be, writing a recipe to validate that state is much more straightforward. If the postcondition is not met, I could simply discard the edits for that file.
Why this is important
Consider a scenario where I’m migrating a package with 1,000 files. If my recipe fails to correctly migrate even 10 of those files, running the build or tests post-migration could fail, halting the entire process. To continue, I’d need to manually fix the issues or update the recipe to handle those cases.
Having a Postcondition would allow me to automatically verify and discard edits in problematic files.
Describe the solution you'd like
A postcondition feature for DeclarativeRecipe similar to Precondition.
Are you interested in [contributing this feature to OpenRewrite]
Yes, but I’d appreciate feedback on this feature request before starting any work.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 571
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
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.
More from openrewrite/rewrite
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
openrewrite/rewrite#8654 ·
-
bug gradle
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
openrewrite/rewrite#7576 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
openrewrite/rewrite#3406 · 8 comments · 1 reaction ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 75/100
openrewrite/rewrite#8879 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 70/100
openrewrite/rewrite#8862 · 1 comment ·
All issues in openrewrite/rewrite
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 1/5 Under an hour Newbie friendliness 94/100
objectionary/hone-maven-plugin#1061 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
spring-projects/spring-modulith#1895 ·