Skip to content

fix(app-shell): Home asks for the objects it names instead of loading the whole object registry - #29229

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-uzfopr
Nov 2, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/project-thread-uzfopr

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

Fixes #29121

Clause-②: no
Metadata-protocol: none

Claim: 6572592854 · amendment: 6573209598

维护者速读

  • 改了什么:租户首页不再读整张对象注册表(GET /api/v1/meta/object)和整张视图表;命令面板第一次打开时才挂载,首页的动态、最近访问、面板最近记录都只按名字读自己用到的对象。
  • 为什么改:每次进首页都下载全部对象定义(HotCRM 约 875 KB,app-crm 551 KB),只为一个关着的面板和几行图标、标签;网络慢时首页因此多等。
  • 风险与回滚:读法从「一次整表」变成「按名逐个读」,首页请求数多了(app-crm 上 +9 个小请求,合计 70 KB 对 558 KB);进入应用后整表已加载时一律直接用整表,不再发请求。回滚即 revert 本 PR。
  • 先看:ui/packages/app-shell/src/hooks/useObjectPresence.ts(新的 readObjectsByName)、ui/packages/app-shell/src/console/home/HomeLayout.tsx(面板首开才挂载)、ui/packages/app-shell/src/hooks/useNavMemberGates.ts(首页无应用时的能力门)。
  • 两分钟验证:打开首页,开发者工具 Network 过滤 meta/object:只见 meta/object/<名字>,没有不带名字的 meta/object;按 ⌘K 搜 acme,结果与改前一致。
  • 需要你做的:无,席位落地。

What changes

On main, every visit to /home read the whole object registry and the whole view list. Measured with CDP initiator stacks on a production Console (app-crm), four readers asked for them unconditionally, each hidden behind the one before by the provider's cache, and four more once there is data:

