chore: Phase 3 review cleanup items #47

Closed
opened 2026-06-02 09:05:51 +00:00 by xiaoju · 0 comments
Owner

From PR #46 review

Warnings discovered during Phase 3 code review. Can be addressed during Phase 4/5 or independently.

Items

  • validateName() duplication — identical implementations in packages/core/src/store.ts (MemoryVarStore) and packages/fs/src/var-store.ts (FsVarStore). Extract to a shared module (e.g. errors.ts or validation.ts in core, importable by fs).
  • Memory/FS VarStore logic duplication — ~80% shared logic (history, conflict checking, set/get/remove/update/list/history). Consider extracting shared logic or a base implementation.
  • CLI prompts doc stalepackages/cli/src/prompts/usage.md still references old openStoreAndVarStore() pattern. Update to reflect OcasStore API.
  • Legacy Store type cleanup — old Store type in types.ts (with put returning Hash | Promise<Hash>) still exported. Deprecate or remove once all consumers migrated.
  • Unnecessary asyncbootstrap() and putSchema() are async but CasStore.put() is synchronous. Consider making sync.

Timing

Phase 4 (#42 FsStore) will naturally touch VarStore code — good opportunity for the duplication items. The rest can be done anytime.


小橘 🍊(NEKO Team)

## From PR #46 review Warnings discovered during Phase 3 code review. Can be addressed during Phase 4/5 or independently. ### Items - [ ] **`validateName()` duplication** — identical implementations in `packages/core/src/store.ts` (MemoryVarStore) and `packages/fs/src/var-store.ts` (FsVarStore). Extract to a shared module (e.g. `errors.ts` or `validation.ts` in core, importable by fs). - [ ] **Memory/FS VarStore logic duplication** — ~80% shared logic (history, conflict checking, set/get/remove/update/list/history). Consider extracting shared logic or a base implementation. - [ ] **CLI prompts doc stale** — `packages/cli/src/prompts/usage.md` still references old `openStoreAndVarStore()` pattern. Update to reflect `OcasStore` API. - [ ] **Legacy `Store` type cleanup** — old `Store` type in `types.ts` (with `put` returning `Hash | Promise<Hash>`) still exported. Deprecate or remove once all consumers migrated. - [ ] **Unnecessary async** — `bootstrap()` and `putSchema()` are async but `CasStore.put()` is synchronous. Consider making sync. ## Timing Phase 4 (#42 FsStore) will naturally touch VarStore code — good opportunity for the duplication items. The rest can be done anytime. -------- 小橘 🍊(NEKO Team)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/ocas#47