-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Labels
OrchestrationArchitecture & orchestrationArchitecture & orchestrationP0Critical - Must have for V1Critical - Must have for V1size-M8 story points8 story pointsspfStream Processing FrameworkStream Processing Frameworkwave-1Wave 1: Foundation (Feb 3-10)Wave 1: Foundation (Feb 3-10)weekly-accomplishments:2/16/26
Milestone
Description
Description
Build the foundational reactive state management system based on the spike implementation. This is a lightweight state container with patch() for updating state, subscribe() for reactive listeners, batched updates via microtask flush, and immutable state snapshots. This is the #1 priority item - everything else depends on it.
Acceptance Criteria
-
createState<T>(initial: T): WritableState<T>factory function -
WritableStateinterface withcurrent,patch(),subscribe() - State updates are immutable (frozen objects)
- Subscribers are notified on state changes
- Updates are batched via microtask (queueMicrotask)
- Multiple patches in same tick only trigger one notification
-
flush()function for manual batching control - Type-safe state access and updates
- Unit tests with ≥80% coverage
Dependencies
Depends on: None - START DAY 1
Blocks: O2, O3, O5, O6, O7, O8, O9, O12, O13, F1-F16 (40+ items)
Technical Notes
Reference: /Users/cpillsbury/dev/experiments/xstate-concepts-experiments/src/vjs/store/state.ts
Key Implementation:
- Use
Object.freeze()for immutable snapshots - Use
Object.is()for change detection - Use
queueMicrotask()for batched flush - Use
Set<StateChange>for subscriber management
Files: packages/spf/src/core/state/create-state.ts, types.ts, tests/create-state.test.ts
Bundle Size Impact
Target: <1KB minified+gzipped (Core primitive, must be tiny)
Parent Epic: #384
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
OrchestrationArchitecture & orchestrationArchitecture & orchestrationP0Critical - Must have for V1Critical - Must have for V1size-M8 story points8 story pointsspfStream Processing FrameworkStream Processing Frameworkwave-1Wave 1: Foundation (Feb 3-10)Wave 1: Foundation (Feb 3-10)weekly-accomplishments:2/16/26
Type
Projects
Status
Done