Skip to content

feat: adopt typed timestamps from flashduty-sdk (RFC3339 output)#23

Merged
ysyneu merged 2 commits into
mainfrom
feat/adopt-sdk-timestamp
May 29, 2026
Merged

feat: adopt typed timestamps from flashduty-sdk (RFC3339 output)#23
ysyneu merged 2 commits into
mainfrom
feat/adopt-sdk-timestamp

Conversation

@ysyneu
Copy link
Copy Markdown
Contributor

@ysyneu ysyneu commented May 29, 2026

What

Adopt the new self-describing timestamp types from flashduty-sdk so structured (JSON/TOON) output renders RFC3339 strings instead of opaque Unix integers.

Depends on flashduty-sdk PR #20 (flashcatcloud/flashduty-sdk#20). go.mod pins the SDK at the PR branch commit via pseudo-version; will re-pin to the tagged/merged SHA once #20 lands.

Changes

  • internal/output/table.goFormatTime now takes a tiny local instant interface (Time() time.Time; IsZero() bool), satisfied by both flashduty.Timestamp and flashduty.TimestampMilli. No more int64 plumbing.
  • internal/cli/incident.go — removed formatWarRoomCreatedAt: its magnitude-based ms/sec guess is obsolete now that war-room created_at is a typed (seconds) Timestamp. War-room CREATED column uses output.FormatTime directly. CreateIncident reads the typed result.IncidentID instead of a map[string]any assert.
  • internal/cli/root.go, status_page.go — client-interface signatures + call sites updated for the typed SDK returns.
  • Tests: updated mocks/tables; added internal/output/structured_time_test.go.

Verification

  • go build ./... && go vet ./... && go test -race ./... — all green
  • gofmt -l on changed files — clean
  • golangci-lint run ./... (v2.11.4) — 0 issues

Note (out of scope)

The Makefile's golangci-lint pin (v2.2.1) can't lint a go1.25 module locally; CI uses golangci-lint-action and is unaffected. Left untouched to keep this PR scoped to SDK adoption — flagging as a separate pre-existing fix.

Bump flashduty-sdk to the Timestamp/TimestampMilli release: response time
fields are now self-describing types that render RFC3339, so structured
(JSON/TOON) output shows readable timestamps for free.

- FormatTime takes a small local `instant` interface (satisfied by both
  flashduty.Timestamp and flashduty.TimestampMilli) instead of int64.
- Remove formatWarRoomCreatedAt: its magnitude-based ms/sec guess is obsolete
  now that war-room created_at is a typed (seconds) Timestamp.
- CreateIncident/CreateStatusIncident now return typed structs; read the typed
  IncidentID/ChangeID instead of map[string]any asserts.
@ysyneu ysyneu merged commit eaea632 into main May 29, 2026
12 checks passed
@ysyneu ysyneu deleted the feat/adopt-sdk-timestamp branch May 29, 2026 04:15
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