Skip to content

用 session replay 减少组件 store 样板代码 / Reduce component store boilerplate with session replay - #14

Merged
tiye merged 3 commits into
mainfrom
codex/replay-store-ux
Aug 30, 2026
Merged

tiye merged 3 commits into
mainfrom
codex/replay-store-ux

Conversation

@tiye

@tiye tiye commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

中文

用户可见结果

  • 组件调用继续保持同一个 use_store state/dispatch pair。
  • 通过 snapshot_store 与 replay_store constructors 显式选择恢复方式。
  • 删除 Todo editor state codec,改为从 typed component actions 恢复 draft。
  • 使用 start、replace-slot 与 reset modes 声明式描述 replay session。
  • 对 action history 无法安全压缩的 stores,继续保留 snapshot recovery。

安全与生命周期

  • replay entries 使用 action schema/version;遇到 malformed 或 incompatible payload 时安全回退到 initial。
  • ordinary child cleanup 会删除 replay entries;persistent feature 暂时缺席时则保留。
  • finish/cancel 会重置 session,因此下一次 render 从最新的 domain initial value 开始。
  • framework 刻意不提供任意 append/truncate mode,因为丢弃 actions 可能改变 reducer 语义。
  • replay logs 与 domain action observation、external-effect replay 保持分离。

文档

验证

  • yarn test:koka:69 项通过。
  • yarn check 通过。
  • browser route return 后 replay draft 保留。
  • Koka rebuild / Vite HMR 后 replay draft 保留。
  • full reload 后通过现有 snapshot channel 恢复 replay draft。
  • Cancel 会重置 session,reload 后也保持重置。
  • 浏览器无 warning 或 error。

English

User-facing outcome

  • Keep the component call as the same use_store state/dispatch pair.
  • Make recovery explicit with snapshot_store and replay_store constructors.
  • Remove the Todo editor state codec and recover its draft from typed component actions.
  • Describe replay sessions declaratively with start, replace-slot, and reset modes.
  • Retain snapshot recovery for stores whose action history cannot be safely compacted.

Safety and lifecycle

  • Replay entries use the action schema/version and safely fall back to initial on malformed or incompatible payloads.
  • Ordinary child cleanup removes replay entries; persistent feature absence retains them.
  • Finish/cancel reset the session so the next render starts from the latest domain initial value.
  • The framework deliberately has no arbitrary append/truncate mode because dropping actions can change reducer semantics.
  • Replay logs remain separate from domain action observation and external-effect replay.

Documentation

Verification

  • yarn test:koka: 69 passing.
  • yarn check passes.
  • Browser route return preserves the replay draft.
  • Koka rebuild / Vite HMR preserves the replay draft.
  • Full reload restores the replay draft from the existing snapshot channel.
  • Cancel resets the session and it stays reset after reload.
  • No browser warnings or errors.

Closes #8

Copilot AI lite review requested due to automatic review settings August 30, 2026 10:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@tiye tiye changed the title Reduce component store boilerplate with session replay 用 session replay 减少组件 store 样板代码 / Reduce component store boilerplate with session replay Aug 30, 2026
@tiye

tiye commented Aug 30, 2026 •

Copy link
Copy Markdown
Member Author

中文

跟踪格式更新

本 PR、#8、#12 和 #13 的标题与正文已经统一改为中英双语,并分别使用完整的 中文 与 English 章节。该约定也已写入 Agents.md 与 PLAN.md;后续影响结论的进度评论和 review 回复会沿用同样格式。

最新提交为 aa2b702,CI 已通过,PR 当前可合并。

English

Tracking format update

The titles and bodies of this PR, #8, #12, and #13 are now bilingual, with complete and separate Chinese and English sections. The convention is also documented in Agents.md and PLAN.md. Future progress comments and review replies that affect tracking conclusions will use the same format.

The latest commit is aa2b702, CI is passing, and the PR is currently mergeable.

@tiye
tiye merged commit 5bb8ced into main Aug 30, 2026
1 check passed
@tiye
tiye deleted the codex/replay-store-ux branch August 30, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

减少 typed store 样板代码并显式选择 replay 恢复 / Reduce typed store boilerplate with explicit replay recovery

2 participants