8000 Skip included names that are not installed components when recreating installed_by by pinin4fjords · Pull Request #4491 · nf-core/tools · GitHub
[go: up one dir, main page]

Skip to content

Skip included names that are not installed components when recreating installed_by - #4491

Open
pinin4fjords wants to merge 3 commits into
nf-core:devfrom
pinin4fjords:fix/ignore-record-includes
Open

pinin4fjords wants to merge 3 commits into
nf-core:devfrom
pinin4fjords:fix/ignore-record-includes

Conversation

@pinin4fjords
@pinin4fjords pinin4fjords commented Oct 2, 2026 •
Copy link
Copy Markdown
Member

Fixes #4490

nf-core pipelines lint crashes with KeyError: 'samtoolsstatsresult' when an installed subworkflow imports a name that is not a process or workflow, such as a record type (typed pipelines, nextflow.enable.types = true; see the record types ADR):

include { SamtoolsStatsResult } from '../../../modules/nf-core/samtools/stats/main'

recreate_dependencies assumes that every name a subworkflow includes is an installed module or subworkflow and looks it up in modules.json. It now skips a name that is not in modules.json, because only installed components are dependencies. The parsing of the includes is unchanged.

The test builds a subworkflow that includes a module, a record type of that module and a function, and checks that installed_by is recreated for the module. Also checked with the reproducer in #4490: nf-core pipelines lint runs to the end.

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated (no documentation describes this)

pinin4fjords and others added 2 commits October 2, 2026 11:20
…rkflow includes

get_components_to_install treated every include from a module path as a module,
so importing a record type (include { SamtoolsStatsResult } from
'../../../modules/nf-core/samtools/stats/main') made pipelines lint fail with a
KeyError. Only names in capitals (processes and workflows) are components.

Fixes nf-core#4490

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@mashehu mashehu left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice, thanks!

@codecov
codecov Bot commented Oct 2, 2026 •
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.41%. Comparing base (9848539) to head (837722e).
⚠️ Report is 21 commits behind head on dev.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@pinin4fjords
Copy link
Copy Markdown
Member Author

hmm, not sure I like the capitalisation check actually- bit fragile? I'll see if I can do better

Comment thread nf_core/components/components_utils.py Outdated
name, link = match.groups()
# Processes and workflows are named in capitals, so another name (a record type, a function)
# is not a component
if not re.fullmatch(r"[A-Z0-9_]+", name):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if not re.fullmatch(r"[A-Z0-9_]+", name):
if not name.isUpper():

is simpler i guess

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What do you think of the modules.json solution in 837722e instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

modules.json isn't a good ground truth, since we often rebuild it on the fly.
Is the problem with checking the capitalization that it is just a convention?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, exactly. We can go back to that if you think it's better though

… installed_by

recreate_dependencies assumed that every name a subworkflow includes is an
installed module or subworkflow, so a record type or a function in an include
made pipelines lint fail with a KeyError. Only the components that are in
modules.json are dependencies; the other names are skipped.

This replaces the earlier check on capital letters in the include name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@pinin4fjords pinin4fjords changed the title Ignore record types and functions when reading the components a subworkflow includes Skip included names that are not installed components when recreating installed_by Oct 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0