feat(store)!: extract nexus-wake + nexus-inmemory — tokio out of nexus-store (#300)#306
Merged
Conversation
…s-store (#300) nexus-store's production code was no_std+alloc-clean except tokio, confined to notify.rs behind the subscription feature — a packaging choice, not a design dependency (#224 already cut the WakeSource seam). Two new crates: - nexus-wake: StreamNotifiers/WakeReg/NotifyError moved verbatim from nexus_store::notify (public path now nexus_wake::*), owning tokio, foldhash, parking_lot. The StreamNotifiers white-box tests moved along from wake.rs. - nexus-inmemory: InMemoryStore/InMemoryStream/InMemoryAllPos (from nexus_store::testing) + InMemorySnapshotStore (from state.rs) as a first-class adapter crate; export/import features forward to nexus-store's. StoredFrame now carries its SchemaVersion typed (captured at append like offsets), so the read path never re-parses header bytes and wire's SCHEMA_VERSION_OFFSET stays pub(crate); the unreachable CorruptSchemaVersion variant is gone. nexus-store drops tokio/foldhash/parking_lot entirely; the subscription feature is a dep-free gate; the testing feature is deleted. Deviation from the issue text: the issue kept InMemoryStore in nexus-store with a dev-dep on nexus-wake, but InMemoryStore embeds StreamNotifiers structurally behind a *feature*, and features cannot enable dev-deps — that design is a normal- dep cycle cargo rejects. Adapter-crate extraction resolves it. Test relocation (cargo constraint: a dev-dep cycle unifies types only for integration tests; the lib-test build recompiles the crate under cfg(test), so nexus-inmemory's impls satisfy none of its bounds): - InMemoryStore-fixture test mods of export/import/cbor/decoded/projection moved to tests/ (import's private plan_section tests stayed inline as plan_tests; cbor's white-box mod stayed, only the store-using pipeline test moved). - inmemory_store_tests + inmemory_conformance moved to nexus-inmemory. - catchup/subscription_cursor white-box mods (pub(crate) seams) now drive an in-crate TestStore double (src/test_support.rs, cfg(test)-only); the public subscribe surface stays proven against the real adapter + real nexus-wake in tests/subscription_tests.rs. fjall/postgres repoint nexus_store::notify -> nexus_wake; examples repoint nexus_store::testing -> nexus_inmemory. CLAUDE.md architecture docs updated (also folds in the shared-rules dedup to the global ~/.claude/CLAUDE.md). Closes #300 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…d tests (#300) Co-Authored-By: Claude Fable 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.
Why
nexus-store's production code isno_std+alloc-clean except tokio, confined tonotify.rsbehind thesubscriptionfeature — a packaging choice, not a design dependency (#224 already cut theWakeSourceseam). This is the prerequisite for the store no_std port (#301) and moves the public pathnexus_store::notify::*before the 1.0 freeze makes it permanent.What
nexus-wake—StreamNotifiers/WakeReg/NotifyErrormoved verbatim (git mv); ownstokio/foldhash/parking_lot. TheStreamNotifierswhite-box tests fromwake.rsmoved along.nexus-inmemory—InMemoryStore+InMemorySnapshotStoreas a first-class adapter crate (RawEventStore + WakeSource + SnapshotStore + StreamLister/AtomicAppend behindexport/import).StoredFramenow carries itsSchemaVersiontyped (captured at append likeoffsets), so the read path never re-parses header bytes —wire::SCHEMA_VERSION_OFFSETstayspub(crate)and the unreachableCorruptSchemaVersionvariant is gone.nexus-store— zerotokio/foldhash/parking_lot;subscriptionis a dep-free gate; thetestingfeature is deleted.nexus_store::notify→nexus_wake; examples repointnexus_store::testing→nexus_inmemory.Deviation from the issue text
#300 kept
InMemoryStorein nexus-store with a dev-dep on nexus-wake — butInMemoryStoreembedsStreamNotifiersstructurally behind a feature, and features cannot enable dev-dependencies, so that design is a normal-dep cycle cargo rejects. Extracting the adapter crate (as discussed) resolves it.Test relocation
A dev-dep cycle unifies types only for integration tests; the lib-test target recompiles the crate under
cfg(test)as a distinct crate, sonexus-inmemory's impls satisfy none of its bounds. Hence:InMemoryStore-fixture mods of export/import/cbor/decoded/projection moved totests/(import's privateplan_sectiontests stayed inline; cbor's white-box mod stayed, only the store-using pipeline test moved).inmemory_store_tests+inmemory_conformancemoved intonexus-inmemory.catchup/subscription_cursorwhite-box mods (pub(crate) seams:CATCHUP_CHUNK,live_stepped) drive an in-crateTestStoredouble (src/test_support.rs, cfg(test)-only, ~200 lines); the public subscribe surface stays proven against the real adapter + realnexus-wakeintests/subscription_tests.rs.Acceptance (from #300)
nexus-storehas notokio/foldhash/parking_lotdependencynexus-fjall+nexus-postgresbuild againstnexus-wakenix flake checkgreen (pre-commit); 1051/1051 workspace tests pass; clippy clean under--all-features --all-targetsCloses #300
🤖 Generated with Claude Code