Reader Before Now
HomeLayout: the command palette's objects prop (palette closed) whole list at mount palette mounted from its first open; then the host app's scope over its navigation's objects, views: false
useObjectPresence outside an app (activity feeds' sys_activity check) whole list by name, views: false
useNavMemberGates outside an app (the feeds' cross-app roster capability gate) whole list names-only scope over the app list's requiresObject union, views: false; the package leg asks without views too
HomePage: recent record row icons whole list at render the row's object by name
useNavTargetLabel object label (Home's recent record rows) whole list { byName: true } option: the object by name; a view target reads its object with its views
useRecentItemLabel: recent object / list-view rows whole list the row's object by name (a view row with its views)
ActivityObjectLabel: activity rows (Home rail, bell) whole list the row's object by name
CommandPalette recent record rows (palette open) whole list the row's object by name

readObjectsByName (in useObjectPresence.ts) is the one helper: while nothing has loaded the whole list it asks each name through the names-only scope (objectui#12980); once the list is loaded or loading it reads the list and asks nothing; a hand-rolled context reads its objects; no name asks nothing (a names-only scope with no names would be the whole registry). Every in-app leg is unchanged: inside an app the sidebar, routes and gates read what they read before.

The palette's record search reads only its navigation's objects (useRecordSearch with objectNames), so handing it the host app's scope over those names leaves its results unchanged.

Tests

Request-count tests over the real MetadataProvider and a fake adapter that records each read:

  • console/home/__tests__/homeObjectReads-29121.test.tsx: presence check, roster gate (answers as the whole list did, including an absent required object), activity label, an empty-names read; CONTROL: with the whole list loaded each reader asks nothing.
  • console/home/__tests__/HomeLayout.paletteReads-29121.test.tsx: closed palette not mounted and no read; opened (click or ?palette=1) reads object?package=… plus the outside name; a package-less app reads by name only.
  • console/home/__tests__/HomePage.recentObjectReads-29121.test.tsx: no recent row → no read; record rows read their objects by name (icon and label pinned); an object row by name and a list-view row with its views (view, never object).
  • chrome/CommandPalette.recentReadsByName-29121.test.tsx: the palette's recent rows read their objects by name.
  • Updated pins: HomeLayout.searchOpensPalette-12601 (the palette probe exists from the first open), navGateUnionScope-12980 (its "outside an app reads the whole registry" control now pins the by-name read), openPathObjectReaders-12811 (the census learns readObjectsByName(…) as a spelling and a byName kind; HomeLayout, HomePage, ActivityObjectLabel and useRecentItemLabel reclassified).

Acceptance notes

  • Files beyond the amendment's seven: chrome/CommandPalette.tsx (the palette's recent rows, its object source while open; found on the production re-measure) and the three updated test pins above.
  • Acceptance 1 (no unscoped GET /api/v1/meta/object on home): met on app-crm, see Verification. The home now asks the 8 requiresObject names of the Setup app's navigation by name (the roster gate), plus sys_activity and the objects its recent and activity rows name. That is more requests than one list (19 → 28 on app-crm) and far fewer bytes (558 KB → 70 KB). There is no batch by-names read on /meta/object today.
  • Acceptance 2 (palette object search unchanged): the palette's text for acme is byte-identical between main and this branch on the same server.
  • The card's premise named only the palette. Measuring showed it was the first of four unconditional readers; the claim was amended (6573209598) to the full shape.
  • Not changed: a recent dashboard / page / report row still reads that type's list (useRecentItemLabel), and opening the palette reads /meta/report and /meta/dataset (its report entries). Neither is the object registry.

Verification

Home requests, production Console, app-crm (objectstack dev --fresh), recent records and activity rows present

main 0a41075a: 19 /api/ requests on reload of /home, including GET /api/v1/meta/object (551,461 bytes) and GET /api/v1/meta/view (6,643 bytes); the initiator of both is HomeLayout (get objects).

This branch 5705cea1: 28 requests; no GET /api/v1/meta/object without a name and no /meta/view. By name: sys_business_unit, sys_notification, sys_notification_preference, sys_notification_template, sys_queue, sys_queue_member, sys_record_share, sys_sharing_rule (Setup's requiresObject entries), sys_activity, crm_contact, crm_account (recent and activity rows): 70,164 bytes together. Opening the palette and typing reads object?package=com.example.crm (31,636 bytes), /meta/report, /meta/dataset.

Same page on both: recent rows' text and icons, activity rows' labels, and the activity feed's sys_activity filter (21 object names) are identical.

Ablations (each leg through scripts/ablation-replace.mjs, restored with git diff HEAD empty)
  • A1 palette mounted while closed → HomeLayout.paletteReads "closed" red.
  • A2 presence check keeps the whole list outside an app → homeObjectReads presence red.
  • A3 roster gate keeps the whole list outside an app → homeObjectReads gate red.
  • A4 readObjectsByName returns the whole list → activity label, empty-names, both HomePage row cases red (4).
  • A5 HomePage icon reads metadata.objects → record rows red.
  • A6 useNavTargetLabel ignores byName → both HomePage row cases red.
  • A7 useRecentItemLabel title reads metadata.objects → object/view row case red.
  • A8 palette scope composed with views → both opened cases red.
  • A9 / A10 palette recent icon / label read the whole list → CommandPalette.recentReadsByName red.
Local runs at 5705cea1
  • 91 test files naming the touched modules (CommandPalette, useNavTargetLabel, readObjectsByName, the census): 90 files / 802 tests passed (one name listed twice). Earlier heads: 88 files naming the seven hooks/components (2 expected pins updated, then green) and 151 files naming sharedUserFeeds, InboxPopover, RecentApps, HomeRail, CommandPalette, AppHeader: 620 + 498 tests passed.
  • turbo run type-check --filter=@object-ui/app-shell: 65/65 tasks.
  • eslint --no-inline-config on the changed files: 0 errors.
  • Derived gates (node scripts/pm/dispatch-gates.mjs --commands) at d8b43ffa: 34 derived, 34 run, all exit 0, reconciled with --ran (0 NOT-MEASURED); check:type-check-debt under the verify lock; node scripts/check-sdui-manifest.mjs exit 0 among them. The full app-shell suite is CI's Test UI.

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic.
  • 2. Every name I added uses the casing for its kind.
  • 3. No formatter ran; pnpm lint passes.
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: its generated artifacts are regenerated and committed. (not touched)
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.
  • The Before Submitting list in CONTRIBUTING.md is done.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QsR2jSvXnowXjLpyfdKoux

… palette on first open

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSvXnowXjLpyfdKoux
…t-count tests for each home reader

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSvXnowXjLpyfdKoux
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSvXnowXjLpyfdKoux
…ollow home's by-name reads

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QsR2jSvXnowXjLpyfdKoux
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#1 · zhuangjianguo · session_01QsR2jUJ19MstFvFhjgiYTu

席位核对 · ACCEPT · 2026-11-02T10:10Z

Head-sha: d8b43ffa24745b25b0c8beffe1a9d8eed794ca2a

  • Shape:
    • The PR is a draft against main. The first card line is Fixes #29121, under claim 6572592854 and amendment 6573209598.
    • 16 files, +1011 / −69. The seven amended files are there. chrome/CommandPalette.tsx and its new test are outside that surface; the seat recorded them as amendment 6574361457 before this review. check-governed-merges --pr 29229: 1,080 changed lines, under the human-merge threshold.
    • Clause-②: no and Metadata-protocol: none start their lines in the body and the changeset, as claimed. readObjectsByName and ReadNamesWithoutViews are new exports of the private hooks/useObjectPresence.ts, not of the package entry. No string is new. The changeset is patch.
  • Read in the diff:
    • readObjectsByName asks each name through the names-only readObjectScope with views: false while the object type is idle. Once the whole list is loaded, or on its way, it answers that list. An empty name list asks nothing, so it never falls through to the whole registry.
    • Home's palette mounts on its first open (HomeCommandPalette), then stays mounted. Opened, it gets the host app's scope over its navigation's objects, which are the ones record search reads.
    • useObjectPresence and the nav gate outside an app ask by name. Inside an app they are unchanged.
    • Recent rows in Home and the palette, and the activity rows, label their object by name.
  • Pins changed (read one by one): all three pinned the old whole-list read that this card removes, and none weakens a user-facing assertion.
    • openPathObjectReaders-12811 gains a byName kind and still fails on any unclassified reader.
    • navGateUnionScope-12980's outside-an-app case now pins the union by name, no object list and no view list.
    • searchOpensPalette-12601 still pins that the search field opens the palette and the host app choice. A closed palette is no longer mounted, and the host-app cases open with ?palette=1.
  • Gates (check-runs on this head): 44 success, 11 skipped, 0 failed or pending. mergeable_state is clean.
  • Tests (dev): ten ablations (A1 to A10) all red; restored. app-shell type-check 65 of 65. Derived gates 34 of 34, sdui manifest included. Production Console, app-crm: main sends 19 requests including meta/object (551 KB) and meta/view. The branch sends 28 requests with no unscoped object or view list, and its 11 by-name reads total 70 KB. Palette text for "acme" is byte-identical.
  • NOT MEASURED: the seat ran no live session.
  • Findings: Console: unlabeled sidebar object entries and Home recents still read whole metadata lists #29235 (unlabeled sidebar object entries and Home's dashboard, page and report recents still read whole lists) and Metadata API: no batch by-names read, so the Console roster gate costs one /meta/object request per name #29236 (no batch by-names read on /meta/object, so the roster gate costs one request per name, 8 on app-crm).
  • Serial: HomePage.tsx is also in Console home at phone width: the launcher's links and buttons are 16–32 px tall, below the 44 px touch target #29147's build (seat 2). Whichever lands second merges main.
  • Landing: ordinary queue landing, pr_ready then automerge_enable. Fixes #29121 closes the card on merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 2, 2026 10:11
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 2, 2026 10:11
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 2, 2026
Merged via the queue into main with commit 9f120af Nov 2, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-uzfopr branch November 2, 2026 10:58
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/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

1 participant