fix(liveshare-protocol): move the wire protocol to version 2

The access-mode vocabulary changed from open|approval to open|selected without a protocol version change, so a peer could declare version 1 while refusing every value the other side sends. Version 2 states the break; the retired approval name stays refused rather than reinterpreted, and an upgrade guide records the peer upgrade order.
This commit is contained in:
mektpoy committed 2026-10-23 16:13:22 +08:00
1 parent a24cb73c34
commit ace985e94f
7 files changed
+57 -5

No files matched your search

@@ -0,0 +1,16 @@
# Bilingual-pair consistency record for guide.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# After editing either side, bring the other along and re-record with:
# pnpm run verify-translation-pairing --write docs/upgrade-guide/v0.2.1-rc.2/liveshare-wire-protocol-version-2/guide.md
/:
en: d6d74981a90a107b
zh: 2445aa783257140f
/move-the-liveshare-wire-protocol-to-version-2:
en: d263ba44f18b66b6
zh: dfbccc1489a3ab82
/move-the-liveshare-wire-protocol-to-version-2/change:
en: 2ae8697061400929
zh: a8e84b8069767352
/move-the-liveshare-wire-protocol-to-version-2/migration:
en: 6b35e5397da2e12d
zh: 2beb152b15493f48
@@ -0,0 +1,18 @@
---
kind: upgrade-guide
description: "The Liveshare wire protocol moves to version 2: the accessMode vocabulary is open|selected and the withdrawn approval value is refused, not reinterpreted."
---
# Move the Liveshare wire protocol to version 2
English | [中文](guide.zh.md)
## Change
`LIVESHARE_PROTOCOL_VERSION` is now `2`. Relay registration states that version and the Relay refuses a declared mismatch; there is no version translation. In the same release the access-mode vocabulary is `open | selected`: a registration still sending the retired `approval` name is refused as an invalid value (fail-closed) instead of being reinterpreted as `open` or `selected`. A share stored under the retired name keeps its ACL and is readable; the cross-site `share-access-state` frame reports it with the narrowed `selected` name and leaves readers the access they already hold.
## Migration
1. Upgrade the owner Host, its gateway worker, and the Relay together. An owner worker or a Relay still declaring protocol version 1 is refused at registration with the declared mismatch (HTTP 426 for the owner workers, the Relay's registration refusal for shares), so upgrade every peer that registers or answers a share before serving viewers.
2. Replace `access_mode=approval` in stored deployment automation with `open` or `selected`. A registration still carrying `approval` is refused; inspect the Relay log for the refusal naming the invalid value.
3. Read one share's `share-access-state` frame after the upgrade: `accessMode` is `open` or `selected`, and a share created before the vocabulary change reports `selected` with its unchanged allowlist.
@@ -0,0 +1,18 @@
---
kind: upgrade-guide
description: "Liveshare 线协议升到版本 2:accessMode 词表为 open|selected,已退场的 approval 值被拒绝而不是被重新解释。"
---
# 把 Liveshare 线协议升到版本 2
[English](guide.md) | 中文
## 变更
`LIVESHARE_PROTOCOL_VERSION` 现在是 `2`。Relay 注册声明该版本,Relay 拒绝已声明的版本不匹配;本构建不提供逐版本翻译。同一发布里 access-mode 词表是 `open | selected`:仍发送已退场 `approval` 名称的注册会被当作非法值拒绝(fail-closed),而不会被重新解释为 `open` 或 `selected`。以已退场名称存储的分享保留其 ACL 与可读性;跨站 `share-access-state` 帧以收窄后的 `selected` 名称上报它,并保留读者已经持有的访问。
## 迁移
1. 同时升级 owner Host、它的 gateway worker 与 Relay。仍声明协议版本 1 的 owner worker 或 Relay 会在注册时被以声明的版本不匹配拒绝(owner worker 为 HTTP 426,分享为 Relay 的注册拒绝),因此在服务 viewer 之前先升级每个会注册或应答分享的 peer。
2. 把存储的部署自动化里的 `access_mode=approval` 替换为 `open` 或 `selected`。仍携带 `approval` 的注册会被拒绝;在 Relay 日志里查看点名该非法值的拒绝。
3. 升级后读取一个分享的 `share-access-state` 帧:`accessMode` 是 `open` 或 `selected`,词表变更前创建的分享上报 `selected`,其 allowlist 保持不变。