Skip to content

fix(db): say under hr and battery rows that day is the UTC date of each sample - #178

Merged
drakulavich merged 2 commits into
mainfrom
fix/rows-utc-note
Oct 25, 2026
Merged

drakulavich merged 2 commits into
mainfrom
fix/rows-utc-note

Conversation

@drakulavich

Copy link
Copy Markdown
Owner

Closes #131.

Planned together with #129 (#177), but the two are unrelated, so each has its own PR.

What

db rows hr and db rows battery end the table view with one line, wrapped at the screen width:

  day is the UTC date of each sample; rows are selected by the local day in Asia/Dubai.

The line appears only for a ranged timeseries (rangeParams: 'datetime') that returned rows. Daily collections, the ring snapshot, an empty result and JSON output are unchanged.

Why

Rows are bounded on the local day, as fetch bounds its request, while day stores the UTC date of the sample (README, agents section). Before this, db rows battery --day 2026-09-10 in Asia/Dubai listed rows dated 2026-09-09, and nothing on screen said why.

How checked

  • New test in src/commands/db.test.ts: a temp cache with one battery sample at 2026-09-09T22:00:00+00:00, read with --tz Asia/Dubai --day 2026-09-10. The row is listed with day 2026-09-09 and the last line is the note. db rows tags on the same cache prints no note. The test fails on main.
  • Mutation, reverted after one run of src/commands/db.test.ts: const utcNote = range !== null && c.rangeParams === 'datetime' && rows.length > 0 → const utcNote = false: 1 of 19 fails (the new test).
  • bun run check: typecheck, Biome, Knip clean; 712 tests pass.
  • Codex review: Approve, no findings (report in the first comment).

Overlap: src/commands/db.ts is also changed by #176 (descriptions, different lines).

🤖 Generated with Claude Code

https://claude.ai/code/session_018qh9xqviBHYmzVtmQWSKqA

…h sample

db rows hr and battery bound their rows on the local day while the day
column holds the sample's UTC date, so a row could read the day before
the one in the title with nothing on screen to explain it. The table
view now ends with one line saying so, naming the timezone.

Closes #131

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018qh9xqviBHYmzVtmQWSKqA
@drakulavich

Copy link
Copy Markdown
Owner Author

Codex review (gpt-6-luna, final, ebcf1cc..42c1f16):

Simplification: not needed

Verdict: Approve

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the remaining test gap is non-blocking.

Findings

  1. P2 Daily-table check can pass incorrectly ▶

Summary

Adds a wrapped explanation below nonempty hr and battery tables: day shows the UTC date, while row selection follows the chosen local day.

  • Heart-rate and battery tables explain why sample dates differ from local days.

Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

Comment thread src/commands/db.test.ts
Comment on lines +218 to +219
const tags = rows('tags');
expect(await new Response(tags.stdout).text()).not.toContain('UTC');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Daily-table check can pass incorrectly

The tags check reads an empty collection, so it passes even if the note is wrongly added to every nonempty daily table. It also passes if the command fails and writes nothing to stdout. Insert a daily row inside the requested range, assert a successful exit, and then check that its table has no note.

@drakulavich
drakulavich merged commit ec7e152 into main Oct 25, 2026
2 checks passed
@drakulavich
drakulavich deleted the fix/rows-utc-note branch October 25, 2026 14:17
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.

db rows: the day column of a timeseries contradicts the title's day without a note

1 participant