improvement(api): unify v2 resource query layers - #6319
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryHigh Risk Overview Billing replaces Logs and executions treat Workflows adds Audit logs require a mandatory Knowledge moves search query helpers to Execution cancellation verifies the execution belongs to the workflow, can cancel queued async jobs, and treats missing executions as 404. Stale-job cleanup retention now includes cancelled jobs. OpenAPI specs are updated to match. Reviewed by Cursor Bugbot for commit 141d697. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR consolidates execution, log, workflow, deployment, knowledge, billing, and audit query behavior behind shared service layers while updating the corresponding API contracts.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/logs/public-queries.ts | Introduces shared public-log list/detail queries with order-bound keyset cursors and consistent execution identity. |
| apps/sim/lib/workflows/executor/execution-queries.ts | Centralizes workflow-execution listing, ownership checks, status projection, and sorted pagination. |
| apps/sim/lib/execution/cancel-workflow-execution.ts | Extends cancellation to active queue jobs and validates that an execution belongs to the requested workflow. |
| apps/sim/lib/execution/cancellation.ts | Extends durable cancellation markers to the configured maximum job lifetime. |
| apps/sim/lib/knowledge/documents/service.ts | Provides a shared document lookup that retains excluded, archived, and deleted lifecycle filtering. |
| apps/sim/app/api/v1/logs/executions/[executionId]/route.ts | Reuses the shared execution-log query and replaces the previous untyped workflow-state diagnostic access with explicit narrowing. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Client[API client] --> Adapter[v1 / v2 API adapter]
Adapter --> Auth[Authentication and authorization]
Auth --> Shared[Shared resource query layer]
Shared --> DB[(Postgres)]
Shared --> Queue[Execution queue]
Adapter --> Contract[Versioned response contract]
Contract --> Client
Reviews (4): Last reviewed commit: "fix(api): guard cancelled job transition..." | Re-trigger Greptile
|
Review follow-up in 6b8806c: queued workflow cancellation now resolves the deterministic execution job to its provider run and calls the queue backend cancellation API. The Redis cancellation backstop also now lives for the queue maximum lifetime instead of one hour, so a delayed worker cannot outlive the cancellation marker. Focused cancellation and Trigger.dev lookup tests cover both paths. |
|
@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 6b8806c. Configure here.
|
@cursor review |
|
@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 141d697. Configure here.
Summary
Type of Change
Testing
Checklist