Warn when 'baseCommand' is a single string with whitespace (#2240)#2292
Open
arimu1 wants to merge 1 commit into
Open
Warn when 'baseCommand' is a single string with whitespace (#2240)#2292arimu1 wants to merge 1 commit into
arimu1 wants to merge 1 commit into
Conversation
…rkflow-language#2240) A CommandLineTool 'baseCommand' given as a single string with internal whitespace (e.g. "tar xf" instead of [tar, xf]) is passed to the OS as one program name, which almost never exists. --validate previously accepted it silently. Emit a warning at construction time pointing at the offending line and suggesting the list form. List- and single-word baseCommands are unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Addresses item 1 of #2240.
A
CommandLineToolbaseCommandwritten as a single string with internal whitespace — e.g.— is interpreted by CWL as one program name (
argv[0] == "tar xf"), not astarplus the argumentxf. Such an executable almost never exists, so the tool fails at run time. Today--validateaccepts this silently:The author almost certainly meant the list form
[tar, xf].Fix
Emit a warning at construction time (so it surfaces under
--validate, before any execution) whenbaseCommandis a single string that splits into more than one whitespace-separated token. The warning points at thebaseCommandsource line and suggests the list form:It is a warning, not an error — the document is still structurally valid CWL, and a single-element command path that legitimately contains a space is technically allowed; this just flags the common mistake. The check lives in
CommandLineTool.__init__and only fires for the single-string form, so:baseCommand: [tar, xf]→ no warningbaseCommand: echo→ no warningbaseCommand(e.g. ExpressionTool/Workflow) → no warningThis intentionally scopes to checkbox 1 of #2240 (warn about a space). Checkbox 2 (actually probing PATH / containers for the executable) is a larger, runtime/container-aware change and is left for a follow-up.
Tests
tests/test_validate.py:test_validate_warns_on_basecommand_with_space— asserts the warning text, the offending value, and the suggested list form are logged (captured via a customlogger_handler, matchingtest_validate_custom_logger), and that exit code is still 0 / "valid CWL".test_validate_no_basecommand_space_warning(parametrized) — list-form and an existing no-baseCommand fixture produce no whitespace warning.Fixtures:
tests/wf/2240-basecommand-space.cwl,tests/wf/2240-basecommand-list.cwl.I verified the warning test fails against the unpatched code (proving it guards the bug, not a no-op). All 9 tests in
tests/test_validate.pypass;black,flake8, andisortare clean on the changed files.This change was produced with the assistance of Claude Code (model: Claude Opus). The diff, root-cause analysis, and tests were reviewed by a human before submission.