PLAN_A_BOTTOM_UP

Plan A: Bottom-Up Parameter Coverage

Approach

Methodically extend parameter type support across validation and conversion, type-by-type, with red-to-green testing. Audit gaps, design schemas, implement each type, wire into lint, build round-trip harness, integrate export.

Current Parameter Type Coverage Matrix

Parameter Typevalidation_nativevalidation_format2convert.pyNotes
gx_text---Passes through unvalidated
gx_integerYes-PartialNative: basic int(); Convert: int conversion only
gx_float---
gx_boolean---
gx_color---
gx_hidden---
gx_dataYes-PartialNative: checks ConnectedValue/optional; Convert: placeholder
gx_data_collectionYes--Native: validates like gx_data
gx_selectYes--Native: validates against options list
gx_conditionalYesYes-Both: recursive branch validation
gx_repeatYesYes-Both: array iteration
gx_sectionYesYes-Both: recursive nesting
gx_rules---
gx_drill_down---
gx_data_column---
gx_group_tag---
gx_baseurl---
gx_genomebuild---
gx_directory_uri---

Key insight: workflow_step and workflow_step_linked were explicitly designed for Format2 state validation (commit 39641f6531). Pydantic models already exist for ALL parameter types via pydantic_template(). workflow_step validates raw Format2 state (no ConnectedValue, no __current_case__, data params absent, most things optional). workflow_step_linked validates after merging connections. The validation infrastructure is complete — it’s the workflow_state package that hasn’t wired into it for most types.

Implementation Steps

Phase 1: Scalars (Highest Priority)

Each step follows red-to-green: add test case to parameter_specification.yml pattern, run (fails), implement, run (passes).

Step 1.1: gx_text

Step 1.2: gx_float

Step 1.3: gx_boolean

Step 1.4: gx_color

Step 1.5: gx_hidden

Step 1.6: gx_genomebuild, gx_group_tag, gx_baseurl, gx_directory_uri

Phase 2: Complex Types

Step 2.1: gx_select (conversion)

Step 2.2: gx_data_column

Step 2.3: gx_drill_down

Step 2.4: gx_rules

Phase 3: Container Conversion (Conditional/Repeat/Section)

These are already validated but not converted.

Step 3.1: Conditionals in convert.py

Step 3.2: Repeats in convert.py

Step 3.3: Sections in convert.py

Phase 4: Format2 State Validation & Lint Integration

Step 4.1: Wire workflow_step validation into conversion pipeline

WorkflowStepToolState.parameter_model_for() already validates format2 state directly — it was designed for this. No new representation needed. The work is:

Step 4.2: Wire validation into gxformat2 lint

Phase 5: Round-Trip Harness

Step 5.1: Build round-trip test utility

Step 5.2: Define “functional equivalence”

Step 5.3: Test corpus

Phase 6: Export Integration

Step 6.1: Schema-aware export path

Step 6.2: Fallback behavior

Step 6.3: API endpoint

Testing Strategy

Red-to-Green Pattern

For each parameter type:

  1. Add workflow fixture using that type (valid/ and invalid/ directories)
  2. Add test case to test_workflow_state_conversion.py
  3. Run → fails (type not handled)
  4. Implement in convert.py / validation_*.py
  5. Run → passes
  6. Add edge cases (optional, connected, default values)

Existing Test Infrastructure to Leverage

New Test Files

FilePurpose
test/unit/workflows/test_roundtrip.pyRound-trip harness

Deliverable Mapping

DeliverablePhaseKey Output
D1: State Encoding ConversionPhase 1-3convert.py with all parameter types
D2: State ValidationPhase 1-4validation via workflow_step/workflow_step_linked models
D3: Native Workflow ValidatorPhase 1-2validate_workflow_native() covers all types
D4: Format2 Workflow ValidatorPhase 4WorkflowStepToolState validation + gxformat2 lint
D5: Round-Trip ValidationPhase 5roundtrip.py + test corpus
D6: Format2 ExportPhase 6API endpoint + fallback

Risks

  1. Long tail of parameter types — 19+ types means significant implementation work before the system feels “complete.” Mitigated by prioritizing the ~8 types that cover 95% of real workflows.
  2. gxformat2 is a separate library — Schema-aware features must be optional. Can’t add galaxy-tool-util dependency to gxformat2.
  3. workflow_step model completeness unknown — We won’t know if the workflow_step models are complete until we start validating real workflows. Expect to discover and fix gaps as we go.

Resolved Decisions

Open Questions