Skip to content

Resolve multi-hop workflow transitions and required transition-screen fields #101

Open

Description

@f3rdy

Problem

Setting an issue to a target status is often not a single transition, and budjira currently leaves the hard parts to the user.

Jira workflows can be arbitrarily complex: the path from the current status to the desired one may span several transitions, and individual transitions may present a screen with fields that must be filled. Today the user has to discover both by trial and error — on real tickets, where every failed attempt is permanently visible in the issue history.

Current behaviour

Given a workflow like:

<Status A>  --[Transition 1]-->  <Status B>  --[Transition 2]-->  <Status C>

with an issue PROJ-123 in <Status A> and <Status C> as the goal:

  1. Multi-hop paths are invisible. budjira issue transitions PROJ-123 lists only the transitions available from the current status. <Transition 2> does not appear until the issue already sits in <Status B>, so the user cannot see that the goal is two hops away, nor which intermediate status leads there. Reaching <Status C> means guessing.

  2. Transition screen fields cannot be supplied. budjira issue update PROJ-123 --status "<Transition 1>" has no way to pass fields that the transition screen requires. When a transition demands one, the call fails and there is no CLI-side way to satisfy it.

  3. Workflow validators produce unattributable errors. A field enforced by a workflow validator (rather than by field-level required-ness) is reported by Jira as:

    {"errorMessages":["<validator message>"],"errors":{}}

    The errors object is empty, so the message never names the offending field. Worse, such a field can appear as required: false in the transition metadata, so even inspecting the screen does not obviously identify it. Resolving this currently means calling /rest/api/N/issue/PROJ-123/transitions?expand=transitions.fields by hand and reasoning about which customfield_NNNNN the message refers to.

  4. Rich-text fields need format-aware sending. A rich-text transition field rejects a plain string on API v3 with Operation value must be an Atlassian Document (see the Atlassian Document Format). The same payload succeeds on v2. Users end up hand-rolling curl calls against v2 with credentials pulled out of budjira's own config — which defeats the purpose of having the CLI.

Proposal

Make the workflow path a first-class budjira concern.

Path finding. Let --status accept a target status, not just a directly available transition. budjira walks the workflow graph (breadth-first, querying the transitions endpoint per intermediate status), then shows the resulting path and asks for confirmation before executing anything:

$ budjira issue update PROJ-123 --status "<Status C>"

Path: <Status A> --[Transition 1]--> <Status B> --[Transition 2]--> <Status C>
2 transitions. Proceed? [y/N]

Never traverse multiple hops silently — the intermediate statuses are real state changes that land in the issue history.

Field collection. For each hop, collect the transition screen's fields and prompt for the required ones, or accept them non-interactively:

budjira issue update PROJ-123 --status "<Status C>" \
    --field resolution=<value> \
    --field customfield_NNNNN="<text>"

Learn from validator failures. When a transition fails with an empty errors object, match the message against the transition's screen fields and report a concrete field name instead of forwarding Jira's bare sentence — then prompt for that field and retry.

Handle the rich-text format internally. Either target the API version that accepts plain strings, or wrap plain input into ADF. The user should not have to know which fields are rich text.

Notes

  • Path finding should cap traversal depth and refuse ambiguous cases (several equally short paths) by presenting the alternatives rather than picking one.
  • A --dry-run that prints the path and the fields it would need, without transitioning, would make this safe to explore on real issues.
  • Workflow graphs are per project and per issue type; results should not be cached across either.

Activity

  1. added
    enhancement
    priority:medium
    user-experience
    on Jul 19, 2026
  2. f3rdy commented on Jul 21, 2026

    @f3rdy
    ContributorAuthor

    Hit this live while finalizing a ticket from the CLI — a concrete reproduction of points 2 and 4.

    Point 2 (transition screen fields cannot be supplied). The issue sat in a late "deployment" status; the intended next status was a single hop away, but that transition carries a required screen field. budjira issue update <KEY> --status "<name>" failed atomically:

    Transition issue failed (transition=<name>): Provide details about the solution made available.
    

    There is no flag to pass the field, so the CLI cannot complete the transition at all. The only paths left are the Jira UI or a hand-rolled REST call. The proposed non-interactive --field customfield_NNNNN="<text>" would have closed this in one command.

    Point 4 (workaround defeats the CLI — and can be blocked entirely). The natural fallback is to pull the token out of budjira's own config and PUT /rest/api/2/issue/<KEY>/transitions with the field in the payload. That is exactly the "defeats the purpose of the CLI" case. It is worse in a hardened environment: reading the credential store to build that call can be denied outright by a policy layer, which leaves a CLI-only user with no programmatic path to the transition at all. Field collection handled inside budjira (which already holds the credential) is the only workaround that survives such a policy.

    Net: even for a plain one-hop transition, a required screen field currently makes the transition un-completable from budjira.

  3. f3rdy commented on Jul 21, 2026

    @f3rdy
    ContributorAuthor

    Triage / assessment

    Checked against current master: none of the four sub-problems are implemented today.

    • TransitionService.get_transitions (budjira/services/transitions.py:14) returns only id+name from the current status — no expand=transitions.fields.
    • TransitionService.transition (:42) is single-hop and passes no fields to transition_issue.
    • issue update --status (budjira/cli/issue.py:84) has no --field, no path-finding, no --dry-run.

    This is really four issues in one; recommend splitting so the valuable low-risk parts can land independently of the hard one.

    1. Multi-hop path finding — highest risk, needs a spike first

    The proposal walks the graph by "querying the transitions endpoint per intermediate status". That endpoint (GET /issue/{key}/transitions) is state-specific: it only returns transitions valid from the issue's current status. You cannot look ahead to <Transition 2> without the issue actually sitting in <Status B> — i.e. without performing the (irreversible, history-visible) hop. True look-ahead requires the workflow definition (/rest/api/3/workflow / project workflow scheme), which is often admin-gated and not available to a normal token. Suggest a spike to confirm which API is reachable with a standard token before committing to BFS; otherwise "path finding" degrades to "try one hop, re-query, repeat" which mutates the issue while exploring.

    2. Transition screen fields (--field) — best first slice, self-contained

    Add expand=transitions.fields to get_transitions, thread a repeatable --field key=value through transition() → client.transition_issue(key, id, fields={...}) (jira-python already supports the fields= kwarg). High value, low blast radius, no dependency on (1).

    3. Attribute validator failures — depends on (2)

    Once screen-field metadata is available from (2), match the bare errorMessages sentence (empty errors object) against the screen's fields to name the culprit. Medium effort.

    4. Rich-text/ADF — reuse existing machinery

    budjira already has budjira/utils/markdown_to_jira.py (added for #95, the description-upload ADF fix). The same conversion should back rich-text transition fields rather than hand-rolling v2 curl. Medium.

    Suggested cut

    Ship #2 + #3 first (immediately useful, contained), reuse #95's converter for #4, and treat #1 as a separate spike-gated issue. --dry-run from the Notes should ride along with whatever lands so it stays safe to explore on real tickets.

    (automated triage assessment — please sanity-check the workflow-API reachability claim against your instances)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementpriority:mediumuser-experience

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions