Skip to content

Fix resolve_local returning CWD-anchored URI for commonwl share lookups - #2325

Open
Dev9269 wants to merge 1 commit into
common-workflow-language:mainfrom
Dev9269:fix-cwltool-resolver
Open

Fix resolve_local returning CWD-anchored URI for commonwl share lookups#2325
Dev9269 wants to merge 1 commit into
common-workflow-language:mainfrom
Dev9269:fix-cwltool-resolver

Conversation

@Dev9269

@Dev9269 Dev9269 commented Aug 4, 2026

Copy link
Copy Markdown

Summary

resolve_local searched the XDG_DATA_HOME/commonwl share directories for a tool, found it, but returned Path(uri).as_uri() — a URI anchored to the current working directory instead of the found file. For relative URIs this raised ValueError: relative path can't be expressed as a file URI; for absolute URIs it pointed at the wrong (nonexistent) file. It also silently dropped #fragment references, and the raw uri (fragments included) was embedded in the share path so fragment lookups never matched.

Fix

  • Return the URI of the actually-found share file, using is_file() instead of os.path.exists().
  • Defrag the uri before building share paths, then append #fragment to the result like the direct-file branch does.
  • Added the missing .cwl-extension branch's fragment handling.

Tests

New tests/test_resolver.py with 3 tests (share lookup, fragment preservation, implicit .cwl extension). All crash/return-wrong-value on the old code.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.55%. Comparing base (b4c828c) to head (8257cd4).

Files with missing lines Patch % Lines
cwltool/resolver.py 81.81% 1 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (b4c828c) and HEAD (8257cd4). Click for more details.

HEAD has 5 uploads less than BASE
Flag BASE (b4c828c) HEAD (8257cd4)
16 11
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2325      +/-   ##
==========================================
- Coverage   85.01%   77.55%   -7.46%     
==========================================
  Files          46       46              
  Lines        8621     8627       +6     
  Branches     2020     2022       +2     
==========================================
- Hits         7329     6691     -638     
- Misses        817     1409     +592     
- Partials      475      527      +52     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant