Skip to content

Lint duplicate step labels as errors - #268

Merged
jmchilton merged 3 commits into
galaxyproject:mainfrom
mvdbeek:lint-duplicate-step-labels
Oct 20, 2026
Merged

jmchilton merged 3 commits into
galaxyproject:mainfrom
mvdbeek:lint-duplicate-step-labels

Conversation

@mvdbeek

@mvdbeek mvdbeek commented Oct 17, 2026

Copy link
Copy Markdown
Member

Galaxy rejects a workflow at import when two of its steps share a label, and that includes input steps:

400: Duplicated step label 'Strip version from reference sequence ids' in request.  (err_code 400011)

Neither lint_ga nor lint_format2 checked for this. As a result, planemo workflow_lint --iwc --fail_level error passed galaxyproject/iwc#310, where a parameter_input and a tp_sed_tool step had the same label, and CI only failed once Galaxy was running.

Change

  • New structural lint rule StepLabelNotUnique, an error added to the structural profile. It mirrors Galaxy's check in lib/galaxy/managers/workflows.py:

    • labels must be unique within one workflow level, inputs included;
    • each subworkflow has its own namespace;
    • empty or missing labels are ignored;
    • comparison is exact-string.

    The message lists every occurrence, e.g. Duplicated step label 'X' (step 15, step 16). Native errors carry json_pointer /steps/<key>/label.

  • Format2 gets the same check. It catches three cases:

    • an input and a step with the same key;
    • repeated label: in list-form steps;
    • repeated input ids.

    To avoid false positives or misses, the lint reuses the labelling that conversion applies. _step_label and the input-label logic from _build_input_step are now shared as native_step_label and native_input_label. This also covers the Input N fallback and the _unlabeled_* sentinels.

Tests

Declarative cases in lint_native.yml and lint_format2.yml, with new fixtures:

  • Should error:
    • an input and a tool step share a label (the IWC #310 shape);
    • a duplicate inside a subworkflow;
    • Format2: an input/step key clash;
    • Format2: repeated labels in list-form steps.
  • Should not error:
    • the same label in a parent workflow and its subworkflow;
    • several steps with null, empty or missing labels.

The four positive cases fail without the lint change.

Checks

  • Test suite: passes with GXFORMAT2_TEST_IWC_DIRECTORY set, 1895 tests.
  • IWC corpus: none of the 126 currently merged IWC .ga workflows trip the new rule, natively or after conversion to Format2.
  • Repro: the bad revision from iwc#310 now reports Duplicated step label 'Strip version from reference sequence ids' (step 15, step 16). The fixed revision lints clean.

Not included (open for discussion)

  • Duplicate workflow-output labels. Galaxy only emits an upgrade message for these ("Ignoring duplicate labels: ...") and still imports the workflow. They are not an import error, so I left them out rather than make them a lint error. A warning-level rule could be a follow-up.

Follow-up

For IWC CI to benefit, this needs a gxformat2 release and a planemo release that picks it up.

Galaxy refuses to import a workflow whose steps (inputs included) share a
label ("Duplicated step label ... in request."), but neither lint_ga nor
lint_format2 checked for it, so planemo workflow_lint passed workflows that
then failed at import (galaxyproject/iwc#310).

Add a StepLabelNotUnique structural rule, checked per workflow level like
Galaxy (subworkflows have their own namespace, empty labels ignored). The
Format2 check uses the same label helpers as conversion, now shared as
native_input_label / native_step_label, so it flags exactly the native
labels Galaxy would see.
@codecov

codecov Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.45%. Comparing base (28273b0) to head (9548c45).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #268   +/-   ##
=======================================
  Coverage   42.45%   42.45%           
=======================================
  Files          51       51           
  Lines        1974     1974           
  Branches      441      441           
=======================================
  Hits          838      838           
  Misses       1102     1102           
  Partials       34       34           
Flag Coverage Δ
unittests 42.45% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

jmchilton and others added 2 commits October 19, 2026 15:46
Recurse native lint with a child context so subworkflow pointers carry
the /steps/<key>/subworkflow prefix (also fixes NativeStepKeyNotInteger).
Assert exact message and pointer for the nested case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add fixtures for an id-less input defaulting to 'Input 0' clashing with
a step, duplicates inside an inline subworkflow, and a label reused
across levels. Assert exact messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jmchilton
jmchilton merged commit 2368915 into galaxyproject:main Oct 20, 2026
13 checks passed
jmchilton pushed a commit to jmchilton/galaxy-tool-util-ts that referenced this pull request Oct 20, 2026
Port gxformat2's StepLabelNotUnique rule (galaxyproject/gxformat2#268).
Galaxy refuses to import a workflow whose steps (inputs included) share a
label. Native lint checks each workflow level's step labels; Format2 lint
checks the native labels conversion assigns, via nativeInputLabel /
nativeStepLabel now shared with toNative.

Fixtures, lint_native/lint_format2 expectations and lint_profiles.yml
synced from the gxformat2 PR branch.
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