Skip to content

More model fixes stemming from select model changes in 23351. - #23368

Draft
jmchilton wants to merge 1 commit into
galaxyproject:devfrom
jmchilton:parameter_model_optional_agreement
Draft

More model fixes stemming from select model changes in 23351.#23368
jmchilton wants to merge 1 commit into
galaxyproject:devfrom
jmchilton:parameter_model_optional_agreement

Conversation

@jmchilton

Copy link
Copy Markdown
Member

PR message from agent. -John

Follow-up to #23351, which made select multiple="true" optional by default in the parameter
model. That fix was right — galaxy.xsd already documented the rule ("Defaults to false
except when the type attribute value is select and multiple is true") and
SelectToolParameter has read parse_optional(self.multiple) since 2013. But the model layer
derives optional in eleven independent places, and reviewing that PR turned up two more
sites that had drifted from runtime the same way.

The divergences

genomebuildGenomeBuildParameter subclasses SelectToolParameter, so at runtime it
inherits parse_optional(self.multiple). The model called parse_optional() bare and read
multiple on the very next line. genomebuild multiple="true" therefore modelled as required
while the runtime treated it as optional. This is the same bug #23351 fixed, five lines away in
the same function.

drill_down — the branch never called parse_optional at all, and _common_param_kwargs
only carries label/help, so an explicit optional="true" was silently dropped and the model
fell back to the base default of False. DrillDownParameterModel also never consulted
optional, so this wires it into py_type and request_requires_value.

Note the asymmetry: for drill_down, multiple does not imply optional.
DrillDownSelectToolParameter.__init__ calls ToolParameter.__init__ rather than
SelectToolParameter.__init__, so it reads a bare parse_optional() with no multiple-derived
default. The fix matches that rather than copying the select rule.

No tool in the tree sets drill_down optional="true", so that half cannot regress an existing
tool — gx_drill_down_exact_optional.xml is added to exercise it.

Coverage gaps from #23351

Measuring what that one-line change actually altered — 9 state representations × 4 value shapes,
run with the commit applied and reverted — showed the affected states were narrower than the
title suggests. request, request_internal, landing_request, job_internal, job_runtime,
workflow_step and workflow_step_linked are byte-identical for a plain multiple select,
because those paths already read self.optional or self.multiple and request_requires_value
returns False unconditionally. What actually moved:

  • test_case_xml / test_case_json null, for every multiple select — the widest-reaching
    change, and it had no spec cases. Added.
  • request::null for the no_options-bearing tool, which is where the real bug was. It flips
    there but not for the single-select sibling, so that surface is worth asserting. Added.
  • gx_select_multiple_no_options_validation had no execution coverage at all. It now rides the
    existing multi-select test, following how gx_select_optional_no_options_validation is stacked
    onto the single-select test 15 lines above.

Also restores a comment #23351 deleted rather than answered — the workflow_step_valid question
is about py_type_workflow_step being unconditionally optional, which is a separate issue from
optional-by-default.

Drive-by

gx_genomebuild_multiple's spec values read ["hg18", hg19"] — a missing opening quote, three
times, which YAML parses as the string hg19". Fixed.

How to test the changes?

Both fixes are red-to-green against the new unit assertions in test_input_models.py.

License

basic.py passes a type-specific default to parse_optional; factory.py called it
bare. Two divergences followed.

genomebuild - GenomeBuildParameter subclasses SelectToolParameter, so runtime
reads parse_optional(self.multiple). The model read parse_optional(), so
`genomebuild multiple="true"` modelled as required. Same shape as the select fix
in galaxyproject#23351, five lines away in the same function.

drill_down - the branch never called parse_optional at all, and
_common_param_kwargs only carries label/help, so an explicit optional="true" was
dropped and the model fell back to the base default. DrillDownParameterModel also
never consulted optional, so honour it in py_type and request_requires_value.
Note multiple does NOT imply optional here: DrillDownSelectToolParameter calls
ToolParameter.__init__, not SelectToolParameter.__init__. Nothing in the tree
sets drill_down optional="true", so this cannot regress an existing tool;
gx_drill_down_exact_optional.xml is added to exercise it.

Also closes coverage gaps left by galaxyproject#23351. The states that actually flipped there
were test_case_xml/test_case_json null, which had no cases; request::null flips
for gx_select_multiple_no_options_validation but not for its single-select
sibling, so that surface is worth asserting. The new tool had no execution
coverage - it now rides the existing multi-select test alongside
gx_select_optional_no_options_validation. Restores the workflow_step question
that was deleted rather than answered: py_type_workflow_step is unconditionally
optional, which is a separate issue from optional-by-default.

Fixes ["hg18", hg19"] in the genomebuild spec - the missing quote made YAML parse
the value as the string 'hg19"'.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G95icoGkoDKbwPotGnvQpk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant