Skip to content

fix(calendar): fall back to UTC when primary calendar is unavailable#3

Merged
delight-ai-agent merged 1 commit intomainfrom
fix/calendar-sa-pure-mode-timezone
Mar 3, 2026
Merged

fix(calendar): fall back to UTC when primary calendar is unavailable#3
delight-ai-agent merged 1 commit intomainfrom
fix/calendar-sa-pure-mode-timezone

Conversation

@delight-ai-agent
Copy link
Member

Summary

Calendar commands (calendar events, calendar create, calendar search, etc.) fail with 404 notFound in pure service-account mode because getUserTimezone() unconditionally calls CalendarList.Get("primary"). A service account running without impersonation has no primary calendar.

Changes

  • internal/cmd/time_helpers.go — when CalendarList.Get("primary") returns 404, fall back to UTC instead of failing. A WARN log is emitted so the fallback is visible with -v.
  • internal/cmd/time_helpers_sa_test.go — 2 test cases: getUserTimezone returns UTC on 404, ResolveTimeRange succeeds end-to-end with 404 primary.

Test plan

  • go test ./internal/cmd/ -run "TestGetUserTimezone_PrimaryNotFound|TestResolveTimeRange_PrimaryNotFound" — new tests pass
  • go test ./internal/cmd/ -run "TestResolveTimeRange|TestGetUserTimezone|TestCalendarTime" — all existing tests pass
  • Manual verification with real SA: gog calendar events, gog calendar create, gog calendar delete all work

Closes #2

✍️ Author: Claude Code with @carrotRakko (AI-written, human-approved)

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)
@delight-ai-agent delight-ai-agent merged commit c72e05a into main Mar 3, 2026
2 of 8 checks passed
@delight-ai-agent delight-ai-agent deleted the fix/calendar-sa-pure-mode-timezone branch March 3, 2026 10:28
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.

Calendar commands fail with 404 in pure SA mode (getUserTimezone fetches CalendarList/primary)

2 participants