fix(calendar): fall back to UTC when primary calendar is unavailable#3
Merged
delight-ai-agent merged 1 commit intomainfrom Mar 3, 2026
Merged
Conversation
In pure service-account mode, the SA has no "primary" calendar, causing
getUserTimezone() to fail with a 404 from CalendarList.Get("primary").
This blocked all calendar commands that resolve time ranges.
When the primary calendar lookup returns 404, fall back to UTC instead
of failing. A WARN log is emitted so the fallback is visible with -v.
Closes #2
✍️ Author: Claude Code with @carrotRakko (AI-written, human-approved)
carrotRakko
approved these changes
Mar 3, 2026
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.
Summary
Calendar commands (
calendar events,calendar create,calendar search, etc.) fail with404 notFoundin pure service-account mode becausegetUserTimezone()unconditionally callsCalendarList.Get("primary"). A service account running without impersonation has no primary calendar.Changes
internal/cmd/time_helpers.go— whenCalendarList.Get("primary")returns 404, fall back to UTC instead of failing. AWARNlog is emitted so the fallback is visible with-v.internal/cmd/time_helpers_sa_test.go— 2 test cases:getUserTimezonereturns UTC on 404,ResolveTimeRangesucceeds end-to-end with 404 primary.Test plan
go test ./internal/cmd/ -run "TestGetUserTimezone_PrimaryNotFound|TestResolveTimeRange_PrimaryNotFound"— new tests passgo test ./internal/cmd/ -run "TestResolveTimeRange|TestGetUserTimezone|TestCalendarTime"— all existing tests passgog calendar events,gog calendar create,gog calendar deleteall workCloses #2
✍️ Author: Claude Code with @carrotRakko (AI-written, human-approved)