Tighten RulesModel: typed discriminated-union rules, constrained mappings, regex validation#23102
Merged
Merged
Conversation
jmchilton
marked this pull request as ready for review
July 15, 2026 13:14
mvdbeek
reviewed
Jul 15, 2026
| class RulesMapping(StrictModel): | ||
| type: str | ||
| def _validate_regex_expression(v: str) -> str: | ||
| import re |
Member
There was a problem hiding this comment.
Should probably not be a local import ?
mvdbeek
approved these changes
Jul 15, 2026
…ings, regex validation Replace `rules: list[dict[str, Any]]` with 18 typed Pydantic rule models keyed on a `type` discriminator (1:1 with the runtime rules_dsl rule set). Constrain RulesMapping.type to the known mapping Literals. Validate regex `expression` fields (AfterValidator). Fix add_filter_compare value int->float. RulesMapping/ RulesModel become BaseModel (extra ignored) so model_dump emits DSL-only fields. Give RulesParameterModel a workflow-aware pydantic_template mirroring the other inline params (optional in unlinked workflow_step, allow_connected_value when linked) so gx_rules validates across state representations. Adds gx_rules.xml framework tool + gx_rules parameter_specification.yml cases. Pairs with editor UI-metadata leak fix galaxyproject#22823 and IWC cleanup galaxyproject/iwc#1278. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jmchilton
force-pushed
the
tighten-rules-model
branch
from
July 20, 2026 19:29
86d2270 to
ccb8d3b
Compare
mvdbeek
approved these changes
Jul 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace
rules: list[dict[str, Any]]with 18 typed Pydantic rule models keyed on atypediscriminator (1:1 with the runtime rules_dsl rule set). Constrain RulesMapping.type to the known mapping Literals. Validate regexexpressionfields (AfterValidator). Fix add_filter_compare value int->float. RulesMapping/ RulesModel become BaseModel (extra ignored) so model_dump emits DSL-only fields.Give RulesParameterModel a workflow-aware pydantic_template mirroring the other inline params (optional in unlinked workflow_step, allow_connected_value when linked) so gx_rules validates across state representations.
Adds gx_rules.xml framework tool + gx_rules parameter_specification.yml cases. Pairs with editor UI-metadata leak fix #22823 and IWC cleanup galaxyproject/iwc#1278.
How to test the changes?
(Select all options that apply)
License