Extract MutationEngine and TableBinding abstractions#201
Merged
Conversation
Decouple mutation orchestration from V2 engine internals by introducing clean abstraction layers. This enables pluggable storage backends (e.g. SlateDB) without touching core mutation logic. Key changes: - Add MutationEngine interface for storage/messaging abstraction - Add TableBinding interface for per-table mutation capabilities - Add generic MutationService that handles Edge/MultiEdge uniformly - Replace V3MutationService with generic MutationService - Replace V3CompatibleTableBinding with V2BackedTableBinding - Unify EdgeMutationStatus/MultiEdgeMutationStatus into MutationResult - Unify MutationEvent<K> generic into sealed MutationKey type - Extract MutationMode and MutationModeContext for mode decisions - Add V2BackedEngine and V2BackedMessageBinding as V2 adapters Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
em3s
added a commit
that referenced
this pull request
Mar 25, 2026
…l detection Instead of classifying all 134 packages into v3/adapter/v2/shared, detect leaks by finding all callers of Graph class and applying exclude/include rules: 1. Class exclude (V2Backed*) — adapter classes always OK 2. Package include (v2.engine.v3) — overrides exclude for monitoring 3. Package exclude (v2.engine, server.api.graph.v2) — V2 internals OK 4. Everything else calling Graph = leak Config reduced from 208 lines to 38 lines. Validated against pre-#201 code: correctly detects V3MutationService as leak (6 edges). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 task
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.
Summary
Extract a V3 engine abstraction layer (
MutationService,MutationEngine,TableBinding) between the V3 API and V2 engine internals (Graph,Label,Wal,Cdc). This enables swapping V3 engine implementations without modifying core mutation logic.Closes #200
Before
V3MutationServicewas a 298-line God class: Edge/MultiEdge branching, V2 type conversion, WAL/CDC, error handling all mixed togetherEdgeMutationStatus,MultiEdgeMutationStatus,MutationStatus— 3 redundant result typesMutationEvent<K>generic — Edge and MultiEdge diverge via separate type parametersAfter
MutationService(97 lines): generic mutation orchestration, no Edge/MultiEdge distinctionMutationEngine+TableBinding: interfaces with no V2 dependenciesV2BackedEngine,V2BackedTableBinding,V2BackedMessageBinding: V2 implementationsMutationResult,MutationKey: unified result/key typesChanges
MutationEngineinterface: storage/messaging abstraction (WAL, CDC, timeout)TableBindinginterface: per-table mutation capabilities (lock, read, write, error handling)MutationService: generic mutation orchestrator handling Edge/MultiEdge uniformlyMutationKeysealed class: unifySourceTarget(Edge) andId(MultiEdge) into a single key typeMutationResult: consolidate 3 status types into oneUnresolvedEventinterface: replaceMutationEvent.Source<E>genericV2BackedEngine,V2BackedTableBinding,V2BackedMessageBinding: V2 implementations of the above abstractionsMutationModeContext: isolate mutation mode decision logicEdgeRecordMapperandlockTimeouttoGraphDefaultsfor constructor injectionRemoved
V3MutationService→MutationServiceV3CompatibleTableBinding→V2BackedTableBindingEdgeMutationStatus,MultiEdgeMutationStatus,MutationStatus→MutationResultReviewer Notes
MutationResult; actual mutation/messaging behavior is identicalMutationEngine→TableBinding→MutationService→ V2 implementations (V2BackedEngine→V2BackedTableBinding→V2BackedMessageBinding) → verify deleted filesChecklist