Repository navigation
减少 typed store 样板代码并显式选择 replay 恢复 / Reduce typed store boilerplate with explicit replay recovery #8
Description
Activity
Lifecycle prerequisite update: PR #11 defines the persistent feature root versus ordinary keyed child boundary and adds snapshot-persisted child ownership markers.
For the replay prototype, logs should now follow the same ordinary-child lifecycle: remove a scoped log when that child is swept, but retain logs while its whole feature is temporarily absent. Replay metadata should stay distinct from respo/component-scope lifecycle metadata and from domain action observation. The implementation order remains snapshot lifecycle first, replay recovery second.
- changed the title
[-]Prototype action-replay component stores for HMR recovery[/-][+]Reduce typed store boilerplate with explicit replay recovery[/+]on Aug 30, 2026 Implemented as the user-facing experiment in PR #14.
The component API remains use_store(spec, initial = ...). Store authors now choose snapshot_store or replay_store. Todo editor removed its state codec and declares a session policy instead: Begin is Replay_start, draft input is Replay_replace on one stable slot, and Finish/Cancel are Replay_reset.
During implementation, an initial generic max-history design was rejected: dropping the oldest arbitrary action can change reducer results. The public prototype therefore has no append/truncate replay mode. Replay is intentionally limited to naturally bounded start/replace/reset sessions; cumulative or order-sensitive reducers continue to use snapshot_store.
Verification covers compressed draft history, reset to the latest domain initial value, malformed/version/legacy fallback, empty action payload framing, ordinary-child cleanup, route retention, Koka/Vite HMR, full reload, and browser console health. The complete author guidance is in docs/store-recovery.md.
- changed the title
[-]Reduce typed store boilerplate with explicit replay recovery[/-][+]减少 typed store 样板代码并显式选择 replay 恢复 / Reduce typed store boilerplate with explicit replay recovery[/+]on Aug 30, 2026 中文
当前进度
实现已在 PR #14 完成:Todo editor 已迁移到 replay_store,组件调用仍保持 use_store 返回的 state/dispatch pair;snapshot_store 继续服务于无法安全压缩 action history 的 stores。replay session 的 start、replace-slot、reset 语义,以及 ordinary child cleanup、persistent feature retention、HMR/localStorage 恢复均已有测试或浏览器验证。
PR #14 当前 CI 通过且可合并。合并后本 issue 由 Closes #8 自动关闭;后续用户体验工作分别由 #12 和 #13 跟踪。
English
Current progress
The implementation is complete in PR #14. The Todo editor now uses replay_store while the component call remains the state/dispatch pair returned by use_store. snapshot_store remains available for stores whose action history cannot be compacted safely. Replay session start, replace-slot, and reset semantics, together with ordinary-child cleanup, persistent-feature retention, and HMR/localStorage recovery, are covered by tests or browser verification.
PR #14 currently has passing CI and is mergeable. Merging it will close this issue through Closes #8; follow-up user-experience work is tracked separately in #12 and #13.
- addedenhancementNew feature or requestNew feature or requestarea: authoring组件作者 API / Component authoring API组件作者 API / Component authoring APIexperience: ergonomics日常组件书写体验 / Everyday component ergonomics日常组件书写体验 / Everyday component ergonomicsstatus: shipped已经合并 / Already merged已经合并 / Already merged
on Aug 31, 2026
中文
用户问题
组件调用端已经足够简洁:state 和 dispatch 通过 use_store(spec, initial = ...) 获得。但 spec 的定义成本仍然很高。一个小型本地编辑器目前需要定义 state 类型、action 类型、reducer、state codec、action codec,再组装 Store_spec。
用户可感知的目标并不是 replay 本身,而是在保留可序列化 typed actions 与 HMR 恢复能力的同时,去掉普通组件 store 定义中的持久化样板代码。
目标书写体验
原型范围
验收标准
非目标
English
User problem
The component call site is already concise: state and dispatch come from use_store(spec, initial = ...). Defining that spec is still expensive. A small local editor currently requires a state type, action type, reducer, state codec, action codec, and Store_spec assembly.
The user-visible goal is not replay by itself. The goal is to keep serializable typed actions and HMR recovery while removing persistence boilerplate from ordinary component-store definitions.
Target authoring experience
Prototype scope
Acceptance criteria
Non-goals