Fix v2 config parser dropping profiles from earlier config files (25.10.x)#7249
Open
robsyme wants to merge 1 commit into
Open
Fix v2 config parser dropping profiles from earlier config files (25.10.x)#7249robsyme wants to merge 1 commit into
robsyme wants to merge 1 commit into
Conversation
ConfigParserV2 overwrote its declaredProfiles set on every parse() call, so when ConfigBuilder reuses a single parser instance to parse multiple config files, only the profiles from the last file parsed were retained. A profile declared in an earlier file (e.g. the pipeline nextflow.config) was then reported as "Unknown configuration profile" when a later file (e.g. a launch-directory config) declared none. Accumulate declared profile names across parse() calls instead, matching the behaviour of the v1 parser. Already fixed on the default branch by the larger nextflow-io#6643 ("enable v2 syntax parser by default"); this is the minimal extraction for the 25.10.x line. Signed-off-by: Rob Syme <rob.syme@gmail.com> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On the 25.10.x line, the strict (v2) config parser aborts a run at config-build time with
Unknown configuration profile: '<name>'whenever theprofiles {}block lives in a config file that is not the last one parsed. The legacy (v1) parser handles the same configuration fine.This surfaces on Seqera Platform launches in particular: Platform writes a config into the launch directory (a
tower {}scope, no profiles) which is parsed after the pipeline's ownnextflow.config, so every profile-using pipeline fails under the v2 parser. It reproduces with plainnextflow config/nextflow runagainst two config files;includeConfigis not involved.Root cause
ConfigBuildercreates a singleConfigParserinstance and callsparse()for each config file in order, then validates the requested-profileagainstparser.getDeclaredProfiles()once at the end.ConfigParserV2reassigned itsdeclaredProfilesfield on everyparse()call (declaredProfiles = script.getDeclaredProfiles()), so the field ended up holding only the profiles from the last file parsed. The v1 parser keeps afinalset and adds to it, accumulating across all files.Fix
Initialise
declaredProfilesto an empty set and accumulate withaddAll(...)acrossparse()calls, matching the v1 behaviour. Two lines.This is already fixed on the default branch as part of the larger #6643 ("enable v2 syntax parser by default"), which can't be cherry-picked cleanly onto 25.10.x; this PR is the minimal extraction of just the profile-accumulation fix.
Verification
should accumulate declared profiles across multiple config filesreuses one parser across twoparse()calls (the second declaring no profiles) and asserts the earlier file's profiles are retained.ConfigParserV2Testis unchanged and green.Scope / risk
The only non-test consumer of
getDeclaredProfiles()isConfigBuilder'scheckValidProfilegate, so the blast radius is limited to profile validation. The v2 parser is opt-in on 25.10.x (NXF_SYNTAX_PARSER=v2).