feat(enrichment): add enrichment details sidebar with cost + provider cascade#5139
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview The table UI adds an Enrichment Details slideout (Result + Cascade waterfall, log-details styling/resizer) wired through slideout state, the action bar View execution pill, and the cell context menu for terminal enrichment cells—replacing the previous “no trace for enrichments” behavior. Migration 0244 adds the column; upserts use sticky Reviewed by Cursor Bugbot for commit aecc236. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR adds an Enrichment Details slideout panel (Result + Cascade tabs) to the tables view, capturing per-provider cascade detail during enrichment runs that was previously discarded. A new nullable
Confidence Score: 5/5Safe to merge — the change is well-scoped, backward-compatible (nullable ADD COLUMN), and all enrichment exit paths correctly write the cascade detail. The runner changes thread the new EnrichmentRunDetail through every exit path (skipped inputs, early abort, post-run abort, error, success). The COALESCE upsert correctly preserves a prior cascade on intermediate writes while re-runs overwrite it on completion. The hot grid read path is unaffected. Access control on the new route is correct (auth + tableId-scoped access check). Nine new tests cover the cascade logic and route behavior. No files require special attention. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant UI as EnrichmentDetails Panel
participant TG as TableGrid
participant Table as table.tsx
participant Hook as useEnrichmentDetail
participant API as GET /enrichment/[groupId]
participant DB as DB (tableRowExecutions)
Note over TG: User right-clicks / selects enrichment cell (status: completed | error)
TG->>Table: onOpenEnrichmentDetails(rowId, groupId)
Table->>Table: dispatch OPEN_ENRICHMENT_DETAILS
Table->>UI: "isOpen=true, rowId, groupId"
UI->>Hook: "useEnrichmentDetail(tableId, rowId, groupId, {enabled: true})"
Note over Hook: staleTime: 0 — always fetches fresh
Hook->>API: GET /api/table/[tableId]/rows/[rowId]/enrichment/[groupId]
API->>API: checkSessionOrInternalAuth
API->>API: checkAccess(tableId, userId, 'read')
API->>DB: SELECT enrichment_details WHERE tableId+rowId+groupId
DB-->>API: "EnrichmentRunDetail | null"
API-->>Hook: "{ success: true, data: { detail } }"
Hook-->>UI: "{ data: detail, isLoading: false }"
UI->>UI: deriveResultStatus(detail)
UI->>UI: Render Result tab or Cascade tab waterfall
Note over DB: Written by background runner
Note over DB: runEnrichment → EnrichmentRunDetail
Note over DB: skippedEnrichmentDetail (missing inputs / early abort)
Note over DB: COALESCE preserves prior detail on intermediate writes
%%{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 EnrichmentDetails Panel
participant TG as TableGrid
participant Table as table.tsx
participant Hook as useEnrichmentDetail
participant API as GET /enrichment/[groupId]
participant DB as DB (tableRowExecutions)
Note over TG: User right-clicks / selects enrichment cell (status: completed | error)
TG->>Table: onOpenEnrichmentDetails(rowId, groupId)
Table->>Table: dispatch OPEN_ENRICHMENT_DETAILS
Table->>UI: "isOpen=true, rowId, groupId"
UI->>Hook: "useEnrichmentDetail(tableId, rowId, groupId, {enabled: true})"
Note over Hook: staleTime: 0 — always fetches fresh
Hook->>API: GET /api/table/[tableId]/rows/[rowId]/enrichment/[groupId]
API->>API: checkSessionOrInternalAuth
API->>API: checkAccess(tableId, userId, 'read')
API->>DB: SELECT enrichment_details WHERE tableId+rowId+groupId
DB-->>API: "EnrichmentRunDetail | null"
API-->>Hook: "{ success: true, data: { detail } }"
Hook-->>UI: "{ data: detail, isLoading: false }"
UI->>UI: deriveResultStatus(detail)
UI->>UI: Render Result tab or Cascade tab waterfall
Note over DB: Written by background runner
Note over DB: runEnrichment → EnrichmentRunDetail
Note over DB: skippedEnrichmentDetail (missing inputs / early abort)
Note over DB: COALESCE preserves prior detail on intermediate writes
Reviews (5): Last reviewed commit: "fix(enrichment): show Cancelled in detai..." | Re-trigger Greptile |
…ude not_run from ran count, refetch on panel open
# Conflicts: # packages/db/migrations/meta/0241_snapshot.json # packages/db/migrations/meta/_journal.json # scripts/check-api-validation-contracts.ts
|
Addressed the review findings + resolved the staging conflict:
Merge conflict with staging resolved: migration renumbered tsc, lint, @greptile review |
…ed providers not_run on abort
|
@greptile review |
1 similar comment
|
@greptile review |
|
@BugBot review |
|
@greptile review |
|
@BugBot 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 aecc236. Configure here.
Summary
table_row_executions.enrichment_detailscolumn, read on demand via a new contract-bound route + query hook (kept off the hot grid read)Type of Change
Testing
bun run lint,check:api-validation:strict, andcheck:migrations origin/stagingall passChecklist