galaxyproject / galaxyproject/gxformat2

Lint with expanded workflows to validate URL/import subworkflows

Open
#162 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14
Forks
7
Avg merge
2h 49m
Merged PRs (30d)
8

Description

## Summary

The linter should support an expanded mode that uses `expanded_format2()` / `expanded_native()` to resolve all `@import` and URL references before linting. This would validate the structure of externally-referenced subworkflows, not just inline ones.

## Context

We're adding recursive linting for inline subworkflows (steps with `run: {class: GalaxyWorkflow, ...}`). This catches structural issues like dangling `outputSource` references in nested workflows.

However, subworkflows can also be referenced via:
- `@import` — relative file path
- URL strings — `http://`, `https://`, TRS URLs
- `$graph` references — `#subworkflow_id`

These are currently opaque to the linter. The normalized models already have `ImportReference` and `str` types for these, and `expanded_format2()` resolves them into inline `ExpandedFormat2` subworkflows.

## Proposed Approach

Add a `lint_format2_expanded()` (or a `--expand` flag to the CLI) that:
1. Calls `expanded_format2(workflow, options)` with a configured `url_resolver` and `workflow_directory`
2. Walks the fully-expanded tree and lints each subworkflow recursively
3. Reports errors with context about which import/URL they came from

## Considerations

- Requires filesystem access for `@import` and network access for URL resolution
- Should be opt-in since it has side effects (network, filesystem)
- `ConversionOptions` already supports `url_resolver` and `workflow_directory`
- `expanded_format2` already handles cycle detection and max depth
- Could integrate with IWC lint tests which already have local workflow files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

Open the contributing guide

Research direction

Start by reading expanded_format2(), ConversionOptions, and the existing recursive linting for inline subworkflows. Trace how IWC lint tests provide local workflow files, then define an opt-in expanded lint path that resolves imports and URLs, lints the expanded tree with source context, and preserves cycle and depth handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.