Skip to content

fix(console): a lookup target the presence read served is not read again by name - #35398

Merged
objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/issue-35306-lookup-target-single-read
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 8 commits into
mainfrom
claude/issue-35306-lookup-target-single-read

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #35306

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:控制台列表页上,查找字段指向包外对象(showcase 上是 sys_user)时,?names= 存在性读取已经带回了对象定义,之后不再按名字(meta/object/sys_user)再读一次;应用导航 requiresObject 与仪表盘部件对象同理。
  • 为什么改:卡片要求列表页对查找目标只读一次;实测 showcase 列表页同一对象先后读两次,相隔约 0.7 秒,后一次是列表页的尾部请求之一。
  • 风险与回滚:只动 MetadataProvider.readObjectScope 一处分支,只复用存在性读取「已返回定义」的答案;被省略(不存在或被拒)的名字照旧按名字读,所以「不存在」与「被拒(OBJECT_PACKAGE_DISABLED)」的区分不变;草稿预览不复用。回滚即 revert 本 PR。
  • 先看:ui/packages/app-shell/src/providers/MetadataProvider.tsx(readObjectScope 里 presentDefinition 分支与随后的 bump()),ui/packages/app-shell/src/providers/__tests__/MetadataProvider.scopeRefusal-13052.test.tsx(新增的拒绝边界钉子)。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/providers/__tests__/MetadataProvider.scopeRefusal-13052.test.tsx packages/app-shell/src/console/__tests__/appObjectScope-12811.test.tsx,预期 2 个文件全绿。
  • 需要你做的:无,席位落地。

What changes

