feat(config): persist the range-resolution timezone - #417
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a persisted root timezone configuration and threads that resolved timezone through init, sync preflight, and doctor, while embedding IANA tzdata to ensure cross-platform timezone resolution without relying on machine-local settings.
Changes:
- Add root
timezoneconfig persistence (defaulting new configs to explicitUTC) andinit --timezonevalidation. - Resolve
syncnamed boundaries using precedence--timezone> configtimezone> implicitUTCfor legacy configs, and validate invalid/empty zones before any provider/archive effects. - Expose the resolved timezone via
doctoroutput and update command registry + generated docs accordingly.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/googlehealth/range_resolver.go | Embed tzdata and centralize timezone loading/validation for range resolution. |
| docs/commands/sync.md | Document timezone precedence and updated preflight rejection semantics. |
| docs/commands/init.md | Document init --timezone and explicit UTC persistence in new configs. |
| docs/commands/doctor.md | Document doctor reporting of resolved timezone (including legacy UTC). |
| cmd/gohealthcli/sync_timezone_test.go | Add regression tests for config precedence, legacy UTC behavior, and pre-effect rejection. |
| cmd/gohealthcli/sync_preflight_gate.go | Add config timezone lookup/caching to preflight and pass resolved timezone into range resolver. |
| cmd/gohealthcli/sync_preflight_gate_test.go | Update fake preflight context to provide a configured timezone. |
| cmd/gohealthcli/result_writer_bytes_test.go | Update doctor writer fixtures/expectations to include timezone. |
| cmd/gohealthcli/init.go | Add --timezone flag, validate it early, and persist to config. |
| cmd/gohealthcli/init_test.go | Add tests for timezone persistence and early rejection (invalid/empty). |
| cmd/gohealthcli/doctor.go | Include timezone in doctor JSON/plain/human outputs. |
| cmd/gohealthcli/doctor_test.go | Add coverage for legacy configs reporting implicit UTC timezone. |
| cmd/gohealthcli/config.go | Parse root timezone, validate it, and default legacy configs to UTC. |
| cmd/gohealthcli/commands.go | Update command registry docs for init, sync, and doctor to reflect timezone behavior. |
💡 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
timezoneconfig value and addinit --timezone, with new configs writingUTCexplicitly--timezoneflag, then config, then implicit UTC for legacy configsdoctorand update the command registry plus generated docsCloses #403
Proof
go test ./... -count=1go test -race ./... -count=1make fmt-checkandgo vet ./...make docs-checkandmake docs-sitego mod verifyandgo mod tidy -diffRisk and scope
No schema, migration, provider contract, credential, release, version, tag, or dependency changes. Existing configs without
timezoneremain UTC. The prior named-range implementation landed in #416 and is the only feature dependency; this PR is scoped to persisted resolution policy and doctor exposure.