feat(V2-03): one logical write coordinator (ADR-070) - #79
Merged
Conversation
Replaces the implicit `NativeMemoryStore::with_inner_write` closure authority with a single owner of the mutable product state: a BaseMyAIRuntime with a private ProductStateCell, a read-only ReadGateway, and one WriteCoordinator holding a non-clonable ProductWriteToken. All live mutation paths (memory, graph, import, purge, key/passphrase rotation) now submit closed WriteIntent values and are ordered by a canonical FIFO, with a phase-aware WAL outcome (Aborted/Durable/OutcomeUnknown) and a product visibility barrier that prevents observing a torn index state. ADR-067 remains the sole authority for physical publication; V2-03 only closes the logical write side per ADR-070 rev3. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
WriteCoordinatornow owns all product mutable state (Engine+ memory/vector/graph/FTS indexes) behind a privateProductStateCell, replacing the old arbitrarywith_inner_writeclosure authority.ReadGateway; writes submit closedWriteIntents ordered by a canonical FIFO, with a phase-aware WAL outcome (Aborted/Durable/OutcomeUnknown/DurableReopenRequired/StructuralReopenRequired) and a product visibility barrier so a reader never observes a torn index state.native_store/{mod.rs,porting.rs,trait_impl.rs}onto the coordinator (forget_many, purge_agent, graph upserts, import, container reads) and fixes a real pre-existing bug found in the process (put_memory/put_memory_batchexpected the wrongWriteValuevariant).Test plan
cargo check -p basemyai --all-targets --features test-util— 0 errorscargo xtask check(fmt + clippy-D warningsacross every crate/binding, matches CI) — exit 0cargo xtask test— full matrix passescargo test -p xtaskandcargo xtask v2-layering— pass, no unauthorized public API surface change (baseline updated to reflect resolvedwith_inner*debt)🤖 Generated with Claude Code