Skip to content

feat(gmail): add history types filter to watch serve#170

Open
salmonumbrella wants to merge 6 commits intosteipete:mainfrom
salmonumbrella:feat/gmail-filters
Open

feat(gmail): add history types filter to watch serve#170
salmonumbrella wants to merge 6 commits intosteipete:mainfrom
salmonumbrella:feat/gmail-filters

Conversation

@salmonumbrella
Copy link
Contributor

Summary

  • Add --history-types flag to gmail watch serve to filter which history events trigger notifications (messageAdded, messageDeleted, labelAdded, labelRemoved)
  • Default to messageAdded for backward compatibility when the flag is specified
  • Separate deleted message IDs from fetchable messages to avoid 404 errors when fetching deleted messages
  • Fix variable shadowing lint warnings in store.Update() calls

Test Plan

  • All 67 Watch-related tests pass
  • golangci-lint reports 0 issues
  • Manual testing with Gmail push notifications

🤖 Generated with Claude Code

salmonumbrella and others added 6 commits February 2, 2026 20:09
The commit 5137fcb added --history-types flag but changed the default
behavior: when not specified, it now fetched ALL history types instead
of just messageAdded (the previous hardcoded behavior).

This fix ensures backward compatibility by defaulting to messageAdded
when --history-types is not provided.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When messageDeleted history type is requested, deleted messages cannot
be fetched from Gmail API (returns 404). Now collectHistoryMessageIDs
returns a struct with separate FetchIDs and DeletedIDs lists, and the
hook payload includes deletedMessageIds field for consumers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add canonical forms to history type alias map for robustness
- Add length assertion for FetchIDs in TestCollectHistoryMessageIDs
- Clarify documentation that default is messageAdded
- Add test for empty input edge case in parseHistoryTypes
- Extract duplicate state update logic into updateStateAfterHistory helper

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename inner `err` to `updateErr` to avoid shadowing the outer
variable, satisfying golangci-lint's govet shadow checker.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rename inner `err` to `updateErr` in two additional store.Update()
calls to avoid shadowing outer variables, completing the fix from
commit 71714ae. Both locations now match the established pattern.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

1 participant