Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bellwether from generated yaml #99

Merged
merged 1 commit into from
Jan 24, 2024
Merged

Remove bellwether from generated yaml #99

merged 1 commit into from
Jan 24, 2024

Conversation

mike-solomon
Copy link
Contributor

@mike-solomon mike-solomon commented Jan 23, 2024

Related to issue: openrewrite/rewrite-docs#250

You can see there is no bellwether in the yaml recipe list generated:

image

@timtebeek
Copy link
Contributor

While this would hide the bellwether (good) is would be better to show the configured precondition in the bellwether. So right now what we show is:

Current

All the issues of the next section + showing internal class bellwether.
image

With this change

No bellwether (good),
no precondition (missed opportunity, it's in the bellwether),
no arguments to AddSpringProperty, (leading to a broken yaml recipe)

type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.EnableVirtualThreads
displayName: Enable Virtual Threads on Java 21
description: Set `spring.threads.virtual.enabled` to `true` in `application.properties` or `application.yml`.
recipeList:
  - org.openrewrite.java.spring.AddSpringProperty

Ideal

As per the source

type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.EnableVirtualThreads
displayName: Enable Virtual Threads on Java 21
description: Set `spring.threads.virtual.enabled` to `true` in `application.properties` or `application.yml`.
preconditions:
  - org.openrewrite.java.search.HasJavaVersion:
      version: 21.X
recipeList:
  - org.openrewrite.java.spring.AddSpringProperty:
      property: spring.threads.virtual.enabled
      value: true

@timtebeek
Copy link
Contributor

This is an improvement already, but still shows broken config to the user in that recipe list tab. We can still merge this already though, but adding that context.

@mike-solomon
Copy link
Contributor Author

Ah I see -- thanks for clarifying again. I'm going to close this PR as it doesn't really do what we want.

@mike-solomon
Copy link
Contributor Author

Agh my bad @timtebeek didn't see your follow up comment before closing haha. I'm gonna poke around with it a bit more first and may reopen if I can't find anything.

@mike-solomon
Copy link
Contributor Author

After stepping through the debugger, I don't believe we currently have access to be able to output the preconditions or see anything beyond what we currently have. It's possible I missed something, but I couldn't find HasJavaVersion anywhere in the EnableVirtualThreads recipe in the debugger.

I think we would need to update rewrite itself and change the RecipeDescriptor class to include a preconditions variable or something.

I'll go ahead and reopen this PR as it feels like it's worthwhile to merge in as is.

@mike-solomon mike-solomon reopened this Jan 23, 2024
Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

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

Agree that this is already an improvement that's worth merging.

@timtebeek timtebeek merged commit 3eefb16 into main Jan 24, 2024
1 check passed
@timtebeek timtebeek deleted the bellweather branch January 24, 2024 12:46
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.

2 participants