feat(core): MemoryStore returns OcasStore (cas + var + tag) #45

Merged
xiaoju merged 2 commits from fix/40-memorystore-ocas into main 2026-06-02 06:54:24 +00:00
Owner

What

Rewrite createMemoryStore() in @ocas/core to return the new OcasStore interface ({cas, var, tag}) defined in types.ts.

Why

Issue #40: unify the in-memory store with the new OcasStore shape introduced in #39 so downstream packages can rely on a single store API.

Changes

  • createMemoryStore() now returns OcasStore with in-memory CasStore, VarStore, TagStore.
  • Existing core tests migrated to store.cas.* access.
  • New tests for in-memory VarStore (set/get/history/tags/labels/conflicts/list filters) and TagStore (set/update/delete/tag/untag/listByTag/target independence).
  • Cross-store independence verified.

Ref

Fixes #40

## What Rewrite `createMemoryStore()` in `@ocas/core` to return the new `OcasStore` interface (`{cas, var, tag}`) defined in `types.ts`. ## Why Issue #40: unify the in-memory store with the new `OcasStore` shape introduced in #39 so downstream packages can rely on a single store API. ## Changes - `createMemoryStore()` now returns `OcasStore` with in-memory `CasStore`, `VarStore`, `TagStore`. - Existing core tests migrated to `store.cas.*` access. - New tests for in-memory `VarStore` (set/get/history/tags/labels/conflicts/list filters) and `TagStore` (set/update/delete/tag/untag/listByTag/target independence). - Cross-store independence verified. ## Ref Fixes #40
xiaoju added 1 commit 2026-06-02 06:42:45 +00:00
Rewrite createMemoryStore() to return an OcasStore with three sub-stores:
cas, var, tag. The cas sub-store keeps the existing Map-based logic, but
its put is now synchronous; the in-memory VarStore and TagStore are new
Map-based implementations of the types defined in #39.

The legacy Store.put signature is widened to Hash | Promise<Hash> so that
the new sync cas can still be passed to helpers (bootstrap, gc, render,
schema, …) that have not yet been migrated to the unified surface.

Tests in packages/core were mechanically updated from store.* to
store.cas.* and new test suites for VarStore (var-store.test.ts) and
TagStore (tag-store.test.ts) cover the spec from issue #40.

Closes #40

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
xiaoju added 1 commit 2026-06-02 06:54:15 +00:00
xiaoju merged commit 8c075b3310 into main 2026-06-02 06:54:24 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/ocas#45