Skip to content

Servings JSON 'Day' field is always null — dead schema field #43

Description

@DTTerastar

QA finding: every row of crono-export servings --format json includes a Day field whose value is always null:

$ crono-export servings --since 90d --format json | jq '[.[] | .Day] | unique'
[
  null
]

This is documented in the prime GOTCHAS ("'servings' rows have a 'Day' field that is always null — use 'RecordedTime'"), so it's a known wart — but documenting it doesn't make it less wrong. Consumers waste a key on a sentinel; jq recipes that introspect schemas have to special-case it.

Two reasonable fixes:

  1. Drop the field from ServingRecord (json tag with omitempty or remove entirely). Cleanest.
  2. Populate it from RecordedTime's local-date portion if it's meant to be a denormalized convenience. Keeps the field but makes it useful.

I lean #1 — RecordedTime already carries the info, the GOTCHAS note already tells users to use it.

Once fixed, remove the corresponding line from cmd/prime.go GOTCHAS.

Severity: trivial (cosmetic schema cleanup)

Activity

  1. added
    kind:bugObserved behavior diverges from documented behavior.
    area:format--format markdown/json/csv and codec behavior.
    priority:lowPolish, cosmetic, or open-ended discussion with no immediate action.
    on May 19, 2026
  2. Terastar-Paperclip commented on May 19, 2026

    @Terastar-Paperclip
    Contributor

    Triage:

    • kind:bug · area:format · priority:low
    • Bucket: low under TRIAGE.md — cosmetic schema cleanup, no data integrity impact.
    • Repro is complete (jq sample). Two options listed; preference for option 1 (drop the field) noted.

    No CONTRACT.md change — JSON shape inside a record is not standardized in the contract. Engineering ownership.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:format--format markdown/json/csv and codec behavior.kind:bugObserved behavior diverges from documented behavior.priority:lowPolish, cosmetic, or open-ended discussion with no immediate action.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions