TOOL_PARSING_DECLARATIVE_TESTING_AND_ABSTRACTIONS_PROMPT

Agent Prompt: Declarative Testing + Extension Points for Galaxy Tool Parsing

Who you are

You’re a senior software engineer working on interoperable Galaxy tool/workflow abstractions across Python and TypeScript. Read GXWF_AGENT.md (this directory) first — it’s the standing context for the whole cross-language effort. This prompt narrows that effort to one layer: tool parsing.

The goal

Today we can take a workflow, run it through a Python operation (clean / validate / export / roundtrip), and assert the result declaratively from a YAML expectation file. Those same YAML fixtures + expectations are rsynced into the TypeScript monorepo and replayed against the TS implementation. That’s the mirroring pattern, and it works — it’s the source of truth for Python/TS parity, and it’s explicitly called out in GXWF_AGENT.md as high-value (vs. hand-written unit tests, which are expendable).

We want the same thing one layer down, for tool parsing. The end state:

Take an XML or YAML tool source, build a ParsedTool, and assert its structure declaratively from a YAML expectation file — such that TypeScript can eventually parse tools too and be verified against the same expectations.

Your job is to design that: the abstractions, the declarative layer, the extension points in the parsing layer, and the fixture/expectation format. Redesign the tool parsing layer where it’s warranted; at minimum add the extension points that make this testable and mirrorable. Coming up with the actual shape is yours to decide — this document is pointers and constraints, not a design.

Repos / worktrees

WhatPath
Galaxy (Python source of truth)/Users/jxc755/projects/worktrees/galaxy/branch/wf_tool_state
gxformat2 (declarative harness lives here)/Users/jxc755/projects/worktrees/gxformat2/branch/abstraction_applications
TypeScript monorepo (the mirror)/Users/jxc755/projects/worktrees/galaxy-tool-util/branch/report_models
VS Code extension (downstream consumer)/Users/jxc755/projects/worktrees/galaxy-workflows-vscode/branch/wf_tool_state

Paths below are relative to whichever of those a section is about.


Part 1 — The parsing layer you’d be changing (Galaxy)

The target object

How a ParsedTool gets built today

Tool fixtures that already exist (reuse, don’t invent)

Existing tool-parsing tests (what you’d be improving on)

All under test/unit/tool_util/:

The closest existing precedent — read this carefully


Part 2 — The declarative harness that already exists (reuse this)


Part 3 — The TypeScript mirror (why the abstractions have to be portable)

TS monorepo: /Users/jxc755/projects/worktrees/galaxy-tool-util/branch/report_models.

TS already parses tools — partially

This is the beachhead. A full TS tool parser is a generalization of user-tool-parse (YAML/inline today; XML is the open question). Your Python-side design decides what that TS parser has to match, and what it can be tested against.

How sync works — your expectations must fit this pipeline

Downstream consumers to not break


Part 4 — What we want out of you

  1. A design for declaratively testing tool parsing: XML or YAML tool source → ParsedTool → path-based assertions in YAML. Reuse gxformat2/testing.py; extend it in place if it’s short.
  2. Extension points / refactoring in the parsing layer to make that clean — model_factory.parse_tool and parameters/factory.py are the obvious seams. Say what you’d change, and be honest about which parts are redesign vs. additive.
  3. The expectation format, with worked examples covering the interesting cases: conditionals, repeats, sections, data_column, dynamic/from_dataset selects, collection inputs, outputs incl. collections + discovered datasets, stdio, requirements/containers, profile-conditional behavior, CWL if it’s in scope.
  4. The fixture story — how much of test/functional/tools/ you cover and how you pick, following the framework_tool_checks.yml reasoning.
  5. The sync story — the sync-manifest.json group + Makefile targets + check-sync guard, so TS can replay these. Say explicitly what a TS tool parser would need to implement to pass, and how much of user-tool-parse generalizes.
  6. A migration path for test_parsing.py and friends — what gets converted, what stays imperative and why.
  7. A test plan. Red-to-green: expectations that fail against today’s code first where you’re fixing real behavior. Don’t delete tests, drop assertions, or edit fixtures to make things pass — if that’s where you land, stop and ask.
  8. Unresolved questions at the end, concise.

Constraints

Start here

Read in this order: GXWF_AGENT.md → CURRENT_STATE.md (same directory; the workflow_state package inventory and what the mirroring bought us) → gxformat2/testing.py → test/unit/tool_util/workflow_state/test_declarative.py + expectations/clean.yml → lib/galaxy/tool_util/model_factory.py → test/unit/tool_util/parameter_specification.yml + test_parameter_specification.py → packages/schema/src/user-tool-parse/parse.ts → scripts/sync-parsed-tools.py + scripts/sync-manifest.json.