Skip to content

fix: set resolution and priority through --field - #79

Merged
Hinne1 merged 3 commits into
mainfrom
claude/fix-transition-resolution-field
Sep 24, 2026
Merged

Hinne1 merged 3 commits into
mainfrom
claude/fix-transition-resolution-field

Conversation

@Hinne1

@Hinne1 Hinne1 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

--field on jira issue transition, edit and create could not set a resolution, so transitions that require one (for example WARD's "Erledigt") failed.

  • System field keys are now sent in the casing Jira expects (Resolution becomes resolution, fixversions becomes fixVersions). Jira matches field keys case-sensitively.
  • resolution and priority values are sent as a reference object: an all-digit value becomes {"id": ...}, anything else {"name": ...}. Jira rejects a bare string or number for these fields.
  • An empty resolution or priority value is refused locally with field <key> requires a value (id or name). Jira rejects both {"name": ""} and null for them (checked on the sandbox site).
  • AGENTS.md notes that an all-digit value is sent as an id.

Testing

  • go test ./... passes; make lint reports 0 issues.
  • New tests TestParseCustomField_SystemFields, TestParseCustomField_SystemFieldKeyCasing and TestParseCustomField_EmptyReferenceValue. Each fails when its guard is reverted (checked by mutation, one guard at a time).
  • Live on the sandbox site, on a throwaway issue (sandbox WARD-14):
    • installed atl: transition WARD-14 Erledigt --field "Resolution=Won't Do" returns 400 ... Field 'Resolution' cannot be set. It is not on the appropriate screen, or unknown.
    • this branch: the same command returns Transitioned WARD-14: Neu -> Erledigt, and the issue reads back as status Erledigt, resolution Won't Do.

…ty as references

atl jira issue transition/edit/create --field sent a system field under the
user's casing ("Resolution") and its value as a bare string or number. Jira
matches field keys case-sensitively and requires resolution and priority as an
{id} or {name} object, so a transition that requires a resolution could not be
completed through atl.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for resolving Jira system fields in their canonical casing and wrapping reference fields (such as resolution and priority) in reference objects (using id or name) without requiring an API call. Unit tests were also added to verify this behavior. The review feedback suggests handling empty or whitespace-only values in reference fields by returning nil instead of an empty name object, which allows Jira to clear the field rather than rejecting the request, along with adding corresponding test cases.

Comment thread internal/cmd/issue/field_util.go
Comment thread internal/cmd/issue/field_util_test.go
@Hinne1

Hinne1 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces mapping and handling for Jira system fields to ensure they are sent with the correct case-sensitive keys and that reference fields (like resolution and priority) are wrapped in reference objects without making API calls. The feedback suggests defining a local map of schemas for well-known system fields like labels, description, and environment to allow proper coercion, integrating this schema lookup in ParseCustomField, and adding corresponding test cases to verify the coercion.

Comment thread internal/cmd/issue/field_util.go
Comment thread internal/cmd/issue/field_util.go
Comment thread internal/cmd/issue/field_util_test.go
@Hinne1

Hinne1 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for canonicalizing Jira system field keys and wrapping reference fields (like resolution and priority) in reference objects (id or name) during parsing. It also adds corresponding unit tests and documentation. However, a critical issue was identified where non-reference system fields (such as labels) bypass type-based coercion because the field definition is not fetched, which leads to API errors. It is recommended to fetch the field definition using jira.GetFieldByID for system fields to ensure proper coercion.

Comment thread internal/cmd/issue/field_util.go
@Hinne1

Hinne1 commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

🔏 Readiness attested — the pr-readiness-check gate completed for PR #79 at 3714b9841f41226f292cdab5e6a0f078cfb53891 (2026-09-24T14:23:22Z). If the branch head has moved, this evidence covers the earlier state only.

Readiness summary

PR Readiness Check (#79, 3714b98)
Review mode INITIAL (operator-requested quick check: Council tier "review" instead of tier "council")
Branch/base PASS (contains origin/main, clean tree, head pushed)
Local verification PASS (go test ./... all ok; make lint 0 issues)
Dispatched CI PASS (no workflow in the repo has workflow_dispatch; nothing to dispatch)
Remote CI DEFERRED UNTIL READY (go.yml skips its jobs on draft PRs)
Coverage DEFERRED UNTIL READY (reported by go.yml)
Automated reviewers PASS (Gemini reviewed 3714b98; 6 findings over three heads: 2 REFUTED by a live sandbox probe, 4 DEFERRED as pre-existing out-of-scope behavior)
Review threads PASS (0 unresolved)
Review comments PASS (open-review-comments.sh exit 0)
Council findings DISPOSITIONED (tier review, 7/7 reviewers; round 1 REVISE: 2 FIXED as one empty-value guard, 1 REFUTED; round 2 APPROVE, no findings)
Standards review LIMITATION (skipped at operator request for a quick check)
Spec review LIMITATION (skipped at operator request for a quick check)
PR description PASS
SQL/UI evidence SKIP (no SQL or UI)
Result: READY

Live evidence: on the sandbox site, released atl fails "transition ... --field Resolution=Won't Do" with a 400; this branch transitions the issue and it reads back Erledigt / Won't Do. An empty resolution or priority value is refused locally before any API call.
Deferred (Minor): --field does not coerce labels/description/environment; this predates the PR, and dedicated flags exist.

@Hinne1
Hinne1 marked this pull request as ready for review September 24, 2026 14:23
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/enthus-appdev/atl-cli/internal/api 43.40% (+1.12%) 👍
github.com/enthus-appdev/atl-cli/internal/cmd/assets 19.86% (+6.00%) 👍
github.com/enthus-appdev/atl-cli/internal/cmd/issue 11.66% (+1.30%) 👍
github.com/enthus-appdev/atl-cli/internal/cmd/jira 48.72% (+4.27%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/enthus-appdev/atl-cli/internal/cmd/issue/field_util.go 68.29% (+18.98%) 82 (+9) 56 (+20) 26 (-11) 🎉

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/enthus-appdev/atl-cli/internal/cmd/issue/field_util_test.go

@Hinne1
Hinne1 merged commit 04e3bab into main Sep 24, 2026
15 checks passed
@Hinne1
Hinne1 deleted the claude/fix-transition-resolution-field branch September 24, 2026 14:33
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