feat(calendar): add --event-types filter to calendar events#870
Conversation
Add an opt-in --event-types flag to `calendar events`, passed through to the Calendar API events.list eventTypes parameter. It accepts the six API event types plus friendly aliases (focus-time, ooo, working-location/wl, from-gmail, ...), repeatable or comma-separated, canonicalized and deduplicated, and is honored across single-calendar, --cal/--calendars, and --all paths. Without a filter, events.list returns every event type, so birthday, workingLocation, and fromGmail entries are interleaved with real meetings in a "what's on my calendar" view. When the flag is omitted no eventTypes param is sent, so the default (all types) is unchanged; a flag that is present but resolves to no values is a usage error. Event-type aliases now live in a single eventTypeAliases map shared by the create/update path (restricted to the user-creatable types) and the events.list filter (which accepts all six, including the read-only birthday and fromGmail). Tests cover both normalizers, the resolver, the shared-map invariant, and that the eventTypes query param reaches the API when set (single-calendar and across the --cal/--all paths) and is absent when unset. Command docs regenerated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Codex review: needs maintainer review before merge. Reviewed June 22, 2026, 8:31 PM ET / 00:31 UTC. Summary Reproducibility: not applicable. this is a feature PR rather than a bug report. The PR body includes live command output showing the new filtered behavior against a real Calendar account. Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Next step before merge
Security Review detailsBest possible solution: Review and land the focused opt-in filter after normal checks and maintainer approval, preserving the unchanged default event listing behavior. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a feature PR rather than a bug report. The PR body includes live command output showing the new filtered behavior against a real Calendar account. Is this the best way to solve the issue? Yes: an opt-in server-side AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against fc13b4147e20. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
What
Adds an opt-in
--event-typesflag togog calendar events, passed through to the Calendar APIevents.listeventTypesparameter.Why
Without a filter,
events.listreturns every event type, sobirthday,workingLocation, andfromGmailentries come back mixed in with regular events — with no way to focus on the common event types a caller is usually interested in, or to filter down to just the subset they want and clear out the rest. The API supports this server-side via the repeatableeventTypesparameter; this exposes it.Changes
--event-typesoncalendar events, repeatable or comma-separated, honored across single-calendar,--cal/--calendars, and--allpaths.default,birthday,focus-time/focusTime,from-gmail/fromGmail,out-of-office/ooo,working-location/wl. Values are canonicalized and de-duplicated.eventTypesparam is sent, so all types are returned exactly as before. A flag that is present but resolves to no values (e.g.--event-types "") is a usage error, matchinggmail watch --history-types.eventTypeAliasesmap: the create/update path restricts to the user-creatable types, while the filter accepts all six (including the read-onlybirthday/fromGmail). This consolidated the previous create-pathswitch.docs/spec.md+ regenerated command reference.Deliberately not in this PR (happy to add on your call)
--plain/table columns.--plainis the stable parseable contract,--jsonalready includeseventType, andevent getalready prints it — so I left the human/TSV surfaces untouched to keep this strictly additive. If surfacing the event type in the list view would be useful, I'm happy to follow up; I'd defer to you on the form (e.g. a new column vs. an opt-in flag).eventsshould hidebirthday/workingLocationby default is a reasonable question but a breaking one, so this PR just provides the filter and leaves the default as-is.eventTypesadds another positional param to the already-longcalendar_list.golist helpers. I kept it consistent with the existing style rather than refactoring here, but I'd be happy to follow up with a small PR bundling those params intoquery/viewstructs if that cleanup would be welcome.Testing
birthday/fromGmail), the flatten/dedupe resolver (incl. the present-but-empty error), and a guard test for the shared-map invariant (every creatable type is aliased).eventTypesquery param is sent (in order) when set and absent when unset — at the single-calendar call and across the--cal/--allpaths.make fmt-check lint docs-checkclean; calendar tests pass under-race.Live (real account, event-type tallies)
No
CHANGELOG.mdentry (treated as release-owned) — happy to add one if you'd prefer.