Skip to content

fix(bundler): pass explicit option values when delegating to workflow_add - #4135

Open
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/bundler-workflow-add-typer-options
Open

fix(bundler): pass explicit option values when delegating to workflow_add#4135
jawwad-ali wants to merge 1 commit into
github:mainfrom
jawwad-ali:fix/bundler-workflow-add-typer-options

Conversation

@jawwad-ali

Copy link
Copy Markdown
Contributor

Problem

specify bundle install can never install a workflow component. It fails 100% of the time, with an error about --dev that has nothing to do with what the user asked for.

bundler/services/primitives.py delegates to the Typer command callables in-process, as its module docstring describes:

lambda: workflow_add(component.id)

But workflow_add declares two typer.Option parameters (workflows/_commands.py:1712-1716):

def workflow_add(
    source: str = typer.Argument(..., help="Workflow ID, URL, or local path"),
    dev: bool = typer.Option(False, "--dev", ...),
    from_url: str | None = typer.Option(None, "--from", ...),
):

Called from Python rather than through Typer, an omitted option parameter keeps its OptionInfo sentinel as the value:

dev default      -> OptionInfo   truthy=True
from_url default -> OptionInfo   is None=False

So if dev: is always true and the function takes the local-path branch.

Reproduction on current main (bf88c9f)

>>> primitive_manager("workflows", project, allow_network=True).install(
...     ComponentRef(kind="workflows", id="code-review", version="1.0.0"))

Error: --dev source must be a workflow YAML file, supported archive, or
directory containing workflow.yml: code-review

BundlerError: Failed to install workflow 'code-review'.

The catalog install path is unreachable.

Why only this call site

A signature survey of all four delegated callables:

callable parameters
workflow_add source=ArgumentInfo, dev=OptionInfo, from_url=OptionInfo
workflow_remove workflow_id=ArgumentInfo
workflow_step_add step_id=ArgumentInfo
workflow_step_remove step_id=ArgumentInfo

workflow_add is the only one that declares options, and it is the only call site that omits them — so the other three are safe exactly as written, and this fix is correctly scoped to one line.

Fix

lambda: workflow_add(component.id, dev=False, from_url=None),

No breaking change. No input that works today behaves differently — today every bundler workflow install fails; afterwards it reaches the catalog path the code always intended.

Verification

  • Fail-before / pass-after: the new test fails on unpatched src and passes with the fix — 1 failed → 21 passed.
  • The new test asserts the values, not just the call: dev is False and from_url is None, so a future regression to sentinels is caught rather than silently swallowed by a **kwargs stub.
  • One existing stub (lambda wid: ...) had to accept the kwargs; I made it capture them instead of discarding them.
  • Scoped regression over tests/unit: no new failures vs a clean-main baseline captured on bf88c9f9.
  • uvx ruff@0.15.0 check src tests → clean

Written with assistance from Claude Code. Bug found, reproduced, and verified by me on current main.

…_add

`specify bundle install` can never install a workflow component. It fails
100% of the time with a nonsensical error about `--dev`.

The bundler delegates to the Typer command callables in-process:

    lambda: workflow_add(component.id)

`workflow_add` declares two `typer.Option` parameters. Called from Python
rather than through Typer, those keep their `OptionInfo` sentinels as the
value — and the sentinel is truthy and is not None:

    dev default      -> OptionInfo   truthy=True
    from_url default -> OptionInfo   is None=False

So `if dev:` takes the local-path branch for every catalog install:

    Error: --dev source must be a workflow YAML file, supported archive, or
    directory containing workflow.yml: code-review
    BundlerError: Failed to install workflow 'code-review'.

`workflow_add` is the only one of the four delegated commands that declares
options; workflow_remove / workflow_step_add / workflow_step_remove take a
bare `typer.Argument` and are safe as written.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jawwad-ali
jawwad-ali requested a review from mnriem as a code owner August 15, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant