Skip to content

plugin-sharing isMatchAllCriteria 把 {$or:[]} 标成 match-all —— #5322 后它语义上是 match-none;拒收方向不变,措辞/归类过时 #5388

Description

@os-zhuang

观察类记录(#5322 收官时全仓扫同类 pin 发现,非缺陷修复对象;按 PD #10 立单不排队)。

packages/plugins/plugin-sharingisMatchAllCriteria(#3896 / ADR-0049 编写期闸门)把 { $or: [] }{ $and: [] } 一并标为 "match-all" 拒收。#5322 拍板(2026-08-04)后,{ $or: [] } 的运行期语义是 FALSE / 零行(OR 单位元)—— 恰恰是 match-none,不是 match-all;{ $and: [] } 才是 TRUE / match-all。sharing-rule.test.ts:628 的 pin 把两者钉在同一个 "should be match-all" 断言里。

为什么不是缺陷、方向也不用改:该闸门是 defineRule 编写期拒收(#5330 家族,拍板明确允许的方向),拒收一条永远共享零记录的规则与拒收 match-all 规则同样安全(under-share 方向),用户今天撞不到错误行为。#3896 当年的理由(「这些形状到引擎会变成无约束 filter」)对 { $or: [] } 一格在 #5134/#5243/#5322 后已过时 —— 引擎现在会正确给零行。

若将来有人整理:把 { $or: [] } 从 "match-all" 类移到独立的 "match-none / 无意义规则" 拒收类(或只改函数名/注释与 pin 的措辞),行为不变,措辞归位。与 #5330(publish/lint 面对字面量空组合子的编写期拒收)同向,可顺路处理。

关联:#5322#5330#3896#5134


Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions