Skip to content

fix(incident): fetch get by id through /incident/list-by-ids - #214

Merged
ysyneu merged 1 commit into
feat/incident-getfrom
fix/incident-get-list-by-ids
Oct 9, 2026
Merged

ysyneu merged 1 commit into
feat/incident-getfrom
fix/incident-get-list-by-ids

Conversation

@ysyneu

@ysyneu ysyneu commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Problem

flashduty incident get <id> [<id2>...] sent only incident_ids to POST /incident/list. That endpoint binds start_time / end_time as required, so every call failed:

Error: flashduty: EndTime is a required field, StartTime is a required field (code InvalidParameter, http 400)

The existing test stub answered every path with the same canned rows and never checked which endpoint was called, so the suite stayed green.

Fix

  • get fetches through Incidents.ListByIDs (POST /incident/list-by-ids), which takes ids alone and returns the same incident row shape. Its help now uses the ListByIDs response description (top-level array, unchanged for jq '.[]' users).
  • Short-id (num) resolution is unchanged: it still goes through /incident/list with its 30-day lookback.
  • Tests assert the request path: short id → [/incident/list, /incident/list-by-ids]; full id → [/incident/list-by-ids] only. Both new assertions fail on the previous code.

Verification

  • make check (fmt, lint, test -race, build): green. make gen-cards: no card diff.
  • Against a live dev backend with the built binary:
    • incident get <full-id> --json → record with num, progress, detail_url
    • incident get <num> → resolves and returns the record
    • incident get <id1> <id2> <id3> → 3 rows (json and table)
    • The old wire shape (/incident/list with ids only) reproduces the 400 above on the same backend.

🤖 Generated with Claude Code

`incident get <id>...` sent only incident_ids to /incident/list. That
endpoint requires a start_time/end_time window, so every call failed with
"StartTime is a required field, EndTime is a required field" (HTTP 400).

Fetch through /incident/list-by-ids, which takes ids alone and returns the
same row shape. Short-id resolution still goes through /incident/list with
its 30-day lookback. Tests now assert the request path, which the previous
stub did not check.
@ysyneu
ysyneu merged commit b09f7bd into feat/incident-get Oct 9, 2026
15 of 17 checks passed
@ysyneu
ysyneu deleted the fix/incident-get-list-by-ids branch October 9, 2026 05:41
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