Skip to content

feat(cli): render API timestamps as RFC3339 in structured output#21

Closed
ysyneu wants to merge 1 commit into
mainfrom
feat/humanize-output-timestamps
Closed

feat(cli): render API timestamps as RFC3339 in structured output#21
ysyneu wants to merge 1 commit into
mainfrom
feat/humanize-output-timestamps

Conversation

@ysyneu
Copy link
Copy Markdown
Contributor

@ysyneu ysyneu commented May 28, 2026

Summary

  • Flashduty's API returns time fields as bare Unix integers, opaque to an LLM reading the CLI's JSON/TOON output. This humanizes them to RFC3339 (in the local/environment timezone) at the structured-output chokepoints — JSONPrinter, TOONPrinter, and marshalStructured.
  • Detection is by field name (*_time, *_at, timestamp), excluding ID-like fields (*_by/*_id/*_ids); values below 1e9 stay numeric so durations/counts aren't mistaken for dates; >=1e12 is treated as millis.
  • Table mode is unchanged (already formats via FormatTime). The flashduty-sdk is intentionally untouched — external users consume it directly.

Test plan

  • go test ./... green
  • Unit tests: seconds/millis, field-name detection, ID/duration/zero exclusion, nested/slice, typed struct, nil
  • Wiring tests drive the real JSONPrinter/TOONPrinter and assert no raw Unix int leaks
  • gofmt / go vet clean

Flashduty's API returns time fields as bare Unix integers, which are opaque
to an LLM reading the CLI's JSON/TOON output. Humanize them to RFC3339 (in the
local/environment timezone) at the structured-output chokepoints — JSONPrinter,
TOONPrinter, and marshalStructured. Detection is by field name (*_time, *_at,
timestamp), excluding ID-like fields (*_by/*_id/*_ids); values below 1e9 stay
numeric so durations/counts aren't mistaken for dates. Table mode is unchanged
(already formats via FormatTime).
@ysyneu
Copy link
Copy Markdown
Contributor Author

ysyneu commented May 29, 2026

Superseded by #23 (rebased onto the merged SDK timestamp design; scoped to SDK adoption, Makefile left untouched).

@ysyneu ysyneu closed this May 29, 2026
@ysyneu ysyneu deleted the feat/humanize-output-timestamps 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