2.7 KiB
2.7 KiB
Tasks: enterprise-crdt
- Change ID: enterprise-crdt
- Package:
@suaveplan/crdt - Date: 2026-04-24
Prerequisites (must be published to Verdaccio first)
@suaveplan/error@suaveplan/types@suaveplan/events@suaveplan/diff
Tasks
1. Scaffold package
- Create
universal/data/crdt/directory tree per file layout inproposal.md - Write
package.json(name@suaveplan/crdt, version0.1.0,sideEffects: false, correct workspace deps and catalog externals) - Write
tsconfig.jsonextending@suaveplan/typescript-config/library.json - Write
vitest.config.tsusingcreateTestConfig()from@suaveplan/testing/config
2. Error codes (src/error-codes.ts)
- Define
CrdtErrorCodeunion type - Call
defineCodesto register allCRDT.*codes - Export
registerCrdtErrorCodes()andCrdtError
3. Types (src/types/common.ts)
- Define and export
CRDT<TValue, TState>interface andCrdtOptions - Write
common.md
4. Core utilities
- Implement
VectorClockinsrc/core/vector-clock/withincrement,merge,compare, Zod schema - Implement
CrdtSyncManagerinsrc/core/sync-manager/using@suaveplan/diffdelta encoding - Each module:
.ts,.md,.types.ts,.test.ts,index.ts
5. CRDT implementations
GCounterinsrc/crdts/g-counter/PNCounterinsrc/crdts/pn-counter/ORSet<T>insrc/crdts/or-set/LWWRegister<T>insrc/crdts/lww-register/MVRegister<T>insrc/crdts/mv-register/TwoPSet<T>insrc/crdts/two-p-set/RGA<T>insrc/crdts/rga/- Each:
.ts,.md,.types.ts,.test.ts,index.ts; Zod state schema; event-bus integration;toJSON/fromJSON
6. OTel instrumentation
- Add spans, counters, histograms per
proposal.md§4
7. Tests
- Unit tests co-located with each CRDT (100% coverage target)
tests/integration.test.ts— two-replica merge scenarios for each CRDT typetests/property.test.ts— fast-check CRDT laws (commutativity, associativity, idempotency) perproposal.md§5
8. Benchmarks (src/__benchmarks__/crdt.bench.ts)
- Implement benchmark cases per
proposal.md§6
9. Docs
- Every
.tsimplementation file has a sibling.md - Root
README.md
10. Pre-publish gate
bunx turbo lint typecheck test --filter=@suaveplan/crdtgreenbunx turbo test:coverage --filter=@suaveplan/crdt≥ 100% on touched modules
11. Publish
bun scripts/publish.ts --package @suaveplan/crdt
12. Archive
- Fold spec delta into
openspec/specs/data/spec.md mv openspec/changes/enterprise-crdt openspec/archive/2026-04-24-enterprise-crdt