improvement(logs-block): filter runs by trigger type - #6824
Conversation
The Logs block could filter runs by workflow, status, time, cost, and duration, but not by how the run started — even though the underlying tool, the /api/logs contract, and the indexed trigger column all already accepted a comma-separated triggers filter. Adds a basic multi-select and an advanced free-text field behind the canonical `triggers` param, mirroring the block's existing workflow filter. Options come from the same registry the Logs page reads, so both surfaces name a run's origin identically; values sharing a label are merged into one option. Leaving the filter empty omits the param, so existing blocks query exactly as before.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview
Reviewed by Cursor Bugbot for commit 70e6841. Configure here. |
Greptile SummaryThe PR adds trigger-type filtering to the Logs block while preserving unfiltered behavior for existing configurations.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/blocks/blocks/logs.ts | Adds trigger filtering and correctly declares the transformed canonical input as a string, resolving the prior coercion issue. |
| apps/sim/blocks/blocks/logs.test.ts | Covers trigger normalization, operation scoping, backward compatibility, and the corrected input declaration without explicit any. |
| apps/sim/lib/workflows/subblocks/options.ts | Adds lazy trigger-option loading and deterministic merging of entries with identical labels. |
| apps/sim/lib/workflows/subblocks/options.test.ts | Verifies merged option identifiers and preservation of registry ordering. |
| apps/sim/lib/workflows/subblocks/trigger-options-live.test.ts | Confirms the lazy import resolves against the real registries and produces populated, uniquely labeled options. |
Reviews (5): Last reviewed commit: "test(logs-block): exercise the trigger o..." | Re-trigger Greptile
The generic handler JSON.parses any post-transform input declared 'array' or 'json'. Since `joinIds` has already turned the selection into a comma-separated string by then, the array declaration logged a parse warning on every run, and JSON-looking advanced input would have been turned into an array the tool does not accept. Matches the legacy Logs block, which already declares triggers as a string, and locks the invariant with a test. Also drops `any` from the new test helper.
|
@cursor review |
joinIds trimmed only the ends of an advanced-mode string, so a hand-typed 'api, schedule, slack' reached the query as ' schedule' and ' slack'. The filters split on commas without trimming, so those tokens matched no stored trigger and the filter silently returned nothing. Splits and trims every entry instead, which also covers empty tokens from a trailing comma and the multi-value ids behind merged trigger labels.
|
@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 fd50a97. Configure here.
joinIds is shared with the workflow and status filters, so the per-entry trimming added for hand-typed triggers must not move their output. Covers every value a stored multi-select or advanced field can hold, plus the block-saved-before-the-filter case where triggers must not reach the query.
|
@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 e1b61f5. Configure here.
The fetcher reaches the block and trigger registries through a lazy import to avoid an initialization cycle, so a mocked test cannot show that the import resolves or that the registry is populated when the dropdown asks. Covers the populated list, unique labels, and the merged Sim agent option.
|
@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 70e6841. Configure here.
Summary
triggersparam, matching the block's existing workflow filterNo backend work was needed. The
logs_query_runstool, the/api/logscontract, and the indexedtriggercolumn already accepted a comma-separatedtriggerslist; only the block was missing the control.Type of Change
Testing
Tested manually. Added unit tests covering the param mapping (empty filter omits
triggers, multi-select joins, merged ids flatten, advanced string trims, run-details never sends it) and the option merge — verified they fail when the change is reverted.bun run check:audits(29 audits),bun run lint,bun run type-check, and the block-registry subblock-ID stability check all pass.Checklist