Commit 461ccda
* fix(lint): 收敛 validate-expressions / validate-security-posture 的 spec 不声明键 `??` 别名读法 (#5017)
#4984 → #5009 同族第三轮。两条规则都以 `input: 'parsed'` 注册,看到的是
`ObjectStackSchema` 解析后的产物,所以读一个 spec 不声明的键对任何能解析的
stack 都不执行。议题点名五条,全包 grep 又找出同形的两条,一并处置为只读
canonical;`obj.security?.sharingModel` 整段删除 —— `ObjectSchema` 根本没有
`security` 键。
其中 `rule.expression ?? rule.predicate ?? rule.condition ?? rule.formula`
不是死代码而是活着的错:canonical 排第三,同时写了 `condition` 和被拒别名
`expression` 的规则,lint 校验的是 schema 会拒绝的那个,作者声明的那个从未
被读。测试里重建旧链演示该差异。
三个 example 与平台 default permission sets 上,改动前后 findings 逐字相同。
补两层结构性 meta-guard(declared-key ⊆ schema.shape + reachability),七条
读法各自通过变异测试。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iARDqtrhQgz6fVHDeDkbQ
* fix(cli,lint): 把消费被拒别名拼法的 fixture 改为 canonical (#5017)
#5046 把 validate-expressions / validate-security-posture 收敛为只读 spec
声明的键之后,两处 fixture 用的正是被拒的别名拼法,规则不再读它们:
- `packages/cli/test/authoring-rule-command-parity.test.ts:90` —— CI Test Core
判红点。`validations: [{ name: 'r', expression: … }]` 里 `expression` 是
`validation.zod.ts` 按名拒绝的四个别名之一,收敛后没人读,`expression-invalid`
在三命令上都不再触发。改为 canonical `condition`,并补上 `type` / `message`
让 fixture 除了那条**刻意种下的**裸引用缺陷之外完全 spec 合法 —— parity 测试
本就该跑在 spec 合法元数据上,原来的 fixture 等于种了两个缺陷。
- `packages/lint/src/runtime-gate.test.ts:125,150` —— 这两处此前是绿的,但绿得
没有意义:`validationRules` + `expression` 双重别名,使得"上下文里有一条坏
验证规则"的 fixture 实际产生 0 条 finding(实测),所以 D4 那条断言
`result.errors).toEqual([])` 通过的原因是**没有东西可减**,而不是减法正确。
改为 canonical 后上下文真的产出 1 条 `invalid CEL predicate` finding,减法
逻辑第一次被真正跑到 —— 且仍然通过。
全包 grep 过 `expression:` / `predicate:` / `formula:` 作 validation 键、
`criteria:` 作 sharing 键、`validationRules:`、`security: { sharingModel }`、
`reference_to` / `referenceTo`:其余命中要么是 #5046 里刻意 pin 住 schema 拒绝
的别名 fixture,要么属于本 PR 未改动的规则(`validate-rule-compilability.ts`
自己读 `validationRules`,已另开 #5096),要么是 objectql / driver 等包自己的
内部形状,与本次收敛无关。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018iARDqtrhQgz6fVHDeDkbQ
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 866ff16 commit 461ccda
7 files changed
Lines changed: 1175 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
91 | 97 | | |
92 | 98 | | |
93 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
126 | 131 | | |
127 | 132 | | |
128 | 133 | | |
| |||
147 | 152 | | |
148 | 153 | | |
149 | 154 | | |
150 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
151 | 161 | | |
152 | 162 | | |
153 | 163 | | |
| |||
0 commit comments