Repository navigation
feat(execution-history): filter approvals by type - #58
Conversation
Record denormalized approval kind flags on run rows so the runs list can filter form and URL approval runs without fetching detail blobs. Update the visible execution-history UI copy from interactions to approvals and cover the handler, schema, and store paths.
Greptile SummaryThis PR adds denormalized
Confidence Score: 4/5Safe to merge; the command palette can produce a contradictory filter state but only in a narrow edge case, with no data corruption risk. The storage layer, indexing, event handling, and API are all correct and well-tested. The one gap is that packages/plugins/execution-history/src/react/filter-command.tsx — Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[InteractionStarted event] --> B{request type?}
B -- UrlElicitation --> C[isUrlApproval = true]
B -- FormElicitation --> D[isFormApproval = true]
C --> E[buffer.hadUrlApproval = true]
D --> F[buffer.hadFormApproval = true]
E & F --> G[putRun: waiting_for_interaction\nhadFormApproval / hadUrlApproval written]
H[ExecutionFinished event] --> I{buffer present?}
I -- yes --> J[use buffer flags directly]
I -- no / restart --> K[fetch existing row from storage]
K --> L[use existing.data.hadFormApproval ?? interactionEntries.some]
J & L --> M[putRun: terminal row with correct flags]
N[list API: approvalType=form] --> O[buildRunsWhere: hadFormApproval eq true]
O --> P[queryKeyset filtered results]
O --> Q[computeMeta: formApprovalCount, urlApprovalCount]
R[filter-rail toggle] --> S[clears interaction when approvalType set and vice versa]
T[command palette mergeTokens] --> U[does NOT clear interaction when approvalType set]
%%{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[InteractionStarted event] --> B{request type?}
B -- UrlElicitation --> C[isUrlApproval = true]
B -- FormElicitation --> D[isFormApproval = true]
C --> E[buffer.hadUrlApproval = true]
D --> F[buffer.hadFormApproval = true]
E & F --> G[putRun: waiting_for_interaction\nhadFormApproval / hadUrlApproval written]
H[ExecutionFinished event] --> I{buffer present?}
I -- yes --> J[use buffer flags directly]
I -- no / restart --> K[fetch existing row from storage]
K --> L[use existing.data.hadFormApproval ?? interactionEntries.some]
J & L --> M[putRun: terminal row with correct flags]
N[list API: approvalType=form] --> O[buildRunsWhere: hadFormApproval eq true]
O --> P[queryKeyset filtered results]
O --> Q[computeMeta: formApprovalCount, urlApprovalCount]
R[filter-rail toggle] --> S[clears interaction when approvalType set and vice versa]
T[command palette mergeTokens] --> U[does NOT clear interaction when approvalType set]
Reviews (1): Last reviewed commit: "feat(execution-history): filter approval..." | Re-trigger Greptile |
| interaction: tokens.interaction !== null ? tokens.interaction : filters.interaction, | ||
| approvalType: tokens.approvalType !== null ? tokens.approvalType : filters.approvalType, |
There was a problem hiding this comment.
When
mergeTokens applies a parsed token for interaction, it should clear approvalType (and vice versa), mirroring the mutual-exclusivity logic in the filter rail toggles. Without this, typing interaction:false approval:form in the command palette sets both simultaneously, producing hadInteraction=false AND hadFormApproval=true — a contradiction that always returns 0 results with no error.
| interaction: tokens.interaction !== null ? tokens.interaction : filters.interaction, | |
| approvalType: tokens.approvalType !== null ? tokens.approvalType : filters.approvalType, | |
| interaction: tokens.interaction !== null ? tokens.interaction : tokens.approvalType !== null ? null : filters.interaction, | |
| approvalType: tokens.approvalType !== null ? tokens.approvalType : tokens.interaction !== null ? null : filters.approvalType, |
Summary
Updates execution history to present approval requests as approvals instead of interactions and adds approval-type filtering for form and URL approvals.
Changes
Tests
Known tradeoffs
Existing historical approval rows only have the old hadInteraction boolean, so their form and URL approval flags remain false unless we run a backfill from detail blobs.