Skip to content

BranchLifecycle:开场的注册面与生命周期数据不一致 #2213

Done

Description

@eric8810

BranchLifecycle:开场的注册面与生命周期数据不一致

开场(opening)是「branch/start 或 branch/resume 写入之后、线发布之前」这段。部件在这段登记收据(receipt),由 BranchLifecycle 在发布前执行;收据负责写开场事实(设置快照、客户端 presence),失败即开场失败。背景见 #2127、#2015。

问题

  1. 同一个注册操作有两套接口:面里的 registerOpening(跨语言,回调不带上下文),面外的 admit_opening_with(带 OpeningKind)和 opening_budget(#[service(skip)])。
  2. 面外的两个方法是服务类型上的公开方法,被访问层检查拦下(插件与服务治理:所有者提供操作,逐个扫描所有者 #2015 §5);base-1(feat(runtime): route calls by id to a live Session or line #2174)按 §5 例外把它们补进允许名单(171 → 173),等这里修完删除。
  3. 跨语言部件能注册,但拿不到 kind 和预算;Rust 部件能拿到。两种语言能力不一致,外语部件只能自己读 Timeline 推断 kind。
  4. kind(Root/Child/Resume)和开场预算是生命周期状态/配置,却通过 Rust 闭包参数与 skip 方法交付;旧做法还去读 Timeline 推断。
  5. 契约(plugin-contract §4 branchLifecycle 一行)把 registerOpening 写成面的一部分,但面里混了只有 Rust 能用的方法,且生成声明的回调没有上下文。

两种自洽的形状(选一个)

  1. 扩展面:registerOpening(completion: (opening: { kind, budgetMs }) => void | Promise<void>);Rust 和 TS 同形;删除 admit_opening_with、opening_budget。
  2. 声明 Rust-only:把注册整体移到 Rust-only 的装配内部名字(如 BranchOpening),面里只留 activated/closing;从契约与 npm/branch-services.d.ts 删除 registerOpening。

验收

  • 按选定形状实现,cargo run -p xtask -- check 通过;允许名单删掉 BranchLifecycle::opening_budget(service-skip)与 BranchLifecycle::admit_opening_with(rust-only-method)两条,不新增其它条目。
  • 跨语言:要么 TS 部件能拿到与 Rust 相同的打开上下文,要么契约明确开场注册是 Rust-only。
  • docs/design/plugin-contract.md §4 与生成的 npm/branch-services.d.ts 与实际一致。
  • 收据的顺序与失败语义不变:开场事件之后、发布之前执行;任一失败则开场失败。

相关

Activity

  1. added
    design
    core
    P0
    on Nov 27, 2026
  2. added this to the v0.1.0-alpha.30 milestone on Nov 27, 2026
  3. eric8810 commented on Nov 28, 2026

    @eric8810
    CollaboratorAuthor

    Closed by #2226 (merged 07:30Z). Branch opening now uses the branch-private BranchOpening key; the P0 set for the current release is complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P0coredesign

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions