Repository navigation
Add transactional success completion for mutations - #238
Open
ianmacartney wants to merge 5 commits into
Open
ianmacartney wants to merge 5 commits into
ianmacartney wants to merge 5 commits into
Conversation
commit: |
There was a problem hiding this comment.
All reported issues were addressed across 15 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ianmacartney
force-pushed
the
ian/transactional-completion
branch
from
September 11, 2026 03:55
14eabf7 to
b304b6c
Compare
ianmacartney
changed the base branch from
ian/on-complete-statuses
to
graphite-base/238
September 11, 2026 20:34
ianmacartney
force-pushed
the
ian/transactional-completion
branch
from
September 11, 2026 20:37
b304b6c to
50482e2
Compare
ianmacartney
changed the base branch from
graphite-base/238
to
ian/on-complete-statuses
September 11, 2026 20:37
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
ianmacartney
changed the base branch from
ian/on-complete-statuses
to
graphite-base/238
September 11, 2026 23:28
ianmacartney
added a commit
that referenced
this pull request
Sep 11, 2026
ianmacartney
force-pushed
the
ian/transactional-completion
branch
from
September 11, 2026 23:28
6d086a2 to
de31804
Compare
ianmacartney
force-pushed
the
graphite-base/238
branch
from
September 11, 2026 23:28
b395444 to
1ab826a
Compare
ianmacartney
force-pushed
the
ian/transactional-completion
branch
2 times, most recently
from
September 11, 2026 23:36
a8d4623 to
32e5f21
Compare
worker.test.ts still inserted `statuses` into the component's onComplete object, which fails validation at runtime and broke CI. Rename the remaining `statuses`/`onCompleteStatuses` sites left over from the exclusion rename, inverting each value to its complement. Rename MutationEnqueueOptions to TransactionalEnqueueOptions so the name describes the capability rather than the function type, leaving room for queries to support it later. Tie completeTransactionally to FnType in the standalone enqueue and enqueueBatch helpers. They previously accepted the mutation options type for every function type, so actions and queries type-checked and then failed at runtime in the component.
The FnType gate on the standalone enqueue helpers used a naked type parameter, so a union such as "mutation" | "action" distributed to boolean | never and let completeTransactionally through. The call then failed at runtime in the component instead of at the client boundary. Check the parameter as a tuple so the union is tested as a whole, and cover both helpers with a union FnType in the type test.
ianmacartney
force-pushed
the
ian/transactional-completion
branch
from
November 12, 2026 21:44
bec8e66 to
2e19056
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add
completeTransactionally: truetoenqueueMutationandenqueueMutationBatch. Successful work, its selectedonCompletecallback, and completion bookkeeping commit together. For example, if the callback writes a result and then throws, both its writes and the work's writes roll back instead of leaving successful work with a failed callback.The existing mutation wrapper calls the completion helper directly, eliminating the separately scheduled completion mutation without adding another wrapper UDF. Completion errors escape the wrapper and fail the scheduled mutation; existing recovery later records a terminal failure and dispatches the failure callback if selected. The job occupies its concurrency slot until recovery runs. Ordinary work errors retain the existing failure-completion path. Default completion, failure/cancellation callbacks, and action/query execution retain their current behavior.
Based on current
main, including merged #237 (status-filtered completion), with transactional mode restricted to mutations at the client type boundary and component runtime boundary. Batch items remain independent transactions. New stored and scheduled fields are optional for existing queued jobs. Nested work and success callback calls use transaction limits derived from remaining capacity, reserving room for bookkeeping. The existing Convex ^1.43 peer requirement covers nested transaction limits. The headroom helper reserves the database and scheduler resources used by completion bookkeeping, while allowing newer Convex versions to add unrelated transaction metrics.Validation: build, typecheck, lint, formatting, and all 268 tests pass with Vitest 5.1 after restacking onto
main. The local Convex deployment smoke check (npm run test:e2e) also passes, with generated component API files unchanged. Tests cover successful commits and payload cleanup, absent/filtered callbacks, rollback after callback errors and after late bookkeeping errors, actual scheduled-wrapper failure followed by recovery and deduplication, work errors, default callback behavior, stale wrapper replay, remaining-budget calculations, mutation batch routing, client rollback on callback failure for single and batch enqueue, cancellation, and action/query rejection before batch writes. Success-path tests also verify that no separate completion or callback mutation is scheduled.Test limitations: convex-test 0.0.67 supports nested
transactionLimits; component wrapper tests enable transaction-limit tracking. It does not simulate production OCC. It omits the error text from failed scheduled-job records, so recovery tests supply that missing field after an actual scheduled wrapper fails and rolls back.Transactional query success is a separate stacked change in #239.