This repository was archived by the owner on Aug 11, 2026. It is now read-only.
feat(plugin): 增加可选 installCount 协议契约 - #50
Draft
nanaco666 wants to merge 1 commit into
Draft
Conversation
nanaco666
marked this pull request as ready for review
August 10, 2026 12:31
|
| Filename | Overview |
|---|---|
| packages/plugin-protocol/src/delivery.ts | 新增公开计数类型、严格解析逻辑,并对列表及详情路径对称地保留合法可选字段;未发现可触达的契约或兼容性缺陷。 |
| packages/plugin-protocol/src/tests/delivery.test.ts | 覆盖缺失、零值、安全整数、超安全整数字符串、非法表示、非 public scope 和详情路径。 |
| docs/plugin-protocol.md | 清晰记录安装次数口径、wire 表示、展示语义、兼容行为和 schema 版本纪律。 |
Reviews (1): Last reviewed commit: "feat(plugin): add optional install count..." | Re-trigger Greptile
nanaco666
marked this pull request as draft
August 10, 2026 12:38
Signed-off-by: nanaco666 <105962962+nanaco666@users.noreply.github.com>
nanaco666
force-pushed
the
feat/plugin-install-count-contract
branch
from
August 10, 2026 12:44
ade508a to
0c13a63
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
服务端 PR-2C(xindong/cindy-server#369)已经能够把公共插件的
installCount投影到列表/详情根对象,但当前cindy-protocol的 canonicalparseListPluginsResponse/parseGetPluginResponse会重建对象并丢弃未知字段。本 PR 是独立、最小的共享协议前置 PR-2P:先在协议仓声明、校验并保留该字段;服务端和客户端业务适配不在本 PR 内。安装量口径
installCount表示平台累计的成功安装次数,不是下载量、下载尝试、当前存量安装数、去重用户数或设备数。一次事件只有在客户端完成下载、校验、解包、落盘并确认安装成功后才成立;打开详情、申请下载 URL、失败的下载/校验/解包/落盘和插件升级均不计入。重装按既定口径视为新的成功安装事件,重复回执由后续服务端幂等链路处理。字段契约
VisiblePluginSummary和VisiblePluginDetail根对象新增可选installCount?: number | string。scope: "public"的 Plugin 携带;非 public 携带时按坏帧拒绝。number必须是 JavaScript 安全非负整数,包含0;负数、小数、NaN、无穷和超出安全整数范围的 JSON number 均拒绝。string必须是非空、只含 ASCII 十进制数字的字符串,允许前导零和任意长度;"0"、"42"、"00042"与超长数字串均原样保留,不经过number转换,因此大数不丢精度。installCount: undefined。null、空串、空白、正负号、小数、指数、全角数字和其他非法值均抛出带字段路径的PluginProtocolError。变更内容
packages/plugin-protocol/src/delivery.ts增加公开PluginInstallCount类型、summary/detail 可选字段及严格运行时 parser。docs/plugin-protocol.md,记录累计成功安装口径、任意长度字符串表示、兼容行为和 schema 版本纪律。兼容性与合并顺序
这是 v2 的 additive optional field,不提升
PLUGIN_API_SCHEMA_VERSION。旧服务端不下发时,新客户端继续解析并隐藏安装量;新服务端下发时,旧客户端按既有规则忽略未知字段。推荐顺序:
xindong/cindy-server#364和 PR-2Cxindong/cindy-server#369才可 bump submodule 到协议仓已合并 commit,并完成各自业务链路。makecindy/cindy#2337与本地调用统计 PR-1makecindy/cindy#2310按各自依赖推进;后续组装/UI PR 再消费安装量字段。本 PR 不声称 #364、#369、#2337 或 #2310 已完成,也不声称 P2C 已就绪。
范围 / 不范围
包含:共享类型、canonical list/detail parser、运行时错误路径、兼容与坏帧测试、协议文档。
不包含:服务端存储或成功安装回执、P2A/P2B/P2C 业务代码、P1 本地调用计数、客户端 IPC/UI、排序筛选、下载量定义、设备身份、遥测、历史回填,以及父仓
D:\cindy-server-p2的 submodule 指针变更。验证
已通过:
结果:lint、format、全 workspace typecheck/build 全部通过;全 workspace 测试通过(model-access 32、plugin-protocol 67、slack-hook 149,共 248 tests)。独立 diff 审查未发现 P0/P1。提交为单一
Signed-off-bycommit。GitHub Actions 对 fork PR 的 workflow 需要上游管理员批准运行;当前账号没有批准权限。该权限门不会被描述为代码测试通过,也不会绕过维护者的 hosted CI 要求。
风险与回滚
number。本 PR 保持 Draft,等待维护者评审和 hosted CI。关联:xindong/cindy-server#364、xindong/cindy-server#369、makecindy/cindy#2337、makecindy/cindy#2310。