Bug: Automation API types don't match actual Jira Cloud API responses
Discovery
Integration testing against monitproduct.atlassian.net revealed that the automation command types were built from API documentation that doesn't match the actual response format. All automation commands silently fail — they get 200 OK but can't parse the responses.
Mismatches Found
1. List/Summary endpoint (GET /rule/summary)
Actual response:
{
"links": {"self": null, "next": null, "prev": null},
"data": [
{"uuid": "018aed44-...", "name": "...", "state": "ENABLED", ...}
]
}
Our type expects:
type AutomationRuleSummaryResponse struct {
Total int `json:"total"`
Values []AutomationRuleSummary `json:"values"` // should be "data"
Next string `json:"next"` // should be "links.next"
}
data not values
links.next not top-level next
- No
total field
- Rules identified by
uuid not numeric id
2. Get single rule endpoint (GET /rule/{uuid})
Actual response:
{
"rule": {
"name": "...",
"state": "ENABLED",
"uuid": "018aed44-...",
"trigger": { "component": "TRIGGER", "type": "...", ... },
"components": [ ... ],
"ruleScopeARIs": ["ari:cloud:jira:..."],
"labels": [],
...
},
"connections": [...]
}
Our type expects: Rule at top level with json:"id" and json:"ruleKey"
Key differences:
- Rule nested under
"rule" key, not at top level
- ID field is
uuid not id — no numeric ID exists
- Trigger is a separate field from
components array
- Projects represented as
ruleScopeARIs (ARIs), not projects array
- No
tags field (we have one)
3. Rule summary objects
Actual fields:
{
"uuid": "018aed44-eda8-7f38-8dc8-4b6588c10073",
"name": "ON/MON: Unblock Onboarding Tickets",
"state": "ENABLED",
"description": "...",
"authorAccountId": "...",
"actorAccountId": "...",
"created": 1696197832.104,
"updated": 1700430538.092,
"labels": [],
"ruleScopeARIs": ["ari:cloud:jira:..."]
}
Our type maps: ID → json:"id" (doesn't exist), UUID → json:"ruleKey" (should be uuid)
Impact
jtk auto list — returns "No automation rules found" (parses data as nil values)
jtk auto get <id> — likely fails or returns empty (rule nested under "rule")
jtk auto export <id> — returns raw JSON so may partially work
jtk auto update — may send wrong format
jtk auto create — may send wrong format
jtk auto enable/disable — unknown, state endpoint format not yet verified
Fix Required
AutomationRuleSummaryResponse — use Data (json:"data") and nested Links struct
AutomationRuleSummary — use UUID (json:"uuid") as primary ID, drop json:"id"
AutomationRule — wrap in {"rule": ...} envelope for GET responses
- All commands that display IDs — use UUID instead of numeric ID
- Pagination — follow
links.next instead of top-level next
- Verify create/update/state endpoints accept the same format they return
Files to modify
tools/jtk/api/automation_types.go — fix all type definitions
tools/jtk/api/automation.go — fix response parsing, pagination
tools/jtk/api/automation_test.go — update mock responses to match real API
tools/jtk/internal/cmd/automation/list.go — use UUID for ID column
tools/jtk/internal/cmd/automation/get.go — use UUID, handle envelope
tools/jtk/internal/cmd/automation/export.go — may need to unwrap envelope
tools/jtk/internal/cmd/automation/update.go — use UUID
tools/jtk/internal/cmd/automation/enable.go — use UUID
- All command tests — update accordingly
Bug: Automation API types don't match actual Jira Cloud API responses
Discovery
Integration testing against
monitproduct.atlassian.netrevealed that the automation command types were built from API documentation that doesn't match the actual response format. All automation commands silently fail — they get 200 OK but can't parse the responses.Mismatches Found
1. List/Summary endpoint (
GET /rule/summary)Actual response:
{ "links": {"self": null, "next": null, "prev": null}, "data": [ {"uuid": "018aed44-...", "name": "...", "state": "ENABLED", ...} ] }Our type expects:
datanotvalueslinks.nextnot top-levelnexttotalfielduuidnot numericid2. Get single rule endpoint (
GET /rule/{uuid})Actual response:
{ "rule": { "name": "...", "state": "ENABLED", "uuid": "018aed44-...", "trigger": { "component": "TRIGGER", "type": "...", ... }, "components": [ ... ], "ruleScopeARIs": ["ari:cloud:jira:..."], "labels": [], ... }, "connections": [...] }Our type expects: Rule at top level with
json:"id"andjson:"ruleKey"Key differences:
"rule"key, not at top leveluuidnotid— no numeric ID existscomponentsarrayruleScopeARIs(ARIs), notprojectsarraytagsfield (we have one)3. Rule summary objects
Actual fields:
{ "uuid": "018aed44-eda8-7f38-8dc8-4b6588c10073", "name": "ON/MON: Unblock Onboarding Tickets", "state": "ENABLED", "description": "...", "authorAccountId": "...", "actorAccountId": "...", "created": 1696197832.104, "updated": 1700430538.092, "labels": [], "ruleScopeARIs": ["ari:cloud:jira:..."] }Our type maps:
ID→json:"id"(doesn't exist),UUID→json:"ruleKey"(should beuuid)Impact
jtk auto list— returns "No automation rules found" (parsesdataas nilvalues)jtk auto get <id>— likely fails or returns empty (rule nested under"rule")jtk auto export <id>— returns raw JSON so may partially workjtk auto update— may send wrong formatjtk auto create— may send wrong formatjtk auto enable/disable— unknown, state endpoint format not yet verifiedFix Required
AutomationRuleSummaryResponse— useData(json:"data") and nestedLinksstructAutomationRuleSummary— useUUID(json:"uuid") as primary ID, dropjson:"id"AutomationRule— wrap in{"rule": ...}envelope for GET responseslinks.nextinstead of top-levelnextFiles to modify
tools/jtk/api/automation_types.go— fix all type definitionstools/jtk/api/automation.go— fix response parsing, paginationtools/jtk/api/automation_test.go— update mock responses to match real APItools/jtk/internal/cmd/automation/list.go— use UUID for ID columntools/jtk/internal/cmd/automation/get.go— use UUID, handle envelopetools/jtk/internal/cmd/automation/export.go— may need to unwrap envelopetools/jtk/internal/cmd/automation/update.go— use UUIDtools/jtk/internal/cmd/automation/enable.go— use UUID