Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix staging of Path fields of included record types#7226

Merged
bentsherman merged 3 commits into
masterfrom
fix-record-include-staging
Jun 12, 2026
Merged

Fix staging of Path fields of included record types#7226
bentsherman merged 3 commits into
masterfrom
fix-record-include-staging

Conversation

@robsyme

@robsyme robsyme commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Fixes #7225

Problem

When a typed process (nextflow.enable.types = true) declares an input whose type is a record included from another module file, the implicit stageAs directives for the record's Path fields are not generated. The fields are interpolated into .command.sh as raw source paths instead of staged paths. On a shared local filesystem the raw path still resolves, which masks the bug, but on an object-store work dir (e.g. Fusion/S3) the task fails with No such file or directory.

Isolating the variables with the reproducer shows the trigger is the record type being included from a separate file (the nextflow.enable.moduleBinaries flag suspected in the original report is unrelated):

Record definition Field staged?
included from types.nf no — raw source path
inline in main.nf yes — TaskPath

Cause

ScriptCompiler performs resolution and Groovy conversion per source file, and the entry script is analyzed before the modules it includes. When ProcessToGroovyVisitorV2 inspects a record input to infer the implicit file inputs, the included record node is found (isRecordType is true) but its field types are still unresolved ClassNodes, so isPathType returns false and no stager is generated for the Path fields. The unstaged field then bypasses the staged-path substitution in TaskInputResolver.normalizeValue and reaches the task script as a raw source path.

Solution

  • ModuleResolver now records the include dependencies of each source file, returning existing source units on repeat encounters so the dependency graph is complete.
  • ScriptCompiler analyzes each source file only after the modules it includes from, so included types are fully resolved before they are used. Guards handle include cycles and unparseable modules.

Verification

  • New unit test ScriptLoaderV2Test."should stage path fields of an included record type" fails before the change (0 file inputs generated) and passes after (2 file inputs).
  • The issue reproducer (https://github.com/robsyme/nf-record-fusion-repro) now renders the record fields as staged TaskPath names instead of raw paths.
  • Transitive includes (process in module A consuming a record included from module B) also stage correctly.
  • Circular includes still fail with a StackOverflowError, but this is pre-existing behavior at runtime module loading (IncludeDef.loadModuleV2), unchanged by this PR.

🤖 Generated with Claude Code

When a typed process declares an input whose type is a record imported
from another module, the implicit stageAs directives for the record's
Path fields were not generated, so the fields were interpolated into
the task script as raw source paths instead of staged paths. On a
shared local filesystem the raw path still resolves, masking the bug,
but on an object-store work dir (e.g. Fusion/S3) the task fails with
'No such file or directory'.

The cause is the per-source analysis order in the script compiler:
the entry script was resolved and converted to Groovy before the
modules it includes, so the field types of an included record were
still unresolved ClassNodes when ProcessToGroovyVisitorV2 inspected
them to infer the implicit file inputs, and the Path fields were not
recognized as such.

Fix by tracking the include dependencies of each source file during
module resolution and analyzing each source only after the modules it
includes from, so that included types are fully resolved before they
are used.

Note: issue #7225 attributes the failure to the moduleBinaries feature
flag, but the actual trigger is the record type being included from a
separate module file; the flag is unrelated.

Co-Authored-By: Claude Fable 5 <[email protected]>
Signed-off-by: Rob Syme <[email protected]>
@robsyme robsyme requested a review from a team as a code owner June 11, 2026 23:33
@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploy Preview for nextflow-docs-staging ready!

Name Link
🔨 Latest commit 145fcae
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/6a2c67512dac4000070f16c2
😎 Deploy Preview https://deploy-preview-7226--nextflow-docs-staging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bentsherman

Copy link
Copy Markdown
Member

Thanks for the issue and PR

I kept your test case and tried to find a simpler and more general solution -- all scripts should be "analyzed" before any script is converted to Groovy

It was enough to fix your test case, let's see if doesn't break anything else...

Signed-off-by: Ben Sherman <[email protected]>
@bentsherman bentsherman force-pushed the fix-record-include-staging branch from ec7be43 to b8025ad Compare June 12, 2026 20:08
@bentsherman bentsherman merged commit 72ab749 into master Jun 12, 2026
25 checks passed
@bentsherman bentsherman deleted the fix-record-include-staging branch June 12, 2026 21:10
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.

Record Path fields are not staged when the record type is included from another module

2 participants