feat(block): Add data enrichment block#4774
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview The block UI, tool schema, and docs are generated from
Reviewed by Cursor Bugbot for commit 54fab27. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR adds a Data Enrichment workflow block that exposes the existing enrichment registry (Work Email, Phone Number, Company Domain, Company Info) as a first-class block inside workflows, backed by a new internal endpoint
Confidence Score: 5/5Safe to merge — the new endpoint is internal-auth gated, the contract correctly validates all inputs, and the registry-driven block generation is consistent with existing patterns. The change is well-contained: a new internal route, a new block, and a thin tool config, all delegating to an already-tested enrichment runner. The only forward-looking concern is that the output-building loops in both the block and the tool don't guard against reserved IDs (matched, provider), which would silently corrupt output schemas if a future enrichment happened to use those names. apps/sim/blocks/blocks/enrichment.ts and apps/sim/tools/enrichment/run.ts — both build output maps via loops that can unconditionally overwrite the statically defined matched/provider entries. Important Files Changed
Sequence DiagramsequenceDiagram
participant WF as Workflow Executor
participant Tool as enrichment_run Tool
participant Route as POST /api/tools/enrichment/run
participant Runner as runEnrichment()
participant P1 as Provider 1 (e.g. Hunter)
participant P2 as Provider 2 (e.g. PDL)
WF->>Tool: execute(enrichmentId, inputs, _context.workspaceId)
Tool->>Route: "POST {enrichmentId, inputs, workspaceId}"
Route->>Route: checkInternalAuth + Zod parse
Route->>Route: getEnrichment(enrichmentId)
Route->>Runner: "runEnrichment(enrichment, inputs, {workspaceId})"
Runner->>P1: executeTool(toolId, params + _context)
alt P1 returns result
P1-->>Runner: success + output
Runner-->>Route: "{result, cost, error:null, provider:"Hunter"}"
else P1 misses or errors
P1-->>Runner: no match or error
Runner->>P2: executeTool(toolId, params + _context)
P2-->>Runner: success + output
Runner-->>Route: "{result, cost, error:null, provider:"People Data Labs"}"
end
Route-->>Tool: "{matched, result, cost, error, provider}"
Tool-->>WF: "{success, output:{...result, matched, provider, cost?}}"
Reviews (2): Last reviewed commit: "chore: re-trigger CI" | Re-trigger Greptile |
|
Addressed in the latest commit:
tsc + biome + |
065c1b1 to
b0cc72e
Compare
Add a generic Enrichment workflow block that runs a code-defined enrichment (Work Email, Phone Number, Company Domain, Company Info, …) and returns its outputs — usable in workflows, not just tables. - New internal endpoint POST /api/tools/enrichment/run (checkInternalAuth + contract) runs the same runEnrichment provider cascade; injects the workspace's hosted/BYOK key via executeTool. - New tool enrichment_run posts to it and surfaces hosted-key cost on the output so the workflow logging session bills it. - New block blocks/blocks/enrichment.ts generated from the enrichment registry: operation dropdown = enrichments, per-enrichment conditional inputs, union of conditional outputs. New registry entries appear automatically. - EnrichmentRunContext.tableId/rowId made optional (workflow path has no row). - Register tool + block; bump api-validation route baseline; add EnrichmentIcon and generated docs page. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
b0cc72e to
3e3698f
Compare
# Conflicts: # scripts/check-api-validation-contracts.ts
|
Addressed:
tsc + biome + audit clean. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 870203c. Configure here.
|
Addressed in latest commit — reserved output keys ( |

Summary
output.provider, and surfaces hosted-key cost onoutput.cost.totalso the workflow logging session bills itType of Change
Testing
Tested manually; tsc clean, biome clean,
bun run check:api-validation:strictpasses,bun run lintcleanChecklist