Skip to content

fix(components): header-action predicates wait for the record instead of reporting "No such key" - #34035

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-8ajdlr
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-8ajdlr

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Fixes #33987

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:记录页头部按钮的 visible / hidden / disabled / pressed 条件,在记录还没加载完时不再求值,也不再往控制台报错;记录到了再正常求值。
  • 为什么改:页面一打开就拿一条空记录去算条件,每个 record.status 这类条件都报 “No such key… check the field names and CEL”,让作者去改其实没错的元数据。
  • 风险与回滚:只动 page:header 一个组件;加载中各条件取各自的安全默认值(隐藏 / 不隐藏 / 禁用 / 未按下),与之前出错时的取值一致,记录到了以后行为不变。回滚即还原这一个提交。
  • 先看:ui/packages/components/src/renderers/layout/containers.tsx 的 headerRecordPending 与 evalHeaderPredicate;再看 page-header-predicate-dialect.test.tsx 末尾新增的一组测试。
  • 两分钟验证:cd ui && pnpm exec vitest run packages/components/src/__tests__/page-header-predicate-dialect.test.tsx,预期 33 条全绿。
  • 需要你做的:无,席位落地。

What changes

A record page binds its record id at once and its row only when the read answers (RecordDetailView hands data: null until then; RecordContextValue.data is documented as "undefined while loading"). page:header evaluated its action predicates against ctx?.data ?? {}, so during that window every record.FIELD predicate faulted with "No such key", and the warn-once fault report (keyed by label and predicate) told the author to check the field names of a field the object has, on every page load.

  • headerRecordPending names the state: a record context is present, it carries a record id, and its row is null/undefined.
  • evalHeaderPredicate answers each key's own fallback while pending and evaluates nothing, so nothing is reported. All four call sites (visible, hidden, disabled, pressed) go through it.
  • disabledReasonFor gives no "Not available for this record" reason while pending: the closed disabled fallback is not a fact about a record that has not arrived. Same defect class (a pending record reported as a fact about the record), same file, same gate families.
  • Unchanged: a header with no record bound (no context, or no id) still evaluates, so a record.* predicate there still faults and says so; a loaded record that really lacks the key still warns once.

No change in ui/packages/core/src/evaluator/**: the evaluator is right to fault on an empty record; the root cause is the caller spelling an absent record as an empty one.

Tests

One new top-level describe in the existing shared harness page-header-predicate-dialect.test.tsx (no new file):

  • pending → no fault report, visible answers hidden; record arrives → predicate honoured (shown), still no report;
  • loaded negative direction → hidden, no report;
  • pending hidden / disabled / pressed → rendered, disabled, aria-pressed="false", no aria-describedby reason, no report; after load → enabled, pressed, no report;
  • CONTROL: a loaded record missing f_status → hidden and exactly one fault naming f_status;
  • CONTROL: no record id bound → still faults once.

No existing test was edited.

Acceptance notes

  • Triage asked whether the rendered buttons are wrong after the record loads. Measured on the shipped code (fix ablated, same harness): pending [false,false] with 2 fault reports; after load [true,false], which is the predicates' own verdict. So only the pre-load pass was wrong; the authored rule was already honoured once the record arrived. With the fix: pending [false,false], 0 reports; loaded [true,false], 0 reports.
  • While pending, a predicate that reads only the host scope (for example ctx.user.isPlatformAdmin == true) also waits for the record, where it used to evaluate at once. The header shows its record-gated and user-gated actions together, once the row arrives.

Verification

Ablations (fix committed first; restored blob == HEAD each time)
  • headerRecordPending forced to false: 3 of the 5 new tests red (expected [ Array(1) ] to have a length of +0 but got 1 on both pending fault-count pins; the legs test red on aria-describedby); both CONTROL tests stay green.
  • only the disabledReasonFor pending line deleted: 1 red (the legs test, aria-describedby).
Local runs at a1d4af3
  • cd ui && pnpm exec vitest run packages/components/src/__tests__/page-header-predicate-dialect.test.tsx: 33/33 passed.
  • pnpm --filter @object-ui/components test --maxWorkers=2 (under the verify lock): Test Files 479 passed, 1 skipped (480); Tests 4595 passed, 24 skipped.
  • pnpm --filter @object-ui/components type-check (after building the dependency closure): exit 0.
  • node scripts/pm/dispatch-gates.mjs --commands: 37 derived families, each run, all exit 0; --ran reconciliation: 37 run, 0 NOT-MEASURED, 0 UNRUN. pnpm --dir ui exec vitest run scripts/ first exited 1 only because @objectstack/client had no build in this container (unresolved-entry list); after the build it passed 171 files / 5065 tests.

Generated by Claude Code

…rd arrives

While the record page's read is in flight the header bound an empty
record, so every record.<field> predicate faulted with "No such key" and
the warn-once report told the author to check field names the object has.
A bound record id with no row is now its own pending state: each predicate
answers its key's fallback and reports nothing until the row arrives.

Claude-Session: https://claude.ai/code/session_01ADHkmQj66qNAyERYxzoNgw
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 15, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-steve · session_01ADHkmSzhXR4yUAgwq1bQRi

维护者速读

  • 改了什么:记录页头部按钮的 visible / hidden / disabled / pressed 条件,在记录还没加载完时不再求值、不再报错;记录到了再正常求值。
  • 为什么改:页面一打开就拿空记录去算条件,每个 record.status 这类条件都报 “No such key… check the field names and CEL”,误导作者去改没错的元数据(Record page header-action visible predicates log "No such key: status — check the field names and CEL" on every load for fields the object has #33987)。
  • 风险与回滚:只动 page:header 一个组件;加载中各条件取各自的安全默认值,与之前出错时的取值相同,记录到达后行为不变。回滚即还原这一个提交。
  • 先看:ui/packages/components/src/renderers/layout/containers.tsx 的 headerRecordPending,及 page-header-predicate-dialect.test.tsx 末尾新增的一组测试。
  • 两分钟验证:cd ui && pnpm exec vitest run packages/components/src/__tests__/page-header-predicate-dialect.test.tsx。
  • 需要你做的:无,席位落地。

席位意见:ACCEPT。根因在调用方把“记录未到”当成“空记录”,修在调用方而非求值器,正确;加载中的 disabledReason 一并不报,是同类同文件的就地修。

席位核对 — ACCEPT · domain:ui#2 · head a1d4af39 · 2026-11-15T17:35Z

  • Shape: draft → main, first line Fixes #33987, no other closing keyword in the body. Clause-②: no / Metadata-protocol: none match the claim (6897461181).
  • Diff read by the seat (/pulls/34035/files): containers.tsx +30/−8, one test file +100, one changeset +13. Inside the claimed surface; no ui/packages/core/src/evaluator/** change (the dev measured the evaluator right).
  • Premise measured by the dev: only the pre-load pass was wrong; verdicts after load were already right (answers triage 6897088718).
  • Gates: check-runs on a1d4af39 = success 45, skipped 13, failure 0, read 2026-11-15T17:35Z. Dev: 37/37 derived gates run, 0 NOT-MEASURED.
  • Accepted deviation: disabledReasonFor gives no reason while pending (same defect class, same file, named in the body). Open question answered A (every header predicate waits for the record).
  • Out of scope: none. Skills-docs: n/a (Metadata-protocol: none).
  • Landing: K = 13 < 15, mergeable_state clean; no governed path. Ready + auto-merge now.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 17:35
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 39fa82b Nov 15, 2026
59 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-8ajdlr branch November 15, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Record page header-action visible predicates log "No such key: status — check the field names and CEL" on every load for fields the object has

2 participants