fix(logs, workflows): snapshot fetch optionality, restore consistent draft read snapshots - #6594
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
Draft Reviewed by Cursor Bugbot for commit 3125237. Configure here. |
Greptile SummaryThis PR avoids fetching unused execution snapshots for internal log details and restores consistent workflow-row and draft-state reads within one repeatable-read transaction.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or non-blocking defects identified. The replacement log query preserves all fields used by log-detail responses, and every workflow snapshot caller supplies the canonical workspace while retaining authorization and active-workflow checks.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/logs/fetch-log-detail.ts | Replaces a broad shared query with a workspace-scoped query that retains consumed fields while avoiding unused snapshot and user joins. |
| apps/sim/lib/workflows/queries.ts | Extends repeatable-read snapshots with canonical workspace and active-workflow filtering. |
| apps/sim/lib/workflows/application/read-workflow-definition.ts | Returns draft metadata and normalized state from the same snapshot while leaving deployed reads on the deployment-state path. |
| apps/sim/lib/workflows/application/read-workflow.ts | Passes the canonical context workspace into the newly scoped snapshot query. |
| apps/sim/lib/logs/fetch-log-detail.test.ts | Verifies internal log details no longer fetch execution snapshots or workflow-owner data. |
| apps/sim/lib/workflows/application/read-workflow-definition.test.ts | Covers consistent draft snapshots, invalid snapshot records, and preservation of deployed-state behavior. |
Sequence Diagram
sequenceDiagram
participant Caller
participant UseCase as Authorized workflow use case
participant Context as Context resolver
participant DB as PostgreSQL
Caller->>UseCase: Read draft workflow
UseCase->>Context: Resolve active workflow and workspace
Context->>DB: Load canonical active workflow
DB-->>Context: Workflow context
UseCase->>DB: Begin REPEATABLE READ snapshot
par Consistent draft state
DB->>DB: Load normalized workflow tables
and Consistent workflow metadata
DB->>DB: Load active workflow scoped by workspace
end
DB-->>UseCase: Workflow record and normalized state
UseCase-->>Caller: Consistent draft definition
Reviews (1): Last reviewed commit: "fix(workflows): restore consistent draft..." | Re-trigger Greptile
Summary
Type of Change
Testing
Tested manually
Checklist