fix(google-maps): validate integration against live API docs, add Places Nearby Search#5484
Conversation
…ces Nearby Search - add google_maps_places_nearby tool (Places API New, searchNearby) for radius/type-based place discovery - add pageToken support to places_search (text search pagination) - add units param to speed_limits (Roads API KPH/MPH) - wire homeMobileCountryCode/homeMobileNetworkCode subblocks for geolocate - split radius subblock so places_nearby's required radius isn't hidden in advanced mode - add default value to rankPreference dropdown - add missing authMode: AuthMode.ApiKey on the block
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Places text search gains The block sets Reviewed by Cursor Bugbot for commit 4a680f3. Configure here. |
Greptile SummaryThis PR validates the Google Maps block against live API docs, adds a new
Confidence Score: 4/5Safe to merge for all new tool functionality; a pre-existing structural concern in the block's subblock list warrants a follow-up. All seven tool files (new and modified) are correct: request construction, header handling, response transforms, and type definitions are well-formed. The block transform correctly parses string inputs to the expected number types with NaN guards throughout. The one open concern — two subblock entries sharing apps/sim/blocks/blocks/google_maps.ts — the duplicate radius subblock definition. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant UI as Block UI
participant Block as google_maps.ts (transform)
participant Registry as Tool Registry
participant NearbyTool as places_nearby.ts
participant GoogAPI as Places API (New)
UI->>Block: "operation=places_nearby, aqLatitude, aqLongitude, radius, placeType, rankPreference, maxResultCount"
Note over Block: Parses aqLatitude→lat, aqLongitude→lng,<br/>radius→parseInt, maxResultCount→parseInt,<br/>placeType→includedTypes[]
Block->>Registry: "tool=google_maps_places_nearby, {lat, lng, radius, includedTypes, rankPreference, ...}"
Registry->>NearbyTool: invoke with merged params
NearbyTool->>GoogAPI: "POST /v1/places:searchNearby<br/>X-Goog-Api-Key, X-Goog-FieldMask<br/>body: {locationRestriction:{circle:{center,radius}}, includedTypes, rankPreference, ...}"
GoogAPI-->>NearbyTool: "{places:[{id, displayName, formattedAddress, location, rating, ...}]}"
NearbyTool-->>Registry: "{success:true, output:{places:[{placeId, name, lat, lng, rating, ...}]}}"
Registry-->>UI: output.places
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant UI as Block UI
participant Block as google_maps.ts (transform)
participant Registry as Tool Registry
participant NearbyTool as places_nearby.ts
participant GoogAPI as Places API (New)
UI->>Block: "operation=places_nearby, aqLatitude, aqLongitude, radius, placeType, rankPreference, maxResultCount"
Note over Block: Parses aqLatitude→lat, aqLongitude→lng,<br/>radius→parseInt, maxResultCount→parseInt,<br/>placeType→includedTypes[]
Block->>Registry: "tool=google_maps_places_nearby, {lat, lng, radius, includedTypes, rankPreference, ...}"
Registry->>NearbyTool: invoke with merged params
NearbyTool->>GoogAPI: "POST /v1/places:searchNearby<br/>X-Goog-Api-Key, X-Goog-FieldMask<br/>body: {locationRestriction:{circle:{center,radius}}, includedTypes, rankPreference, ...}"
GoogAPI-->>NearbyTool: "{places:[{id, displayName, formattedAddress, location, rating, ...}]}"
NearbyTool-->>Registry: "{success:true, output:{places:[{placeId, name, lat, lng, rating, ...}]}}"
Registry-->>UI: output.places
Reviews (5): Last reviewed commit: "fix(google-maps): guard radius NaN parse..." | Re-trigger Greptile |
Google's Elevation API omits resolution when it can't be determined, but our output schema declared it as a required number. Also fixes a stale comment calling Speed Limits "deprecated" when it's actually Asset Tracking-license restricted.
- radius parsing in transformParams now guards NaN like every other numeric param in this block, so a non-numeric radius no longer silently sends "radius":null to the required Nearby Search field - pageToken description/placeholder now note the required delay before a token becomes valid, per Places Text Search API behavior
|
Responding to Greptile's two "Comments Outside Diff" findings from the last review round:
|
|
@greptile review |
|
@cursor review |
|
Follow-up on the outstanding `radius` duplicate-id question (previous reply cited cross-block precedent; here's the code-level proof). Traced the actual rendering path: `apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-editor-subblock-layout.ts:117` computes `visibleSubBlocks` via a plain array `.filter()` over `config.subBlocks`, evaluating each entry's `condition` against the current `operation` value (line 149-151, `evaluateSubBlockCondition`). This is not a `Record`/`Map` keyed by `id` — there is no dedup-by-key step anywhere in this path. Since the two `radius` entries have mutually exclusive conditions (`operation: 'places_search'` vs `operation: 'places_nearby'`), at most one can ever pass the filter for a given operation value, so `visibleSubBlocks` never contains two entries with the same `id` simultaneously — there's no scenario where the wrong variant's `required`/`mode` metadata could apply. This confirms it structurally, not just by precedent: the pattern is safe by construction. No change made. |
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4a680f3. Configure here.
|
@greptile this exact concern was already addressed with code-level proof — see the reply at #5484 (comment) above, which traces the actual render path in apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/hooks/use-editor-subblock-layout.ts:117. |
|
@greptile review |
Summary
google_maps_places_nearbytool (Places API NewsearchNearby) for radius/type-based place discovery — a distinct use case from the existing text-search tool, within the already-enabled Places APIpageTokensupport toplaces_searchfor paginating text search resultsunitsparam tospeed_limits(KPH/MPH per Roads API)homeMobileCountryCode/homeMobileNetworkCodesubblocks forgeolocate(existing tool params had no block inputs)radiussubblock so Nearby Search's required radius isn't buried in advanced mode while Text Search's stays optional/advancedrankPreferencedropdownauthMode: AuthMode.ApiKeyon the blockConsidered but not added (would need capabilities beyond this API key/JSON-output integration, not new API scopes): Place Photos (binary output, no blob-handling in this block) and Places Autocomplete (needs session-token billing semantics). Neither requires new API enablement, but both need architecture this integration doesn't have yet.
Type of Change
Testing
Tested manually.
bun run lintand typecheck pass clean.Checklist