Repository navigation
Commit d31329f
fix(plugin-detail): record:path leaves out a stage the record's status option rules out (#26784)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbRJWyNMbDFFa4LtiRqCeDqp)_
Fixes #26581
Clause-②: no
Metadata-protocol: none
Ruling-ref: 6442747364 (letter A, with its guardrail); claim amendment
6442931479
## 维护者速读
- **改了什么**:记录页的阶段路径(`record:path`)不再画出本记录按规则不可能经过的阶段。状态字段的某个选项若声明了
`visibleWhen`,且对这条记录求值为假,该阶段在桌面和移动两行都不画。
- **为什么改**:订单合同(ORD)按类型跳过法务审查,但路径照位置打勾,批准后显示「审查中 ✓」,审计和申请人会读成"法务审过了"。
-
**风险与回滚**:只改一个前端渲染组件,无新键、无新请求。引用当前用户的规则不隐藏阶段;规则求值出错时保留阶段;记录当前所在的阶段始终保留。回滚即撤销本
PR。
- **先看**:`ui/packages/plugin-detail/src/renderers/record-path.tsx` 的
`stagesThisRecordWalks` 与 `readsActingUser`;新测试
`record-path.optionVisibleWhen-26581.test.tsx`。
- **两分钟验证**:`cd ui && pnpm exec vitest run
packages/plugin-detail/src/renderers/__tests__/record-path.optionVisibleWhen-26581.test.tsx`,预期
7 个用例全部通过。
- **需要你做的**:无,席位落地。
## What changes
- `record:path` filters its stages through a new
`stagesThisRecordWalks`, before won/lost classification, so both rows
(desktop and mobile) read one list. A stage is omitted when the
`statusField` option with the same value declares a `visibleWhen` that
evaluates FALSE against the bound record (`evalFieldPredicate` from
`@object-ui/core`, the evaluator the option widgets use).
- The guardrail from the ruling: a predicate that reads the acting user
(`current_user`, `user`, `ctx` or `os`, the roots the server's option
gate treats as the acting user) never hides a stage. It is detected off
the predicate source with string literals blanked. That reading can only
over-match, and an over-match keeps a stage.
- A predicate that cannot be evaluated keeps its stage (render side
fail-open, ADR-0137 D3). The stage the record currently stands on is
always kept.
- Authored `stages[]` are matched to the status options by value, the
way `declaredStageKinds` already reads `kind`.
- No new spec key, no new server read: the record and object definition
come from the record context the block already reads.
- One root changeset, `@object-ui/plugin-detail` patch.
## Why
hotclm order contracts (ORD) skip legal review by design, yet their path
drew 草稿 ✓ 已提交 ✓ 审查中 ✓ 审批中 ✓ 已批准, because every stage before the current
one ticked by position. The record's status history is not reachable
from this block without a new read (measured in os-dev-report
6441110297), so the ruling took the status option's own declaration
instead: `visibleWhen` means "offered only when TRUE (else omitted)",
and the server refuses a write of a value whose predicate is false.
## Verification
All readings below are on head `a5c3c69f` (base `origin/main`
`94bab5a2`, which carries #26689), run from `ui/` under
`scripts/pm/os-verify-lock.sh`.
<details><summary>Tests</summary>
- New file `record-path.optionVisibleWhen-26581.test.tsx`: 7/7.
- Every `record:path` test (`record-path*` and
`recordPathStagesMembers-8071`): 13 files, 102/102.
- Full `packages/plugin-detail/`: Test Files 315 passed, 1 skipped
(316); Tests 2911 passed, 18 skipped (2929); lock VERDICT command-exit
0.
- `pnpm --filter @object-ui/plugin-detail run type-check` (src and
`tsconfig.test.json`): exit 0.
</details>
<details><summary>Ablations (via scripts/ablation-replace.mjs, each
restored to the HEAD blob with an empty git diff HEAD)</summary>
The test imports the renderer from source (`../../index`, vitest alias
table), so no `dist/` sits in between.
1. Filter off (`gates.size === 0` → `gates.size >= 0`): 3 failed / 4
passed. Red: (a) the ORD path, (e) authored stages, (f) the quoted
`'user'`.
2. Acting-user guard off (`!readsActingUser(…)` → `!(readsActingUser(…)
&& false)`): 1 failed / 6 passed. Red: (b), so without the guard `false
&& current_user…` would hide the stage.
3. Current-stage guard off: 1 failed / 6 passed. Red: (d).
</details>
<details><summary>Derived gates</summary>
`node scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` on head `a5c3c69f` derived 34 commands from
3 changed paths. Every one exited 0, each exit code captured before any
pipe. Reconciliation: `--ran` reports "34 derived famil(ies) accounted
for — 34 run, 0 NOT-MEASURED (a DERIVED zero — all 34 recorded an exit
code and none of them is 3)". The three PR-body gates
(`check-adr-0087-registration --base origin/main`,
`check-closing-keyword-parity`, `check-changeset-no-major --base
origin/main`) were re-run against this exact body: exit 0. Repo-wide
lint and the remaining families are CI's.
</details>
## Acceptance notes
- hotclm still has to declare `visibleWhen` on its `in_review` option
(for example `record.contract_type != 'ORD'`); that is the hotclm seat's
card, per the ruling.
- A rule that reads a related record (`record.account.tier`) is refused
by `objectstack validate` on an object field's option, so only the
record's own columns can drive a hidden stage.
- Edge left as is: if every stage were ruled out and the record's status
matched none of them, the block would show its "no stages configured"
placeholder.
- Serial: PR #26689 edits the same file and is ahead in the merge queue.
Once it merges, this branch merges main and keeps this filter ahead of
its new classify/layout.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(No `packages/spec` change.)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` is left to CI.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: not touched.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English (the 维护者速读 section is
the Chinese brief the PR contract asks for).
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01QsR2jTgHpQBzM5GaoKifNh)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent a122269 commit d31329f
3 files changed
Lines changed: 283 additions & 2 deletions
File tree
- .changeset
- ui/packages/plugin-detail/src/renderers
- __tests__
| 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 | + | |
| 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 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
149 | 216 | | |
150 | 217 | | |
151 | 218 | | |
| |||
238 | 305 | | |
239 | 306 | | |
240 | 307 | | |
241 | | - | |
| 308 | + | |
242 | 309 | | |
243 | 310 | | |
244 | 311 | | |
| |||
247 | 314 | | |
248 | 315 | | |
249 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
250 | 324 | | |
251 | 325 | | |
252 | 326 | | |
| |||
0 commit comments