fix(db-part-2): close optional-executor contract traps#4989
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
MCP workflow sync tightens the contract: in-transaction callers never publish server notifications; standalone paths notify after commit. Reviewed by Cursor Bugbot for commit eaa0bc3. Configure here. |
Greptile SummaryThis PR tightens the database executor contract across billing read-path helpers and the MCP sync layer. It introduces a
Confidence Score: 4/5Safe to merge — all changed call-sites correctly thread the executor, post-commit notification is properly enforced by the discriminated union, and write paths continue to target the primary. The executor threading is thorough and consistent across the billing fan-outs, and the MCP notification refactor is logically sound. The one open question is whether TypeScript's structural checker actually rejects a
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant syncMcp as syncMcpToolsForWorkflow
participant removeMcp as removeMcpToolsForWorkflow
participant db as db.transaction
participant notify as notifyMcpToolServers
Note over Caller,notify: Standalone path (no tx provided)
Caller->>syncMcp: "{ workflowId, notify?: boolean }"
syncMcp->>db: open transaction
db->>syncMcp: "recursive call { tx, notify: false }"
alt no valid start block
syncMcp->>removeMcp: "(workflowId, tx, throwOnError=true)"
removeMcp-->>syncMcp: affected tools (no notify)
else valid start block
syncMcp->>syncMcp: update MCP tool schemas in tx
syncMcp-->>db: affected serverIds
end
db-->>syncMcp: tools (committed)
syncMcp->>notify: if options.notify ?? true
syncMcp-->>Caller: affected tools
Note over Caller,notify: Transaction path (tx provided)
Caller->>syncMcp: "{ tx, state, notify?: false }"
alt no valid start block
syncMcp->>removeMcp: "(workflowId, tx, throwOnError=true)"
removeMcp-->>syncMcp: tools (no notify)
else valid start block
syncMcp->>syncMcp: update schemas inside caller tx
end
syncMcp-->>Caller: affected tools
Note over Caller: Caller calls notifyMcpToolServers after commit
Reviews (1): Last reviewed commit: "fix(db): close optional-executor contrac..." | Re-trigger Greptile |
Summary
Add DbClient (primary | replica, excludes tx handles) and switch the five billing read functions off DbOrTx — a transaction can no longer be passed into multi-query read fans that would partially escape it
Type of Change
Testing
Tested manually
Checklist