Traced first, on a real app (showcase, pnpm dev -- --fresh --ui on a private port, production console build, signed in through the login page, headless Chromium 1440x900, one warm-up load, then a fresh page per load; every /api/ Resource Timing entry to network idle plus 3 s; request initiators from the DevTools protocol).

  1. Both reads, in that order (A1 holds). On the list page /apps/com.example.showcase/showcase_task, every run sent meta/object?names=sys_user and then meta/object/sys_user, 0.64 to 0.76 s later. Both initiator stacks run from a React render through appObjectScope; the second ends in the adapter's getObjectSchema (fetchScopeName, readItem).
  2. The presence answer carries everything the by-name path hands its callers (A2 holds). Read live from the same server and session: the sys_user item in the ?names= answer is deep-equal to item in the by-name answer. The by-name envelope adds sortability and cascadeDeleteObjects; the adapter puts both on its own copy under symbol keys, and the provider's cloneServedObject (a structuredClone) drops them, so no scope reader ever saw them. Switched-off actions ride both answers (disabledActions, keyed by object on the list door).
  3. The fix. readObjectScope: before asking a name by name for a scope, take the definition the batched names scope (the presence read) already SERVED for it. Only a served answer is taken. A name the presence read left out, has not answered yet, or failed is asked by name exactly as before, so the by-name door stays the one authority on absent versus refused. The draft preview never takes it. A reader that asked the name for its side effect (a route's lookup targets) learns of it on the render the provider's bump() causes, as it would on a by-name answer landing.
  4. The same rule also answers an app entry's requiresObject and a dashboard widget's object once their presence read has served them. Those were the same double read: on an app whose package holds no objects of its own, three by-name reads go away (the updated pins below show it).
  5. The ~0.7 s gap (A4). The presence answer lands inside a long main-thread task (390 to 468 ms, the list page's render and chunk work), and in both instrumented runs the by-name request starts at the end of a later render task (start 2022 ms with a task ending 2022; start 1954 with a task ending 1955). The by-name read waited for the render that consumed the presence answer. With the read gone, that wait is gone too.
Readings: before (origin/main 81c0947) and after (this branch, a949078 product code plus the bump fix)

Requests counted from navigation, chain depth = 1 + the deepest request that ENDED before this one STARTED.

showcase list page before after
/api/ requests per load 26, 26, 26, 26, 26 25, 25, 25
reads of sys_user's definition 2 (?names=, then by name) every run 1 (?names=) every run
chain depth 11, 11, 10, 12, 10 11, 12, 9
the card's grouping (requests that run together) 6 6

Before, run 2:

L5   1214->1232   meta/object?names=sys_user
L9   1789->1858   data/showcase_task, data/sys_user/ID, data/sys_inbox_message, approvals/requests
L10  1919->1942   meta/object/sys_user
L11  2083->2108   data/sys_notification_receipt

After, run 1:

L6    927->946    meta/object?names=sys_user
L10  1334->1421   data/showcase_task, data/sys_user/ID, data/sys_inbox_message, approvals/requests
L11  1598->1623   data/sys_notification_receipt

Long tasks (start, duration in ms) beside the before runs: run 1 [1235,468] [1781,71] [1865,51] [1930,92] with the presence answer at 1259 and the by-name start at 2022; run 2 [1286,390] [1749,65] [1876,79] with the presence answer at 1316 and the by-name start at 1954.

Tests

  • MetadataProvider.scopeRefusal-13052.test.tsx, new top-level describe on its real-ObjectStackAdapter harness: a name the presence read served joins the route scope with that definition and is asked by name zero times; a name it left out is asked by name and its refusal is still named OBJECT_PACKAGE_DISABLED (flat and wrapped envelope); CONTROL: left out and answered 404 RESOURCE_NOT_FOUND is the plain absence.
  • The pins that encoded the old second read now pin one read: appObjectScope-12811, AppContent.objectScope-12811 (the held-read case now holds the presence read), AppContent.emptyPackageScope-13046, AppContent.packagelessReads-29416, AppContent.packagelessRecordRelated-29552, AppContent.packagelessRoot-29552 (a note-entry probe: the bundle answers it through the presence read, no request), AppContent.pageRouteObjects-12980, AppContent.dashboardRouteReads-28784, packagelessChromeScope-12980. Where a pin read the scope or the sidebar gate, it still asserts the object arrives there; the by-name call is what is gone.
  • The no-404 pins of the presence read (an unregistered lookup target or requiresObject is never asked by name) pass unchanged.
Ablations (scripts/ablation-replace.mjs; each restored: blob == HEAD, git diff HEAD empty)
  • if (present) { to if (present && false) {: 16 failed / 21 passed across scopeRefusal-13052, appObjectScope-12811, AppContent.objectScope-12811, the new served-name pin among them.
  • if (answeredFromPresence) bump(); deleted: 2 failed / 16 passed in appObjectScope-12811 (expected 'sys_invitation' to be 'sys_invitation,sys_user'): without the bump a packageless list route never shows the target that joined its scope.

Acceptance notes

  • HotCRM: NOT MEASURED. HotCRM is not in this container; a shallow clone worked, but installing its dependencies (pnpm install in the clone) was refused by the session's permission classifier, so it could not be booted. The change is app-neutral (it keys on the presence read, not on any object name); the showcase readings above are the measured app.
  • The layer count does not drop on the showcase. The by-name read shared the trailing group with data/sys_notification_receipt, which waits on data/sys_inbox_message, so the card's grouping stays at 6 and the chain depth stays in its noise band (9 to 12). What goes away is one request per load and the 0.6 to 0.8 s the page kept a request open after its data had landed.
  • The absent/refused distinction of the batched names scope is unchanged and now pinned at the boundary this PR touches (Tests, first item). The batched scope's own doc comment and the lookup-target comment in appObjectScope.ts now say which part of its answer a route takes.
  • The by-name read used to warm the adapter's own getObjectSchema cache for the target as a side effect. Nothing on the list page read that cache (the after trace has no by-name read of sys_user at all); a later reader that needs the schema reads it then.

Verification

On head 047e7f29 (origin/main merged; the incoming commits touch no file of this diff; workspace rebuilt after the merge):

  • cd ui && pnpm exec vitest run packages/app-shell/src/console/ packages/app-shell/src/providers/ packages/app-shell/src/hooks/ packages/app-shell/src/views/__tests__/ apps/console/src/ under the verify lock: Test Files 847 passed (847), Tests 7852 passed (7852); pnpm --filter @object-ui/app-shell run type-check: exit 0.
  • node scripts/pm/dispatch-gates.mjs --commands on 047e7f29: 38 derived families, 38 run, each exit 0; --ran reconciliation: 38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN. check:type-check-debt was re-run under the lock after its first call timed out in the queue: OK — 0 ledger entr(ies) re-measured. pnpm --dir ui exec vitest run scripts/: Test Files 171 passed, 2 skipped. pnpm check:new-line-citations (ui): 0 new citations.
  • Dogfood battery: not run (no ! in the title, no (narrowing) arm).
  • The CI families (Lint & Repo Gates, Type Check UI, Test UI, Build & E2E UI and the rest of the required set) are this PR's check-runs.

Generated by Claude Code

@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 19, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Final head for review · area ux-2 · 2026-11-19T08:22Z
Head: 047e7f29e9f9afa1b3729ce6e8e4dd1ee1970292. All check runs on it concluded: 39 success, 13 skipped, 0 failed.
Fixes #35306, per condition 2 of ruling 6999004977 · Clause-②: no · Metadata-protocol: none · +260/−80 over 13 files. Not governed (0 of 13).
Showcase measurements: the lookup target sys_user is now read once instead of twice, and the list page sends 25 requests instead of 26. The layer count stays at 6, because the trailing group is the inbox receipt read, which this card does not cover.
HotCRM was NOT MEASURED, because the install was refused in this container. Condition 4 of the ruling already routes the HotCRM re-measure to the cloud lane after the release, and seat 5 confirmed that Fixes stands.
Review route: L1-a thread. The area lands it after L1-a's ACCEPT.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:打开列表页时,如果对象关联了应用包之外的对象(比如“用户”),这个对象的定义只请求一次,不再请求两次;页面会快一点,请求少一个。
  • 为什么做:之前第一次批量请求已经拿到了定义,第二次按名字再要一遍,白白多等约 0.7 秒。
  • 出错会怎样:最坏情况是又请求两次,和修之前一样。停用的应用包和不存在的对象仍能分清楚;预览草稿时照旧逐个读取。
  • 要你做什么:不需要你做任何事,区域审完自己落地。

席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head 047e7f29e9f9afa1b3729ce6e8e4dd1ee1970292 · 2026-11-19T08:25Z

  • 形态 — 13 files, +260/−80. Source changes are in app-shell/src/providers/MetadataProvider.tsx (+43) and one comment in console/appObjectScope.ts; the rest is 10 test files and one changeset. Base c05a8a01, K=10. check-governed-merges.mjs --pr 35398: not governed, under the 3000-line limit. Clause-②: no, Metadata-protocol: none.
  • Fixes vs card console list page: a lookup target object is read twice (presence read, then by name), adding one request layer #35306 (condition 2 of ruling 6999004977) — in readObjectScope, a non-batched scope's unread name is now answered from the presence scope (NAMES_BATCH_SCOPE) only when that read marked the name 'answered', using the item it carried. The name joins the entry as answered, leaves missing, and is not queued by name. Everything else still goes by name, as before:
    • a name the presence read left out, which is what tells OBJECT_PACKAGE_DISABLED apart from plain absence;
    • a name still being asked;
    • a name whose read failed;
    • any name under the draft preview (previewClientRef).
      A batched scope never takes from itself. bump() defers through queueMicrotask, so calling it from a render-time read schedules a re-render and does not set state during render. The second call finds the name answered and does not bump again, so there is no loop. bump is added to the callback's deps.
  • Changeset — app-shell and console patch. Read sentence by sentence against the diff; all of it matches: the double read on the showcase sys_user, one request now, the requiresObject and dashboard widget objects that share the path, the left-out, unanswered and draft-preview cases that are unchanged, and the scope holding the list door's document. The by-name envelope's extras ride the adapter copy, never a scope.
  • Pins — new describe in MetadataProvider.scopeRefusal-13052.test.tsx:
    • a served name joins the route scope with the presence definition and is not asked by name;
    • a left-out name is asked by name, and its OBJECT_PACKAGE_DISABLED refusal is named (flat and wrapped envelopes);
    • CONTROL: a left-out name that the by-name door answers absent is plain absence.
      Ablations red at 16/37 and 2/18.
  • Updated pins (9 existing files) — each removed 'object/sys_user' (or object/note, object/crm_case) by-name read becomes an exact toEqual without it, or a not.toContain. These are stronger and exact, and no refusal or absence assertion was removed. Accepted as the claimed shape change.
  • Live — on the showcase, sys_user is read once and requests drop from 26 to 25. The six-layer depth stays because of sys_notification_receipt, which this card does not cover. HotCRM is NOT MEASURED, because the install was refused; condition 4 of the ruling routes that re-measure to the cloud lane, and seat 5 confirmed Fixes stands.
  • 门禁 — 52 check-runs on this head: 39 success, 13 skipped, 0 failure. This is the PR-side subset: every app-shell test runs (10 UI shards), but the queue's full suite may differ, as fix(plugin-grid): a grid row's Edit or Delete greyed by disabledWhen says why #35371 showed. A queue red is the area's to triage before re-queueing.
  • 接受的偏差 — only the updated pins above.
  • 范围外去向 — the sys_notification_receipt trailing layer is outside this card. If no card covers it, the area files one nested under the ruling's parent.
  • 落地条款 — not governed: ux-2 lands this head after this ACCEPT. A new push needs a fresh L1 only if it changes more than a main merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Landing · area ux-2 · 2026-11-19T08:28Z

reading value
L1-a ACCEPT comment 7003826152 at head 047e7f29e9f9afa1b3729ce6e8e4dd1ee1970292 (= current head)
check-governed-merges --pr 35398 NOT governed, 0 of 13 paths, 340 lines ≤ 3000; K = 11 from merge base c05a8a01. Since then main has changed 5 app-shell files (AI chat page, home page and their tests), none of them in this PR's file list; the queue's full suite is the integration check

State: draft → ready + auto-merge (merge queue). #35306 closes on merge via Fixes; the HotCRM re-measure stays with the cloud lane (condition 4 of ruling 6999004977).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 08:28
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 44487953113 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Test UI (3/16) — 失败步骤: Run the ui tests (shard 3/16)

    × record rows: each row’s object by name, for its icon and its label, never the whole list 85ms
    × an object row reads its object by name; a list-view row its object with its views (the view list, never the object list) 127ms
    FAIL   dom  packages/app-shell/src/console/home/__tests__/HomePage.recentObjectReads-29121.test.tsx > Home’s recent rows read the objects they name, by name (objectstack#29121) > record rows: each row
      ↳ 失败原因: AssertionError: expected [ Array(1) ] to deeply equal [ 'object/crm_account', …(2) ]
    FAIL   dom  packages/app-shell/src/console/home/__tests__/HomePage.recentObjectReads-29121.test.tsx > Home’s recent rows read the objects they name, by name (objectstack#29121) > an object row reads i
      ↳ 失败原因: AssertionError: expected [ …(2) ] to deeply equal [ 'object/crm_account', …(3) ]
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • packages/app-shell/src/console/home/__tests__/HomePage.recentObjectReads-29121.test.tsx — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 2 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Queue red triage · area ux-2 · 2026-11-19T08:46Z
Merge-queue run 44487953113, Test UI 3/16: HomePage.recentObjectReads-29121 fails 2 tests. Each pins the exact list of by-name object reads, and the received list is shorter. That test and the home page changed on main after this branch's base, and this PR serves served names from the presence read, so it is treated as this PR's. The dev merges main, reproduces it, and updates the pin to the new read shape only if the home page still gets every object it needs from the presence answer; otherwise the dev stops and reports. Not re-queued until then.

Main's Home now asks its recent rows' objects in one ?names= presence
read; with the presence-served by-name answer, no /meta/object/NAME read
follows a served name. The two Home pins assert that exact shape.

Claude-Session: https://claude.ai/code/session_01Utp6CZrgaiMgTJCnswR6jQ
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:和上次通过时一样,首页“最近访问”少发几次重复的读取请求,显示的内容不变。
  • 为什么做:主线上另一处改动先合入后,有三条测试还按旧的请求次数在数,这次只更新了测试。
  • 出错会怎样:只影响测试,产品代码和上次通过时逐字相同。撤回即可。
  • 要你做什么:无。

席位核对 — ACCEPT (L1-a, delta) · repo:objectstack#5 · head 7dc7d83c19 · 2026-11-19T10:19Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CZrgaiMgTJCnswR6jQ

Re-landing · area ux-2 · 2026-11-19T10:20Z

reading value
L1-a delta ACCEPT comment 7006269128 at head 7dc7d83c19 (= current head); source delta byte-identical to the head accepted in 7003826152
Queue-red cause main's presence read (#35368) met this PR's batch-served scope; four HomePage pins tightened to exact toEqual, disabled leg keeps not.toContain
CI green at 7dc7d83c19; K = 9

State: ready + auto-merge (merge queue). #35306 closes on merge via Fixes; the HotCRM re-measure stays with the cloud lane (condition 4 of ruling 6999004977).

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 20badae Nov 19, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35306-lookup-target-single-read branch November 19, 2026 10:39
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.

console list page: a lookup target object is read twice (presence read, then by name), adding one request layer

2 participants