Skip to content

[26.1] Fix Workflow.copy() dropping readme, help, logo_url and doi#23117

Merged
mvdbeek merged 1 commit into
galaxyproject:release_26.1from
mvdbeek:workflow-copy-drops-readme
Jul 15, 2026
Merged

[26.1] Fix Workflow.copy() dropping readme, help, logo_url and doi#23117
mvdbeek merged 1 commit into
galaxyproject:release_26.1from
mvdbeek:workflow-copy-drops-readme

Conversation

@mvdbeek

@mvdbeek mvdbeek commented Jul 15, 2026

Copy link
Copy Markdown
Member

readme, help, logo_url and doi were added to the workflow table in 25.0 (57cf7d38d53, e886353b90a, migration 71eeb8d91f92), but Workflow.copy() was never updated to copy them. Every operation that copies a workflow silently destroys them.

Export is guarded by if workflow.readme is not None, so the metadata doesn't come back as null — the key is absent from the exported .ga entirely, which is what makes this look like an export bug. It isn't: import, export, editor and API paths all handle readme correctly.

Affected paths

  • Rename-only update (lib/galaxy/webapps/galaxy/api/workflows.py:466) — name_updated and not steps_updated copies the workflow into a new revision, so renaming a workflow destroys its readme.
  • _import_shared_workflow (lib/galaxy/webapps/base/controller.py:626) — reached via /workflow/imp?id= and POST /api/workflows {shared_workflow_id}.
  • Subworkflow copy during shared import.

Reported against an IWC workflow with a 7398-character readme on usegalaxy.eu (galaxyproject/iwc#1234). The uuid changing across the round-trip pins the cause to copy() rather than to export, and the survival pattern is a fingerprint: everything copy() handles survived, only the fields it omits vanished.

On source_metadata

Still deliberately not copied. It records where this exact content was fetched from and is already dropped whenever a workflow is modified (test_trs_import asserts this, and the comment at test_workflows.py:1484 calls it out as intentional). Copying it would also change get_workflow_by_trs_id_and_version, which matches on latest_workflow.source_metadata.

Worth noting separately: because source_metadata isn't copied, renaming a TRS-imported workflow still breaks its TRS dedup lookup. That's arguably its own bug, but it's a behavioral change I didn't fold into this fix.

Tests

copy() has regressed this way three times now — 470baa59216 added license + creator_metadata, bbbe7f2182c added reports_config — because the assignments are hand-maintained. The new unit test therefore drives its assertions off Workflow.__table__.columns minus an explicitly annotated not_copied set, so a column added by a later migration trips "<column> is not covered by this test" and has to be classified rather than silently dropped.

  • test_workflow_copy_preserves_metadata (unit) — verified to fail on an unmodified tree (AssertionError: help / assert None == 'Some help text') and pass with the fix. I also deleted the doi assignment with the fix otherwise in place to confirm the guard catches exactly the recurrence mode.
  • test_update_name (API) — extended; it already covered license for precisely this reason.
  • test_import_published_preserves_metadata (API) — new, covers the shared-import path.

The existing suite is not evidence here: test_update_name passed the whole time the bug was live, which is how this regressed.

Bug dates to 25.0 — worth checking whether 25.0/26.0 are still supported and need this too.

These columns were added to the workflow table in 25.0 (57cf7d3,
e886353, migration 71eeb8d91f92), but Workflow.copy() was never updated,
so every operation that copies a workflow silently destroyed them. Export
skips these keys when they are None, so the metadata does not come back as
null - it is absent from the exported .ga entirely.

Reachable via the rename-only update in the workflows API (renaming a
workflow destroys its readme) and via _import_shared_workflow.

source_metadata is deliberately still not copied: it records where this
exact content was fetched from, and is already dropped whenever a workflow
is modified (see test_trs_import).

copy() has now regressed this way three times (470baa5 added license and
creator_metadata, bbbe7f2 added reports_config), so the new unit test
drives its assertions off Workflow.__table__.columns: a column added by a
later migration has to be classified there rather than silently dropped.
@github-actions github-actions Bot changed the title Fix Workflow.copy() dropping readme, help, logo_url and doi [26.1] Fix Workflow.copy() dropping readme, help, logo_url and doi Jul 15, 2026
@github-actions github-actions Bot added area/testing area/database Galaxy's database or data access layer area/testing/api labels Jul 15, 2026
@github-actions github-actions Bot added this to the 26.2 milestone Jul 15, 2026

@jmchilton jmchilton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good comments and good tests - is this one also not Claude?

@mvdbeek

mvdbeek commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

Plan was fable, implementer was opus with a minor manual steer (wanted to copy all model attributes and maintain a string list of attributes to exclude, which i think was a little brittle)

@mvdbeek
mvdbeek merged commit 061cb8e into galaxyproject:release_26.1 Jul 15, 2026
54 of 57 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in Galaxy Dev - weeklies Jul 15, 2026
@github-actions

Copy link
Copy Markdown

This PR was merged without a "kind/" label, please correct.

@github-actions github-actions Bot modified the milestones: 26.2, 26.1 Jul 15, 2026
@nsoranzo
nsoranzo deleted the workflow-copy-drops-readme branch July 15, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

3 participants