Skip to content

Commit ddc957f

Browse files
willwashburnclaude
andauthored
refactor(cli): switch compare to relayburn_sdk::normalize_since (#421)
* refactor(cli): switch compare to relayburn_sdk::normalize_since `burn compare` was the only presenter still carrying its own `normalize_since` + Hinnant civil-date math; the SDK has exposed `normalize_since` for a while and the sibling `summary` and `hotspots` presenters already use it. Delete the local helpers and their tests, drop ~380 LOC of duplicated date plumbing. The cli-golden snapshot still matches. Closes #333 https://claude.ai/code/session_01VFvKstujMoXwZkP5vwrHxQ * fix(sdk): canonicalize normalize_since to UTC .mmmZ Codex / Devin / coderabbit flagged a latent regression on PR #421: the SDK's `normalize_since` returned relative ranges as `...SSZ` (no millis) and passed ISO inputs through unchanged. Because the ledger filter is `ts >= ?` against `.mmmZ` rows in SQLite (lex-compared), this silently dropped same-second turns (`.` < `Z`) and misordered offset-bearing cutoffs (e.g. `-07:00` sorting before any UTC row). This was already true for `burn summary` and `burn hotspots`; PR #421 just made `burn compare` adopt the same behavior. The fix is in the SDK so all three presenters get consistent, correct date filtering: - Relative ranges emit canonical `YYYY-MM-DDTHH:MM:SS.000Z` (24 chars). - ISO inputs parse and re-emit as UTC `.mmmZ`: offsets get converted (`...-07:00` → `...07:00:00.000Z`), no-fraction widens to `.000Z`, sub-ms truncates to ms, `Z`/`z` and date-only forms supported. - Garbage errors out (no more `looks_like_iso` permissive pass-through). Tests cover each shape and the lex-compare property against ledger rows. Also rewords the CHANGELOG bullet to be user-impact-first per coderabbit's note. https://claude.ai/code/session_01VFvKstujMoXwZkP5vwrHxQ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 67d7255 commit ddc957f

3 files changed

Lines changed: 292 additions & 419 deletions

File tree

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ Cross-package release notes for relayburn. Package changelogs contain package-le
44

55
## [Unreleased]
66

7+
### Changed
8+
9+
- `relayburn-cli`: `burn compare --since` now uses the same normalization path
10+
as `burn summary` and `burn hotspots`, keeping date-filter behavior
11+
consistent across commands.
12+
- `relayburn-sdk`: `normalize_since` now canonicalizes outputs to UTC
13+
`YYYY-MM-DDTHH:MM:SS.mmmZ`. Relative ranges (`7d`, `24h`) emit `.000Z`
14+
instead of `Z`, and ISO inputs with offsets (e.g. `...-07:00`) are
15+
converted to UTC. This fixes `burn summary` / `burn hotspots` /
16+
`burn compare --since` silently dropping same-second turns and misordering
17+
offset cutoffs against the ledger's `ts >= ?` lex compare.
18+
719
## [2.8.5] - 2026-05-12
820

921
### Changed

0 commit comments

Comments
 (0)