Problem
The two codecs for sleep disagree on both units and shape for the same quantities.
--format csv computes flat, minute-valued columns: total_sleep_min, light_min, deep_min, rem_min (cmd/sleep.go:167,174-177).
--format json passes the upstream blob straight through — Data json.RawMessage (cmd/sleep.go:24) — so the same durations arrive nested and in seconds, and there is no total_sleep_min equivalent at all.
So sleep --format json and sleep --format csv are not two encodings of one dataset; they're two different datasets. A consumer switching codecs has to rewrite its unit handling and its field paths.
Relationship to #27
#27 covers this same JSON/CSV divergence for workouts explicitly. It does not cover sleep. #21 is about float precision in the --derive path, not the flat/nested unit split. So this is unfiled.
If #27 grows into a general "JSON and CSV must carry the same fields in the same units" fix, this can fold into it and be closed — flagging it separately so sleep doesn't get fixed by accident or missed entirely.
Note
This is also an instance of the org-level gap filed as quantcli/common#27 — nothing in the shared contract currently says the same logical field must keep one type and one unit across codecs and subcommands.
Problem
The two codecs for
sleepdisagree on both units and shape for the same quantities.--format csvcomputes flat, minute-valued columns:total_sleep_min,light_min,deep_min,rem_min(cmd/sleep.go:167,174-177).--format jsonpasses the upstream blob straight through —Data json.RawMessage(cmd/sleep.go:24) — so the same durations arrive nested and in seconds, and there is nototal_sleep_minequivalent at all.So
sleep --format jsonandsleep --format csvare not two encodings of one dataset; they're two different datasets. A consumer switching codecs has to rewrite its unit handling and its field paths.Relationship to #27
#27 covers this same JSON/CSV divergence for
workoutsexplicitly. It does not coversleep. #21 is about float precision in the--derivepath, not the flat/nested unit split. So this is unfiled.If #27 grows into a general "JSON and CSV must carry the same fields in the same units" fix, this can fold into it and be closed — flagging it separately so
sleepdoesn't get fixed by accident or missed entirely.Note
This is also an instance of the org-level gap filed as quantcli/common#27 — nothing in the shared contract currently says the same logical field must keep one type and one unit across codecs and subcommands.