← Back to PRs

#3727: fix(googlechat): space type detection for modern API

by gustavozirbes open 2026-01-29 03:25 View on GitHub →
channel: googlechat
## Summary - Fix space type detection to use modern `spaceType` field instead of deprecated `type` - Add backwards-compatible fallback for legacy API responses ## Problem Google Chat deprecated `space.type` (values: `DM`, `ROOM`) in favor of `space.spaceType` (values: `DIRECT_MESSAGE`, `GROUP_CHAT`, `SPACE`). Modern API responses may only include `spaceType`, causing the integration to misidentify space types and return bad request errors for group chats/spaces. ## References - [Google Chat spaces REST API](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces) - documents `spaceType` enum values - [Google Chat Event reference](https://developers.google.com/workspace/chat/api/reference/rest/v1/Event) - webhook payload structure ## AI-Assisted 🤖 - [x] AI-assisted (Claude) - [x] Lightly tested (unit tests pass, no live Google Chat testing) - [x] I understand what the code does <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates Google Chat space type detection to support the modern `space.spaceType` field (e.g., `DIRECT_MESSAGE`, `GROUP_CHAT`, `SPACE`) and adds unit tests for the new resolution logic. It introduces `resolveSpaceType()` in `extensions/googlechat/src/monitor.ts` and uses it when deciding whether an inbound message is a group chat vs DM, with a fallback to the deprecated legacy `space.type` field. <h3>Confidence Score: 4/5</h3> - This PR is mostly safe to merge; it’s a small behavioral change with test coverage, with one edge-case mapping that could misclassify legacy space types. - Changes are localized (space type normalization + tests) and should fix modern API payloads. The main concern is the legacy `type` fallback mapping any non-`DM` value to `SPACE`, which could over-classify unknown/empty legacy values as group chats and affect policy enforcement paths. - extensions/googlechat/src/monitor.ts (legacy type fallback mapping logic) <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs