Repository navigation
feat(issue): transition screen fields and validator attribution - #104
Merged
Merged
Conversation
The two legacy call-shape assertions in test_jira_client now include fields=None, which is jira-python's own default for that parameter, so the behaviour of a fieldless transition is unchanged.
Jira rarely quotes the field name verbatim: a field called 'Solution details' is reported as 'Provide details about the solution made available.' Literal substring matching would therefore never fire in practice, so matching requires every significant word of the field name to appear in the message, in any order. Two equally good candidates yield no attribution, so the caller forwards Jira's own message instead of naming the wrong field.
Prompting is gated on a _can_prompt() predicate rather than an inline isatty() call: without a terminal a prompt would hang, which matters because budjira is often driven by agents and CI where --no-interactive is forgotten.
Attribution walks the exception's __cause__ chain: the service layer converts JIRAError into JiraAPIError and keeps only the error text, so the response body with errorMessages survives nowhere else. Without the walk, attribution would have fired in unit tests and never in production. An unattributable validator message is forwarded with Jira's own wording plus the transition's screen fields as context, instead of escaping as a traceback. Also renames the changes-table loop variable, which shadowed the new --field parameter.
Also fixes two things found while regenerating the AI prompt: - The transition models used Field(None, ...) positionally, which mypy does not recognize as a default, so every construction that omitted an optional field failed --strict. Switched to Field(default=None, ...). - .claude/ai-usage-prompt.md had been generated from a stale local ai-prompt-template.toml rather than from the code defaults, so it was missing the --parent sub-task section and the sprint write-operations section. It is now generated from the code defaults.
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.
Implements parts 2 and 3 of #101 plus
--dry-run. Does not close the issue —parts 1 (multi-hop path finding) and 4 (ADF) remain open, see below.
Spec:
docs/superpowers/specs/2026-07-29-transition-screen-fields-design.mdPlan:
docs/superpowers/plans/2026-07-29-transition-screen-fields.mdProblem
A transition whose screen carries a required field was un-completable from the
CLI — not degraded, impossible.
transition()passed no fields, andget_transitions()never asked for screen metadata.What changed
budjira/models/transition.py— typedTransition/TransitionField.TransitionService.get_transition_details()— requestsexpand=transitions.fields.TransitionService.transition(fields=...)— forwards values.budjira/utils/transition_fields.py— pure parse / resolve / encode / attributehelpers, no Jira client, so the fiddly logic is testable without mocks.
issue update—--field(repeatable),--dry-run,--interactive/--no-interactive.Non-interactive callers (agents, CI, piped stdin) never get a prompt: a missing
required field aborts with the field ids, types and allowed values, ready to paste
back. Prompting is gated on a
_can_prompt()TTY check, not just the flag, becausea forgotten
--no-interactivewould otherwise hang forever.Two things worth a reviewer's attention
1. Validator attribution needed the
__cause__chain. The service layer convertsJIRAErrorintoJiraAPIErrorand keeps only the error text, so the response bodywith
errorMessagessurvives nowhere else. Readingerror.responsedirectly wouldhave worked in unit tests and never in production. There is a test for the wrapped
shape specifically.
2. Matching is word-based, not substring. Jira rarely quotes the field name:
a field called
Solution detailsis reported as "Provide details about the solutionmade available." Literal substring matching — what the spec originally described —
would never fire. Attribution now requires every significant word of the field name
to appear in the message, in any order, and returns nothing when two fields match
equally well, so Jira's own message is forwarded rather than the wrong field named.
Value encoding
--field resolution=Donewould fail as a plain string.encode_field_value()wrapsper schema type:
array→[{"value": v}],option→{"value": v},resolution/priority→{"name": v}. Other structured types pass throughuntouched and surface as a Jira error rather than being silently mangled.
Out of scope, deliberately
GET /issue/{key}/transitionsis state-specific,so look-ahead needs the workflow definition, which is normally admin-gated. Needs
a spike against a real instance first.
rest_api_version, so jira-python'sdefault
"2"applies and rich-text fields accept plain strings today. This becomesreal with Epic Epic: Migrate jira-python client from REST API v2 to v3 (ADF) #96, which must then cover transition fields too.
Incidental fixes
Field(None, ...), which mypy does not treat asa default; switched to
Field(default=None, ...)..claude/ai-usage-prompt.mdhad been generated from a stale localai-prompt-template.tomlinstead of the code defaults, so it was missing the--parentsub-task section and the sprint write-operations section. Regeneratedfrom code. The documented regeneration command is machine-dependent — worth its
own issue.
test_jira_client.pynow includefields=None,which is jira-python's own default, so fieldless transitions behave identically.
Tests
962 passed, 3 skipped. Coverage 86.90% overall;
transition_fields.pyandmodels/transition.pyat 100%,services/transitions.pyat 94%. Full pre-commit gate green.