-
Notifications
You must be signed in to change notification settings - Fork 1
fix: automation API response types don't match actual API #81
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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"
}datanotvalueslinks.nextnot top-levelnext- No
totalfield - Rules identified by
uuidnot numericid
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
uuidnotid— no numeric ID exists - Trigger is a separate field from
componentsarray - Projects represented as
ruleScopeARIs(ARIs), notprojectsarray - No
tagsfield (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" (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 verified
Fix Required
AutomationRuleSummaryResponse— useData(json:"data") and nestedLinksstructAutomationRuleSummary— useUUID(json:"uuid") as primary ID, dropjson:"id"AutomationRule— wrap in{"rule": ...}envelope for GET responses- All commands that display IDs — use UUID instead of numeric ID
- Pagination — follow
links.nextinstead of top-levelnext - Verify create/update/state endpoints accept the same format they return
Files 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- All command tests — update accordingly
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working