Skip to content

Preserve SYNC response contract under systemMutationMode=ASYNC - #336

Merged
em3s merged 1 commit into
mainfrom
feat/issue-335-sync-contract-under-system-async
May 15, 2026
Merged

em3s merged 1 commit into
mainfrom
feat/issue-335-sync-contract-under-system-async

Conversation

@em3s

@em3s em3s commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When systemMutationMode=ASYNC overrides a table whose own mode is SYNC, derive the response status from the request's EdgeOperation (INSERT → CREATED, UPDATE → UPDATED, DELETE → DELETED) instead of returning QUEUED. Tables whose own mode is ASYNC keep returning QUEUED. Mutations are still queued via the WAL — only the response status changes.

Closes #335

Changes

  • Derive operation-based status in MutationService for system=ASYNC + label=SYNC
  • Update MutationServiceSystemAsyncSpec — expect operation-based status for SYNC tables, add UPDATE/DELETE coverage
  • Update EdgeMutationForceSyncTest — adjust the SYNC-table queue expectation

How to Test

  • ./gradlew :engine:test --tests "*MutationServiceSystemAsyncSpec"
  • ./gradlew :server:test --tests "*EdgeMutationForceSyncTest"
  • ./gradlew build

AI Assistance

  • This PR was written largely with AI assistance.
    • Tool / model: claude code (opus 4.7)

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request size:S This PR changes 10-29 lines, ignoring generated files. size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. size:S This PR changes 10-29 lines, ignoring generated files. labels May 15, 2026
@em3s
em3s force-pushed the feat/issue-335-sync-contract-under-system-async branch from b1f2858 to dbf0d66 Compare May 15, 2026 13:03
…e=ASYNC

`systemMutationMode=ASYNC` is a temporary, system-wide override that routes
every mutation through the WAL-only queue path. Under this override every
response is `QUEUED` — even for `SYNC` tables — which breaks clients that
expect `CREATED` / `UPDATED` / `DELETED` / `IDLE` and have not been updated
to handle `QUEUED`.

When the system override is `ASYNC` and the table's own mode is `SYNC`,
derive the response status from the request's `EventType`:

  INSERT → CREATED
  UPDATE → UPDATED
  DELETE → DELETED

Tables whose own mode is `ASYNC` keep returning `QUEUED`. Mutations are
still queued via the WAL — only the response status changes. The status is
intent-based (last-write wins by version, mirroring the SYNC fold winner)
and never `IDLE`; the SYNC path's state-diff status is a coarser approximation
under this override, so the same input can yield different status under
`force=true SYNC` vs. `system=ASYNC` override. Acceptable since the override
is itself a temporary operational tool.

`force=true` short-circuits to `QUEUED` so clients that explicitly choose
ASYNC still receive the async-shaped response they asked for.

Tests:
- MutationServiceSystemAsyncSpec: SYNC EDGE/MULTI_EDGE INSERT/UPDATE/DELETE
  return operation-based status; ASYNC tables and `force=true + request=SYNC`
  paths unchanged; multi-event same-version and ascending-version cases lock
  the stable-sort winner; `force=true + request=ASYNC` on SYNC EDGE returns
  QUEUED.
- EdgeMutationForceSyncTest: SYNC-table E2E now expects CREATED.

Closes #335
@em3s
em3s force-pushed the feat/issue-335-sync-contract-under-system-async branch from dbf0d66 to e543089 Compare May 15, 2026 13:04
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels May 15, 2026
@em3s

em3s commented May 15, 2026 •

Copy link
Copy Markdown
Contributor Author

Optimistic merging.

@em3s
em3s merged commit 295c79b into main May 15, 2026
2 checks passed
@em3s
em3s deleted the feat/issue-335-sync-contract-under-system-async branch May 15, 2026 13:12
em3s added a commit that referenced this pull request May 15, 2026
em3s added a commit that referenced this pull request May 16, 2026
When systemMutationMode=ASYNC overrides a table whose own mode is SYNC,
derive the response status from the request's EdgeOperation
(INSERT -> CREATED, UPDATE -> UPDATED, DELETE -> DELETED, PURGE -> PURGED)
instead of returning QUEUED. Tables whose own mode is ASYNC keep
returning QUEUED. Mutations are still queued via the WAL.

Backport of #336 to v2.engine.Graph.

Closes #339

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@em3s em3s self-assigned this May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve SYNC response contract under systemMutationMode=ASYNC

1 participant