feat(time): resolve named sync ranges in IANA timezone - #416
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds timezone-aware resolution for named sync range boundaries (now, today, yesterday) so a single captured clock instant can be rendered into provider-appropriate physical/civil/daily boundaries (including DST edge cases) while preserving existing explicit date/RFC3339 behavior and exclusive --to semantics.
Changes:
- Introduces a new range resolver that resolves named boundaries in an explicit IANA timezone (defaulting to UTC) and preserves exact instants for preflight ordering.
- Threads
--timezoneand a single capturedresolvedAtthrough sync planning/execution so fan-out members share one resolution clock. - Updates CLI surface area and documentation (flags,
--statusconflicts, completion tests, and command docs), plus expands test coverage for DST/skipped-date/fold and fractional precision.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/googlehealth/rollup_spec.go | Allows named boundaries through rollup normalization and preserves fractional RFC3339 via RFC3339Nano formatting. |
| internal/googlehealth/rollup_spec_test.go | Adds coverage to ensure hourly rollup normalization preserves fractional RFC3339 precision. |
| internal/googlehealth/range_resolver.go | New resolver for named boundaries with IANA timezone handling and target-aware rendering (physical/civil/daily). |
| internal/googlehealth/range_resolver_test.go | Adds extensive tests for resolver behavior across targets, DST, skipped dates, fold instants, and precision. |
| docs/commands/sync.md | Documents --timezone and named boundaries semantics, including DST/skipped-date behavior. |
| cmd/gohealthcli/sync.go | Adds --timezone flag and validates explicitly provided empty timezone. |
| cmd/gohealthcli/sync_timezone_test.go | End-to-end tests asserting named boundaries reach correct provider filters per target shape and that cursor stores exact resolved --to. |
| cmd/gohealthcli/sync_status.go | Adds --timezone to the deterministic conflict list for sync --status. |
| cmd/gohealthcli/sync_status_test.go | Tests --timezone conflict handling with --status. |
| cmd/gohealthcli/sync_preflight_gate.go | Integrates range resolution into preflight, preserves legacy default-to behavior when applicable, and tightens ordering checks using exact instants. |
| cmd/gohealthcli/sync_preflight_gate_test.go | Adds tests for local-now resolution, explicit-boundary ordering, DST/fold handling, and shared resolution clock behavior. |
| cmd/gohealthcli/sync_orchestrator.go | Captures a single resolvedAt once per fan-out invocation when absent. |
| cmd/gohealthcli/sync_orchestrator_test.go | Tests that one captured range clock is shared across fan-out members. |
| cmd/gohealthcli/completion_test.go | Adds completion directive coverage for sync --timezone. |
| cmd/gohealthcli/commands.go | Updates generated command registry text to describe named boundaries + --timezone. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Outcome
sync --timezone <IANA-zone>with UTC fallback and exactnow,today, andyesterdayinputs--to, strict preflight, and exact provider-string cursor semanticsnowCloses #402
Proof
go test ./...go test -race ./...make fmt-checkgo vet ./...make docs-checkmake docs-sitego mod verifyandgo mod tidy -diffRisk and scope
No schema, migration, provider write, credential, release, or publication changes. Sync planning resolves once; execution consumes the planned provider strings, and completed-run cursor advancement still stores the exact resolved exclusive
--to. Embedded timezone data and persisted config precedence remain scoped to #403; resolved-range status/audit exposure remains scoped to #405.Dependency freshness was audited without widening this feature PR. Available module updates are unrelated; this change adds no dependency.