Skip to content

隐藏 feature identity 并移除跨组件 store path 协调 / Hide feature identity and remove cross-component store path coordination #7

Description

@tiye

中文

用户问题

PR #6 让 feature component 可以直接组合并引入 keyed feature root,但 feature key 仍穿过 Todo/Lab view、event、workflow 和 state helper 的签名。部分 domain action 还通过计算出的 scope path 读取 child component store,使组件 identity 和业务逻辑发生耦合。

面向用户的目标

让 component identity 成为框架持有的 scoped capability,并让 component-local value 只通过 typed serializable action 流向业务层。

范围

  • feature_root(...) 内安装 opaque current feature identity。
  • 在可行处从当前 identity 派生 feature VDOM key 和 DOM effect marker。
  • 停止在 child component 与 domain workflow helper 之间转发 panel_key
  • 让 Todo save 的 typed domain action 携带当前 editor draft。
  • 删除不再需要的 child-store read/write/path helper。
  • 保持默认 snapshot path 和 keyed multi-instance isolation 兼容。
  • 记录 local store action 与 domain action 的边界。

验收标准

  • 普通 child component function 不接收 panel_key
  • domain reducer/workflow 不通过 raw 或 computed path 检查 child local state。
  • Todo 与 Lab multi-instance isolation tests 保持通过。
  • action observation 仍然有序且可序列化。
  • Koka tests、production build、browser smoke 与 HMR snapshot checks 通过。

非目标

  • 基于 action log 的 state restoration。
  • 通用 codec derivation 或 source generation。
  • 自动 replay 带 browser/service effect 的 domain action。

English

User problem

PR #6 made feature components directly composable and introduced keyed feature roots, but feature keys still leaked through Todo/Lab view, event, workflow, and state-helper signatures. Some domain actions also read child component stores through computed scope paths, coupling component identity to business logic.

User-facing goal

Make component identity a framework-owned scoped capability and allow component-local values to flow into the business layer only through typed serializable actions.

Scope

  • Install an opaque current feature identity inside feature_root(...).
  • Derive feature VDOM keys and DOM effect markers from the current identity where possible.
  • Stop forwarding panel_key through child-component and domain-workflow helpers.
  • Make the typed Todo save domain action carry the current editor draft.
  • Remove child-store read/write/path helpers that become unnecessary.
  • Keep default snapshot paths and keyed multi-instance isolation compatible.
  • Document the boundary between local-store actions and domain actions.

Acceptance criteria

  • Normal child-component functions do not receive panel_key.
  • Domain reducers/workflows do not inspect child local state through raw or computed paths.
  • Todo and Lab multi-instance isolation tests remain green.
  • Action observation remains ordered and serializable.
  • Koka tests, the production build, browser smoke coverage, and HMR snapshot checks pass.

Non-goals

  • Action-log-based state restoration.
  • Generic codec derivation or source generation.
  • Automatic replay of domain actions with browser/service effects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: authoring组件作者 API / Component authoring APIenhancementNew feature or requestexperience: ergonomics日常组件书写体验 / Everyday component ergonomicsstatus: shipped已经合并 / Already merged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions