Repository navigation
Commit 23ee3ae
fix(app-shell): the record page reads the lock service's 501 silently and asks no more (#26841)
<!-- claude-projects-attribution: {"github_login":"huangyiirene"} -->
_Requested by **Irene** · [project
thread](https://claude.ai/code/project/chan_01TJXtQ1tVD26ecLDZxFS67x?thread=cmsg_01TJXtQ1tVD26ecLDZxFS67xAVdK2axL7ynomwkD2iDbXe)_
Fixes #26632
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:记录页读审批锁时不再走 SDK 客户端,改用 hook 自己的 fetch;501
静默并记住,本次页面加载内不再读锁;其它失败仍按原格式记日志。
- 为什么改:没有审批服务的部署(新脚手架)每打开一条记录就在浏览器控制台打一条红色 `HTTP request failed ... ->
501`,而 501 正是设计中的「没有锁服务」。
- 风险与回滚:只动 app-shell 一个 hook;锁读请求改走与审批列表读相同的传输,不再带 SDK 客户端的头。回滚即 revert
本 PR。
- 先看:`ui/packages/app-shell/src/hooks/useRecordApprovals.ts` 的
`readRecordLock` 与 `startRead`
里的读锁分支;`RecordDetailView.approvalLock-25934.test.tsx` 新增两条用例。
- 两分钟验证:`cd ui && pnpm exec vitest run
packages/app-shell/src/views/RecordDetailView.approvalLock-25934.test.tsx`,预期
6/6 通过。
- 需要你做的:无,席位落地。
## What changes
`useRecordApprovals` asks `GET /approvals/records/OBJECT/ID/lock` when
the approvals list finds no pending request (#25934). It used to read it
through `client.approvals.getRecordLock`. The SDK client logs every
non-2xx with `logger.error('HTTP request failed', …)` before its caller
sees the answer, and the console's client logger
(`createQuietHttpLogger` in `@object-ui/data-objectstack`) prints that
with `console.error`. So on a composition without the approvals service,
whose designed answer to that read is `501 NOT_IMPLEMENTED`, every
record open printed a red line, although the hook already treated the
501 as "not locked".
Measured producer: `packages/client/src/index.ts` `fetch()` (the
unconditional `logger.error` on `!res.ok`) →
`ui/packages/data-objectstack/src/index.ts`
`createQuietHttpLogger().error` → `console.error`. The PM hypothesis
held. The fix lands in app-shell, the expected file surface, so
`@objectstack/client` is not changed.
- The lock is now read through the hook's own `fetchJson`, the same
transport the approvals list read beside it already uses. That transport
logs nothing. The `{ success, data }` envelope is unwrapped as the SDK
did.
- A 501 is read silently and latched in a module-scoped flag
(`recordLockAbsent`): no record asks again until the page reloads.
`__resetRecordApprovalsStore` clears it.
- Any other failure still logs, through the same `createQuietHttpLogger`
the SDK client would have used: `HTTP request failed: GET URL -> STATUS
[CODE]`, a 404 still demoted to debug. The next open asks again.
- The read still happens only where an adapter is mounted, as before. A
first draft dropped that gate, and
`RecordDetailView.recordOpenWaves-13010` caught the lock read appearing
as a second wave on its adapter-less page. The gate is kept.
## Why
The triage ruling on the card (6441358448): the record page treats a 501
from the lock read as "no lock service", silent, no retry; any other
failure still logs.
## Tests
- `RecordDetailView.approvalLock-25934.test.tsx` now stubs the lock
route on the global fetch rather than the adapter's SDK method, and pins
that the SDK method is never called.
- New: the 501 logs no `console.error` line naming the lock path, and a
second open of the record reads the list again but not the lock.
- New: a 500 logs one identified line (`GET … -> 500`), and the next
open asks again.
- Ablation: with the 501 branch mutated to never match
(`scripts/ablation-replace.mjs`, restore verified by blob hash), the new
501 test went red on the `HTTP request failed: GET
/api/v1/approvals/records/account/acc_northwind/lock -> 501
[NOT_IMPLEMENTED]` line, 1 failed / 5 passed.
## Acceptance notes
- The browser's own network line for the first 501 still appears once
per page load. JS cannot suppress it, and the console cannot know the
service is absent without asking, because the approvals list door
answers `200 { data: [] }` when the service is missing while the lock
door answers 501. Removing that last line needs the two server doors to
agree, which is `domain:server` work
(`packages/rest/src/approvals-routes.ts`) and outside this card. Noted,
not filed.
- The lock read no longer carries the SDK client's `X-Environment-Id`
and `Accept-Language` headers. The approvals list read beside it never
did, and the console's adapter sets no environment id.
## Verification
All on head a0185cf, in a shared container (seconds are shared-box
seconds).
- `cd ui && pnpm exec vitest run
packages/app-shell/src/hooks/useRecordApprovals
packages/app-shell/src/hooks/__tests__/useRecordApprovals
packages/app-shell/src/views/RecordDetailView.recordOpenWaves-13010.test.tsx
packages/app-shell/src/views/RecordDetailView.approvalLock
packages/app-shell/src/views/RecordApprovalsPanel`: Test Files 15 passed
(15), Tests 107 passed (107).
- `pnpm --filter @object-ui/app-shell run type-check`: exit 0.
- `node scripts/pm/dispatch-gates.mjs --commands`: 34 derived commands,
each run locally with exit 0, `pnpm check:type-check-debt` included
(re-run under the verify lock after its first run could not get the
lock). `node scripts/check-sdui-manifest.mjs` exit 0.
- Narrowed, declared: the full app-shell package suite was not run to
completion locally. It was stopped after 40 minutes on the shared box,
after it had already surfaced the waves-13010 regression fixed above.
CI's `Test UI` runs it.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes. (No formatter ran. 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: its generated artifacts are
regenerated and committed. (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.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01J8VVAojjEQUUoMeSBSdgW4)_
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>1 parent 67cf0b1 commit 23ee3ae
3 files changed
Lines changed: 167 additions & 51 deletions
File tree
- .changeset
- ui/packages/app-shell/src
- hooks
- views
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
304 | 308 | | |
305 | 309 | | |
306 | 310 | | |
307 | | - | |
308 | | - | |
| 311 | + | |
| 312 | + | |
309 | 313 | | |
310 | 314 | | |
311 | 315 | | |
| |||
317 | 321 | | |
318 | 322 | | |
319 | 323 | | |
| 324 | + | |
320 | 325 | | |
321 | 326 | | |
322 | 327 | | |
| |||
500 | 505 | | |
501 | 506 | | |
502 | 507 | | |
503 | | - | |
504 | | - | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
505 | 549 | | |
506 | 550 | | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
| 551 | + | |
513 | 552 | | |
514 | 553 | | |
515 | 554 | | |
| |||
529 | 568 | | |
530 | 569 | | |
531 | 570 | | |
532 | | - | |
| 571 | + | |
533 | 572 | | |
534 | 573 | | |
535 | | - | |
| 574 | + | |
536 | 575 | | |
537 | 576 | | |
538 | 577 | | |
| |||
599 | 638 | | |
600 | 639 | | |
601 | 640 | | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
610 | 644 | | |
611 | 645 | | |
612 | 646 | | |
| |||
629 | 663 | | |
630 | 664 | | |
631 | 665 | | |
632 | | - | |
| 666 | + | |
633 | 667 | | |
634 | 668 | | |
635 | 669 | | |
636 | 670 | | |
637 | 671 | | |
638 | | - | |
| 672 | + | |
639 | 673 | | |
640 | 674 | | |
641 | 675 | | |
642 | 676 | | |
643 | | - | |
644 | | - | |
| 677 | + | |
| 678 | + | |
645 | 679 | | |
646 | 680 | | |
647 | 681 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| |||
126 | 130 | | |
127 | 131 | | |
128 | 132 | | |
| 133 | + | |
129 | 134 | | |
130 | 135 | | |
131 | 136 | | |
| |||
137 | 142 | | |
138 | 143 | | |
139 | 144 | | |
140 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
141 | 155 | | |
| 156 | + | |
142 | 157 | | |
143 | 158 | | |
144 | 159 | | |
145 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
146 | 170 | | |
147 | 171 | | |
148 | 172 | | |
| |||
181 | 205 | | |
182 | 206 | | |
183 | 207 | | |
184 | | - | |
185 | | - | |
| 208 | + | |
| 209 | + | |
186 | 210 | | |
187 | | - | |
188 | 211 | | |
189 | 212 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
| 213 | + | |
| 214 | + | |
195 | 215 | | |
196 | 216 | | |
197 | 217 | | |
198 | | - | |
| 218 | + | |
199 | 219 | | |
200 | 220 | | |
201 | | - | |
| 221 | + | |
202 | 222 | | |
203 | 223 | | |
204 | 224 | | |
| |||
216 | 236 | | |
217 | 237 | | |
218 | 238 | | |
| 239 | + | |
| 240 | + | |
219 | 241 | | |
220 | 242 | | |
221 | 243 | | |
222 | 244 | | |
| 245 | + | |
223 | 246 | | |
224 | 247 | | |
225 | 248 | | |
226 | 249 | | |
| 250 | + | |
227 | 251 | | |
228 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
229 | 257 | | |
230 | 258 | | |
231 | | - | |
232 | | - | |
| 259 | + | |
| 260 | + | |
233 | 261 | | |
234 | 262 | | |
235 | 263 | | |
236 | | - | |
| 264 | + | |
237 | 265 | | |
238 | 266 | | |
239 | 267 | | |
| |||
242 | 270 | | |
243 | 271 | | |
244 | 272 | | |
245 | | - | |
246 | | - | |
| 273 | + | |
| 274 | + | |
247 | 275 | | |
248 | 276 | | |
249 | | - | |
| 277 | + | |
250 | 278 | | |
251 | 279 | | |
252 | 280 | | |
253 | 281 | | |
254 | 282 | | |
255 | 283 | | |
256 | 284 | | |
257 | | - | |
258 | | - | |
| 285 | + | |
| 286 | + | |
259 | 287 | | |
260 | 288 | | |
261 | | - | |
| 289 | + | |
262 | 290 | | |
263 | 291 | | |
264 | 292 | | |
265 | 293 | | |
266 | 294 | | |
267 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
268 | 331 | | |
269 | | - | |
270 | | - | |
| 332 | + | |
| 333 | + | |
271 | 334 | | |
272 | 335 | | |
273 | 336 | | |
274 | 337 | | |
275 | 338 | | |
276 | | - | |
| 339 | + | |
277 | 340 | | |
278 | 341 | | |
0 commit comments