Skip to content

fix: an output directory is a Directory literal - #598

Merged
vjaganat90 merged 1 commit into
PolusAI:masterfrom
vjaganat90:fix/output-dir-literal
Nov 13, 2026
Merged

vjaganat90 merged 1 commit into
PolusAI:masterfrom
vjaganat90:fix/output-dir-literal

Conversation

@vjaganat90

Copy link
Copy Markdown
Member

Stacked on #596 (test/suite-shrink).

What

  • A tool that writes into a Directory it is given (a writable InitialWorkDirRequirement entry captured back by a Directory output) compiles as its author wrote it. The job names that directory as an empty Directory literal, which the runner creates.
  • One classifier on the resolved view finds these inputs at any depth, for the command line, the Python API, the REST API, real-time analyses and the backends.

Why
The rewrite this deletes made the input a string with a ${…} entry. That failed in every tool without InlineJavascriptRequirement. Inside a subworkflow it also retyped the inner input but not the root's, so cwltool rejected the workflow.

Before and after, for write_dir bound to result.outDir:

# before: the compiled tool
inputs: {outDir: {type: string}}
requirements:
  InitialWorkDirRequirement:
    listing: [{entry: "${ return {\"class\": \"Directory\", \"basename\": inputs['outDir'], \"listing\": []}; }", writable: true}]
# and its job
write_dir~outDir: result.outDir

# after: the compiled tool is the author's
inputs: {outDir: {type: Directory}}
requirements:
  InitialWorkDirRequirement:
    listing: [{entry: $(inputs.outDir), writable: true}]
# and its job
write_dir~outDir: {class: Directory, basename: result.outDir, listing: []}

@vjaganat90
vjaganat90 force-pushed the fix/output-dir-literal branch from 7cf450e to b33455f Compare November 13, 2026 15:32

@darkclad darkclad left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM. Reviewed the delta over #596. One classifier on the resolved view replaces the CWL rewrite, and the tool now compiles as its author wrote it. I checked the Directory literal at the root and at one and two calls down under cwltool, and all three runs create and fill the directory.

A writable output-target tool compiles as its author wrote it; the job
carries an empty Directory literal the runner creates. The string rewrite
it replaces failed without InlineJavascriptRequirement and in subworkflows.
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