Fix mutable_flow test flow passing a stale second argument to extract_step_decorator_from_decospec - #3358
Conversation
…rator_from_decospec
`extract_step_decorator_from_decospec` takes a single `decospec` argument, but
both call sites in the `mutable_flow` test flow still pass a second `{}`
positional, so `ModifyFlow`/`ModifyFlow2` raise TypeError as soon as the flow
is mutated.
Both production call sites already pass one argument.
Greptile SummaryThis PR fixes the mutable-flow configuration test by removing obsolete second arguments from two calls to
Confidence Score: 5/5The PR appears safe to merge; the narrowly scoped changes correct two stale test call sites without altering behavior beyond preventing their argument-count errors. Both modified calls now match the parser’s single-argument signature while retaining the same inputs, tuple unpacking, and subsequent decorator mutation logic.
|
| Filename | Overview |
|---|---|
| test/test_config/mutable_flow.py | Both stale two-argument calls are correctly updated to use the helper’s existing single-argument interface, with no issues identified. |
Reviews (1): Last reviewed commit: "fix(test_config): drop the stale second ..." | Re-trigger Greptile
Shriprasad-P
left a comment
There was a problem hiding this comment.
The extra {} is definitely stale, but I don't think removing it is sufficient to make this flow work against the current mutable-step API.
MutableStep.decorator_specs now yields (name, fq_name, args, kwargs) tuples. These two paths still call .startswith("environment:") on those values, so they can fail before extract_step_decorator_from_decospec() is reached.
There are a couple of related stale API usages here as well: the decorator attributes are already available from the tuple, and add_decorator() now expects them through deco_kwargs= (with duplicates=OVERRIDE when replacing the existing environment decorator).
The current implementation in test/ux/core/flows/config/mutable_flow.py already follows that pattern. I think test/test_config/mutable_flow.py should be aligned with that implementation rather than continuing to parse these specs through extract_step_decorator_from_decospec.
So the arity change itself is correct, but the test flow still appears incompatible with the current decorator-spec API.
extract_step_decorator_from_decospecaccepts exactly one argument(
metaflow/decorators.py:692):but both call sites in the
mutable_flowtest flow still pass a secondpositional
{}:Both are reached from a
FlowMutator.mutate(), which runs at flow-definitiontime, so
mutable_flow.pyraisesTypeError: extract_step_decorator_from_decospec() takes 1 positional argument but 2 were givenbefore any step executes. The flowis registered as a test case in
test/test_config/test.py:96.The two call sites in library code already pass a single argument, which is what
makes this a stale-caller bug rather than a signature question:
metaflow/decorators.py:768metaflow/user_decorators/mutable_step.py:340test/test_config/mutable_flow.py:61test/test_config/mutable_flow.py:110Binding the real upstream signature against all four call sites, with the two
library callers as the control group:
This PR drops the extra
{}at both sites so the test flow matches thesignature and the two library callers. Nothing else changes — the return value
is still unpacked as
(step_deco, has_args_kwargs), exactly asmutable_step.py:340does.🤖 Generated with Claude Code