Skip to content

Unify nf-lang config scopes with runtime classes#6271

Merged
bentsherman merged 7 commits intomasterfrom
config-scopes
Aug 7, 2025
Merged

Unify nf-lang config scopes with runtime classes#6271
bentsherman merged 7 commits intomasterfrom
config-scopes

Conversation

@bentsherman
Copy link
Member

@bentsherman bentsherman commented Jul 12, 2025

This PR moves the config schema annotations into the runtime so that we don't have to update config options in both places.

Plugin config scopes are now defined in the plugins themselves. Core plugins are typically only loaded when they are actually used (i.e. the awsbatch executor), so when Nextflow validates config at runtime, it will skip validation of core plugin config if the core plugin isn't loaded. This allows the lint command to work the same as before.

I will update the language server to extract this metadata at build-time with a custom Gradle task. For third-party plugins we will need to publish this metadata to the plugin registry, but that can be done later.

I have removed several config options that were undocumented or appeared to be legacy options. We can preserve them if needed. See my comments below.

TODO:

  • Update tests
  • Publish JSON artifact for language server

@bentsherman bentsherman requested review from a team as code owners July 12, 2025 00:35
@netlify
Copy link

netlify bot commented Jul 12, 2025

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit 68355c7
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/6894dc16efb651000878cbb2

Copy link
Collaborator

@christopher-hakkaart christopher-hakkaart left a comment

Choose a reason for hiding this comment

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

Docs look good. No comments.

@bentsherman bentsherman added this to the 25.10 milestone Jul 14, 2025
@bentsherman bentsherman force-pushed the config-scopes branch 3 times, most recently from 824523f to 8ca91ca Compare July 23, 2025 22:07
@bentsherman bentsherman force-pushed the config-scopes branch 2 times, most recently from 61d6cf6 to 963c695 Compare July 28, 2025 18:59
@pditommaso

This comment was marked as resolved.

@bentsherman

This comment was marked as resolved.

@bentsherman
Copy link
Member Author

Tests are passing now and I added a page to the developer docs

I also added the JSON and Markdown renderers. They aren't used by Nextflow itself. The JSON renderer is used by the language server, but it will also be needed by plugins in the future so it makes sense to keep the core logic in Nextflow.

@pditommaso
Copy link
Member

pditommaso commented Aug 6, 2025

Wonder why the config classes need to be specified in the plugin extension files?

@bentsherman
Copy link
Member Author

Because they extend ConfigScope which is an extension point. Then ConfigValidator uses the plugin system to find all config scopes

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
@pditommaso
Copy link
Member

Got it. Could not make sense to use classic Java service loader to avoid to maintain extension.idx files?

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@bentsherman
Copy link
Member Author

I'm fine with using the ServiceLoader if it's something you want to apply to the rest of the codebase, otherwise I would rather stick to the existing system. Maybe the ServiceLoader approach should be investigated separately

@pditommaso
Copy link
Member

My rationale was more that config scope are not strictly plugins, however they may be part of a plugin. Therefore make sense to keep it as it is.

Think several tests are still failing

@bentsherman
Copy link
Member Author

The CI failures are from the plugin registry

@pditommaso
Copy link
Member

let's disable that test(s) temporary

Signed-off-by: Ben Sherman <bentshermann@gmail.com>
@bentsherman bentsherman requested a review from pditommaso August 7, 2025 17:52
Copy link
Member

@pditommaso pditommaso left a comment

Choose a reason for hiding this comment

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

Great job! let's go

@bentsherman bentsherman merged commit bfa67ca into master Aug 7, 2025
23 checks passed
@bentsherman bentsherman deleted the config-scopes branch August 7, 2025 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants