Skip to content

fix(algolia): tighten tools.config, add geo/facet search + task-status tool; icon/color tweaks#5356

Merged
waleedlatif1 merged 8 commits into
stagingfrom
worktree-algolia-validate
Jul 2, 2026
Merged

fix(algolia): tighten tools.config, add geo/facet search + task-status tool; icon/color tweaks#5356
waleedlatif1 merged 8 commits into
stagingfrom
worktree-algolia-validate

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Ran a full /validate-integration pass on Algolia against the live REST API docs (14 tools + block).
  • tools.config.tool was doing param remapping/coercion (createIfNotExists, forwardToReplicas, copyMoveOperation→operation, deleteFilters→filters, getRecordsRequests→requests, list pagination) at serialization time, before variable resolution — this could destroy dynamic <Block.output> references. Split into a pure tool() selector and a proper params() function.
  • facets and getRankingInfo were never sent by the search tool, so the documented facets/facets_stats/_rankingInfo outputs were permanently unreachable. Wired both through.
  • Geo-search (aroundLatLng/aroundRadius/insideBoundingBox/insidePolygon) only existed on delete_by_filter, not on search/browse_records — added to both.
  • Fixed aroundRadius's declared type (was number, but the field legitimately accepts "all").
  • Synced batch_operations' param description with the real action set (was missing delete/clear, present elsewhere).
  • Consolidated list_indices pagination into the shared page/hitsPerPage fields instead of duplicate listPage/listHitsPerPage subBlocks + remapping.
  • Added algolia_get_task_status (every write op returns a taskID but there was no way to poll it — cheap, high-leverage addition per the endpoint audit).
  • .trim() on indexName/objectID/destination before building request URLs.
  • Added 2 niche skills (ranking tuning, index snapshot-before-change) to AlgoliaBlockMeta, grounded in existing tools.
  • Swapped the Dropcontact icon to the official wordmark's teal swirl mark (leftmost mark only, not the full wordmark) and updated bgColor to match; regenerated docs.
  • Set Grafana's bgColor to white.

Endpoints intentionally NOT added (from the audit): synonyms/rules management, API key management, multi-cluster, A/B testing, Recommend — all separate products or lower-value relative to core CRUD/search/settings coverage already in place.

Type of Change

  • Bug fix
  • Enhancement

Testing

Tested manually; bun run lint and targeted typecheck clean.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…arch, task status tool

- move all tools.config coercion/remapping out of tool() into a proper params() function so dynamic block references aren't destroyed before variable resolution
- wire facets and getRankingInfo into the search tool so those documented outputs are actually reachable
- add geo-search (aroundLatLng/aroundRadius/insideBoundingBox/insidePolygon) to search and browse_records, matching delete_by_filter
- fix aroundRadius param type (string, not number, since it accepts "all")
- sync batch_operations description with the real action set (delete, clear)
- consolidate list_indices pagination into the shared page/hitsPerPage fields instead of duplicate listPage/listHitsPerPage
- add algolia_get_task_status tool so workflows can poll a taskID instead of guessing when a write is applied
- trim indexName/objectID/destination before building request URLs
- add ranking-tuning and index-snapshot skills to AlgoliaBlockMeta

fix(dropcontact): swap icon to the official wordmark's teal swirl mark, bgColor to match

chore(grafana): bgColor to white to match brand tile convention
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 2, 2026 4:45pm

Request Review

@cursor

cursor Bot commented Jul 2, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Algolia workflow serialization and API request shaping changed across many tools, which can affect existing deployed blocks (mitigated by subblock migrations) and write/search behavior; branding-only changes elsewhere are low risk.

Overview
Algolia gets the bulk of the changes: block tools.config now uses a dedicated params() mapper (instead of remapping inside tool()), so dynamic references survive serialization; Get Task Status is added end-to-end (tool, block, docs, registry); search gains facets, getRankingInfo, and geo filters; browse/search share those geo options; list indices reuses shared page/hitsPerPage with a subblock ID migration for saved workflows; URLs trim index/object IDs; batch docs mention delete/clear actions; list_indices hits the DSN host; and two block skills cover ranking tuning and pre-change snapshots.

Dropcontact and Grafana are presentation-only: official teal swirl icon and #0ABA9F branding for Dropcontact, white Grafana card background in blocks, docs, and integrations.json.

Reviewed by Cursor Bugbot for commit 96ad66a. Configure here.

Comment thread apps/sim/blocks/blocks/algolia.ts Outdated
Comment thread apps/sim/blocks/blocks/algolia.ts
Comment thread apps/sim/blocks/blocks/dropcontact.ts
…Page

CI's subblock-id stability check correctly flagged that consolidating
list_indices pagination into the shared page/hitsPerPage fields would
silently drop values from already-deployed workflows. Add the rename
mapping so existing saved state migrates instead of being lost.
@greptile-apps

greptile-apps Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR is a comprehensive overhaul of the Algolia integration: it fixes a param-remapping bug where the old tool() function was coercing values before variable resolution, adds geo-search and facet/ranking-info support to search and browse_records, introduces a new get_task_status tool, and updates icon/color assets for Dropcontact and Grafana.

  • Params refactor: Splits the combined tool() selector into a pure tool() + a separate params() function, preserving <Block.output> references by deferring coercions to serialization time; adds a migration for the removed listPage/listHitsPerPage subBlock IDs.
  • New capabilities: Adds facets, getRankingInfo, aroundLatLng, aroundRadius, insideBoundingBox, and insidePolygon to search and browse_records; adds the algolia_get_task_status tool so callers can poll write-operation completion.
  • Trim hardening: Applies .trim() to indexName, objectID, and destination before building every request URL and the multi-index search body.

Confidence Score: 5/5

Safe to merge — the refactoring is mechanically sound, the migration covers existing workflows, and no regressions were found in the new tool or parameter wiring.

The tool()params() split is correct: operation is destructured out before params are remapped, so the tool selector still receives the original block operation while the tool itself gets the properly coerced values. The listPage/listHitsPerPage removal is paired with a subblock migration entry. The indexName.trim() fix now covers every request path including the multi-index search body. The get_task_status tool is wired consistently with the rest of the integration. No incorrect behavior was identified on any changed path.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/algolia.ts Splits tool()+params(), adds getRankingInfo/facets/geo-search subBlocks, replaces listPage/listHitsPerPage with shared page/hitsPerPage, adds get_task_status support; migration added separately.
apps/sim/tools/algolia/search.ts Adds facets, getRankingInfo, and geo-search params; trims indexName in the multi-index request body; now correctly wires facets/facets_stats/_rankingInfo outputs.
apps/sim/tools/algolia/get_task_status.ts New tool: GET /1/indexes/{indexName}/task/{taskID} via DSN cluster; correctly trims indexName and taskID; outputs status string.
apps/sim/tools/algolia/browse_records.ts Adds geo-search params (aroundLatLng, aroundRadius, insideBoundingBox, insidePolygon) and trims indexName in the URL.
apps/sim/lib/workflows/migrations/subblock-migrations.ts Adds migration mapping listPage→page and listHitsPerPage→hitsPerPage for existing Algolia workflows.
apps/sim/tools/algolia/delete_by_filter.ts Fixes aroundRadius param type from 'number' to 'string' to accept the "all" value; trims indexName in URL.
apps/sim/tools/algolia/types.ts Extends AlgoliaSearchParams and AlgoliaBrowseRecordsParams with facets/getRankingInfo/geo-search fields; adds AlgoliaGetTaskStatusParams and response types.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[AlgoliaBlock\noperation dropdown] -->|tool selector| B["tool: params => `algolia_${params.operation}`"]
    A -->|param builder| C[params: strips 'operation',\nfilters empty values,\napplies toBool coercions,\nrenames aliased keys]

    C --> D{operation?}
    D -->|search| E[algolia_search\n+facets, getRankingInfo,\ngeo-search params]
    D -->|browse_records| F[algolia_browse_records\n+geo-search params]
    D -->|list_indices| G[algolia_list_indices\nshared page/hitsPerPage\nvia -dsn cluster]
    D -->|get_task_status| H[algolia_get_task_status\nGET /task/:taskID\nvia -dsn cluster]
    D -->|copy_move_index| I[algolia_copy_move_index\ncopyMoveOperation → operation]
    D -->|delete_by_filter| J[algolia_delete_by_filter\ndeleteFilters → filters\naroundRadius as string]
    D -->|get_records| K[algolia_get_records\ngetRecordsRequests → requests]

    H -->|output| L[status: published\nor notPublished]
    E -->|outputs| M[hits, facets,\nfacets_stats,\n_rankingInfo]

    subgraph Migration
        N[listPage → page\nlistHitsPerPage → hitsPerPage]
    end
Loading
%%{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"}}}%%
flowchart TD
    A[AlgoliaBlock\noperation dropdown] -->|tool selector| B["tool: params => `algolia_${params.operation}`"]
    A -->|param builder| C[params: strips 'operation',\nfilters empty values,\napplies toBool coercions,\nrenames aliased keys]

    C --> D{operation?}
    D -->|search| E[algolia_search\n+facets, getRankingInfo,\ngeo-search params]
    D -->|browse_records| F[algolia_browse_records\n+geo-search params]
    D -->|list_indices| G[algolia_list_indices\nshared page/hitsPerPage\nvia -dsn cluster]
    D -->|get_task_status| H[algolia_get_task_status\nGET /task/:taskID\nvia -dsn cluster]
    D -->|copy_move_index| I[algolia_copy_move_index\ncopyMoveOperation → operation]
    D -->|delete_by_filter| J[algolia_delete_by_filter\ndeleteFilters → filters\naroundRadius as string]
    D -->|get_records| K[algolia_get_records\ngetRecordsRequests → requests]

    H -->|output| L[status: published\nor notPublished]
    E -->|outputs| M[hits, facets,\nfacets_stats,\n_rankingInfo]

    subgraph Migration
        N[listPage → page\nlistHitsPerPage → hitsPerPage]
    end
Loading

Reviews (5): Last reviewed commit: "fix(algolia): correct batch_operations b..." | Re-trigger Greptile

Algolia's Get Task Status response (additionalProperties: false) only
returns `status` (published | notPublished) — pendingTask belongs to
the List Indices response, not this endpoint. Drop it from the tool's
output, response type, and block outputs rather than inventing data.
…as from real booleans, not just strings

A wired <Block.output> boolean (e.g. true) failed the `=== 'true'`
string-only checks and silently flipped to the wrong value. Add a
toBool helper that accepts both the dropdown's string values and a
genuine boolean passed in via a dynamic reference.

fix(dropcontact): render icon with currentColor instead of hardcoded fill

The new teal swirl mark's fill (#0ABA9F) matched the block's bgColor
exactly, making the icon invisible on its own tile. Use currentColor
and set iconColor so the shared tile-contrast logic (getTileIconColorClass)
renders it white-on-teal like the rest of the brand icon system.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Greptile caught that search.ts's body-level indexName (sent inside the
multi-query POST body, not URL-encoded) wasn't trimmed like every other
tool's URL-path indexName. Fixed there and in get_records.ts's per-request
indexName default/override, which had the same gap.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

Fixed in 1a8b0c3search.ts's body-level indexName (sent inside the multi-query POST body, not URL-encoded like every other tool) wasn't trimmed. Also caught and fixed the same gap in get_records.ts's per-request indexName default/override. Thanks for catching this.

Comment thread apps/sim/tools/algolia/get_task_status.ts
Comment thread apps/sim/tools/algolia/search.ts
… read host

Verified against Algolia's official JS client source
(getDefaultHosts + transporter isRead = useReadTransporter || method === 'GET'):
every GET request routes to the read (-dsn) host, matching the other 14
tools in this integration (get_record, get_settings, etc). Both tools
were incorrectly hitting the write host.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Comment thread apps/sim/tools/algolia/list_indices.ts
The get_task_status pendingTask output was removed from code in
d102129 (fabricated field, not in Algolia's real API response) but
docs weren't regenerated at the time, leaving a stale entry. Also
syncs the Dropcontact icon's currentColor fill into the docs mirror.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 08c5f7f. Configure here.

Verified against Algolia's actual batchWriteParams schema (specs/common/schemas/Batch.yml):
body is a required property on every batch request item, including
index-level delete/clear actions — it isn't omittable. The tool's
param description previously said to omit it; corrected to say use an
empty object instead.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 96ad66a. Configure here.

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