Skip to content

v0.5.0 — Day Mode

Choose a tag to compare

@liviro liviro released this 24 Apr 00:56
· 117 commits to main since this release

What's new

Day mode — nap and day-feed tracking

  • New day subgraph: Awake, Feeding, Napping, Diaper change — tracked with the same event-sourced model as the night
  • Chain-advance: Start day closes the night, Start night closes the day (single event at the boundary — no "end night" dead-end)
  • Nap location metadata (crib / stroller / on me / car) on every start_sleep
  • Server picks the right action set per state — client never branches on day vs night

Cycles replace nights as the history primitive

  • A cycle is a (day, night) pair — one card per 24h midnight-to-midnight window on the History page
  • 24h timeline bar: state-colored segments showing the full rhythm of the day; previous night's sleep tail prepends across the midnight boundary
  • Live sleep/wake duration pills — teal for naps, red for awake windows; the in-progress segment blinks
  • Per-cycle stats: nap count, total nap time, day feed count/duration, wake windows, last wake window before bedtime
  • Moving averages for day and night are computed independently (a cycle with only a night half averages across nights alone)

Architecture

  • Unified sessions table (kind: day | night) replaces the old nights table; all events reference session_id
  • Single-transaction legacy migration with atomic rollback: the DB either fully migrates or stays bit-identical to before
  • New fidelity test seeds 20 realistic nights + 1 open and asserts byte-for-byte preservation of IDs, seq, timestamps, metadata JSON, and Ferber fields across the migration
  • SQLite partial UNIQUE on sessions((1)) WHERE ended_at IS NULL — indexing a constant so "at most one open session" actually bites (NULLs-are-distinct gotcha)
  • Chain-aware undo: undoing a chain-advance reopens the prior session atomically

Other UI improvements

  • History page: cycle cards with tinted day/night sections
  • Midnight-anchored timeline bars (was: 7am-anchored — harder to read)
  • Trend chart disambiguators so day-feed and night-feed charts are no longer ambiguously titled
  • Real bedtime chart moved up one slot with its own moving-average line

State machine: 17 states, 53 transitions