Skip to content

Apply SYNC response contract preservation to the v2 mutation path - #340

Merged
em3s merged 7 commits into
mainfrom
feat/issue-339-v2-async-sync-contract
May 16, 2026
Merged

em3s merged 7 commits into
mainfrom
feat/issue-339-v2-async-sync-contract

Conversation

@em3s

@em3s em3s commented May 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Backport #336 to the v2 mutation path. 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 — only the response status changes.

Closes #339

Changes

  • Derive operation-based status in v2.engine.Graph.mutate for system=ASYNC + table=SYNC (no force)
  • Add v2.engine.dml.GraphSystemAsyncSpec mirroring the v3 coverage — INSERT / UPDATE / DELETE / PURGE on SYNC EDGE, INSERT on SYNC MULTI_EDGE, ASYNC table keeps QUEUED, request=SYNC and force=true overrides

How to Test

  • ./gradlew :engine:test --tests "*v2*SystemAsync*"
  • ./gradlew build

AI Assistance

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

Backport of #336 to v2.engine.Graph. See PR body for plan.
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request maintenance Maintenance work. labels 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]>
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels May 16, 2026
em3s and others added 5 commits May 16, 2026 14:18
- Add GraphSystemAsyncIgnoreSpec to lock in `system=IGNORE` and
  `table=IGNORE` returning QUEUED (v2-only modes the v3 patch could not
  consider).
- Convert queuedStatus comment to KDoc and enumerate the QUEUED branches.
- Replace inlined FQN with an import; tidy a stray blank line in the
  async edge JSON descriptor.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
IGNORE is not used in production, so locking in its QUEUED behavior is
out of scope for #339. Also trim IGNORE from the queuedStatus KDoc to
keep the comment focused on the documented modes.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The "system=ASYNC + ASYNC EDGE keeps QUEUED" case is subsumed by the
existing "system=ASYNC overrides request=SYNC on ASYNC EDGE" scenario,
which already locks in QUEUED for ASYNC tables.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
PURGE is not exercised in production, and MULTI_EDGE is only officially
supported by v3 (v2 keeps compatibility but has no integrations). Drop
the corresponding tests and fixtures. Keep the `PURGE -> PURGED` mapping
in Graph.kt as a defensive intent-based default.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Add a class-level KDoc listing the covered scenarios and the
intentionally-skipped ones (MULTI_EDGE, PURGE, multi-event tie-break)
with a one-line reason each.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@em3s

em3s commented May 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Skipped MULTI_EDGE and multi-event tie-break coverage from #336: MULTI_EDGE is v3-only (v2 has compat but no integrations) and v2 mutate() takes a single operation per call, so multi-event cases cannot arise. Rationale captured in GraphSystemAsyncSpec KDoc.

@em3s

em3s commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Optimistic merging.

@em3s
em3s merged commit dbd4058 into main May 16, 2026
2 checks passed
@em3s
em3s deleted the feat/issue-339-v2-async-sync-contract branch May 16, 2026 06:04
em3s added a commit that referenced this pull request May 16, 2026
@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 maintenance Maintenance work. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply SYNC response contract preservation to the v2 mutation path

1 participant