Skip to content

fix(console): the Studio object-reference picker offers objects by label, not machine name - #33533

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-428ijq
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-428ijq

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

domain:ui#2 · os-project-manager · session_01FEkQ5pknWTXgjDm8g4ayZD

Fixes #33104

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:Studio「全部元数据」表单里选对象的下拉框(例如 新建页面 → Object)现在每一项先显示对象的标签(如「R5 Label Item」),后面跟一个小号等宽灰字的机器名(r5lbl_item),和流程触发器、Lookup 关联对象选择器的样子一致;没有标签的对象只显示一次名字。
  • 为什么改:原来下拉里是 127 个裸机器名,作者要靠猜名字找对象,违反「标签优先于机器名」的界面约定。
  • 风险与回滚:只改显示;保存的值仍然是机器名。标签取自页面本来就发的那一次对象列表请求,没有新增请求。回滚即还原本 PR。
  • 先看:widgets.tsx 的 RefObjectWidget 选项渲染;ResourceEditPage.tsx 的 objectsState 加载器与 widgetContext 里新增的 objectLabels 一行;新测试 RefObjectWidget.labels-33104.test.tsx。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/metadata-admin/RefObjectWidget.labels-33104.test.tsx,预期 3 条全绿。
  • 需要你做的:无,席位落地。

What changes

  • The page keeps each label from its one object-list read. MetadataResourceEditPage's objectsState loader already read client.list('object') but mapped each entry to its name and dropped the label. It now keeps { name, label? } (a label is kept only when it is a non-blank string), sorted by name exactly as before. The widget context derives both members from that one state: objectNames through mapLoaded (unchanged shape, so object-selector and every other reader see what they saw), and a new objectLabels (ReadonlyMap name → label) while the list is loaded. No second list request.
  • RefObjectWidget draws the label first. WidgetContext gains objectLabels, an optional read-only Map from object name to label (app-shell is private; the type is not published). Each option of the ref:object select shows the label, then the machine name as secondary text in the classes the Studio ObjectPicker uses for its option name (font-mono text-[11px] text-muted-foreground), with an explicit space so the accessible name is two words. It stays on one line because Radix renders the selected item's text into the one-line trigger too. An object with no label is drawn as its name, once. The SelectItem value is the name, so the value written is unchanged.
  • Changeset .changeset/33104-ref-object-picker-labels.md: @object-ui/console patch (app-shell is private and ships inside the console build).

Tests

ui/packages/app-shell/src/views/metadata-admin/RefObjectWidget.labels-33104.test.tsx (new), driven through the opened Radix select (ArrowDown on the trigger, as the sibling suites do):

  1. SchemaForm with the page type's real createSchema (Page → Object): the labelled object's option shows "R5 Label Item" first and r5lbl_item in the monospace muted name line; clicking it emits object: 'r5lbl_item' (the value written is the name).
  2. CONTROL: a label-less object (showcase_note) is offered by its name only, with no name line, so the name is not shown twice.
  3. MetadataResourceEditPage in Page create mode, with client.list('object') answering one labelled and one label-less entry: the picker shows the label the list answered, and list('object') was called exactly once.

Measured on main first (sources widgets.tsx and ResourceEditPage.tsx restored to f068cde8, test file as committed):

Base: 2 failed | 1 passed (3), the option text is the bare name
× a labelled object: label primary, name secondary; choosing it writes the NAME
× the picker shows the label the list answered, and the list is read once
Expected element to have text content:
  R5 Label Item
Received:
  r5lbl_item
Test Files  1 failed (1) · Tests  2 failed | 1 passed (3) · VERDICT command-exit 1

The control (label-less object, name once) passes on base, as a control should. The base option in RefObjectWidget is a SelectItem whose value and whose text are both the bare name n, fed by the loader's list.map((x) => x?.name).

Ablation of the label rendering only (scripts/ablation-replace.mjs on widgets.tsx, anchor const label = context?.objectLabels?.get(n); replaced by a branch that always yields undefined with marker ABL33104; anchor 1 → 0, replacement 0 → 1, blob 14bfddb9e5ec → bbcc0295e5bc, run at 77376716, before the one doc-comment commit; ui vitest resolves @object-ui/* to src/, no dist in the path):

Ablated: 2 failed | 1 passed (3); restored: blob == HEAD, 3 passed
× a labelled object: label primary, name secondary; choosing it writes the NAME
× the picker shows the label the list answered, and the list is read once
Expected element to have text content: R5 Label Item · Received: r5lbl_item
Test Files  1 failed (1) · Tests  2 failed | 1 passed (3) · VERDICT command-exit 1
ablation-replace: ok restored: blob == HEAD (14bfddb9e5ec) and `git diff HEAD` is empty

Acceptance notes

  • Typeahead. The select has no search box. Its keyboard typeahead is Radix Select's, which matches the typed prefix against one text per option (item.textValue.toLowerCase().startsWith(...) in @radix-ui/react-select), and that text now starts with the label. So typing a label's first letters jumps to the object, and typing a machine-name prefix reaches a labelled object only when its label starts the same way. Matching both label and name would need a searchable control instead of the Radix select; this PR does not swap the control. Declared, not pinned.
  • object-selector (ObjectSelectorWidget, same file) still lists bare names. It reads the same objectNames and could read objectLabels the same way, but no form spec in this repository mounts widget: 'object-selector' (only its registry rows), so there is no measured reach. Noted, not filed.
  • eslint --no-inline-config on ResourceEditPage.tsx reports 3 react-hooks "Cannot create components during render" errors; the same 3 are on base f068cde8 (line-shifted), none in the lines this PR touches.

Verification

Head 7409ee45. Local, in a fresh worktree after building the engine closures (@objectstack/spec|formula|client|lint|sdui-parser...) and @object-ui/app-shell^...:

  • pnpm --filter @object-ui/app-shell run type-check (src + tsconfig.test.json): exit 0.
  • pnpm --dir ui exec vitest run --maxWorkers=2 on the 110 metadata-admin test files named SchemaForm*, ResourceEditPage*, WidgetContext*, *Widget*, selector-placeholder*, anchors* (the readers of widgets.tsx's context and of the edit page): 110 files / 823 tests passed (run at 113a93ac; the later commits touch only the new test's imports and one doc comment in widgets.tsx).
  • The derived gate list (node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack, 37 families) run on head 7409ee45: all 37 exit 0, and --ran reconciles "37 derived, 37 run, 0 NOT-MEASURED, 0 UNRUN". check:type-check-debt ran alone under the verify lock (VERDICT command-exit 0).
Derived gate families, exit codes
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-sdui-manifest.mjs :: exit 0
node scripts/check-sdui-manifest.mjs --self-test :: exit 0
node scripts/ci/snapshot-next.mjs --self-test :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --dir ui exec vitest run scripts/ :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm --filter @objectstack/spec run check:error-code-provenance :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:dispatcher-error-vocabulary :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:skill-identifier-liveness :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
  • check:test-source-alias was red on the first round for the new test (it reaches lazy import('@objectstack/lint') and import('@object-ui/plugin-detail') during collection); fixed with module-top side-effect imports, the convention the sibling ResourceEditPage.* suites use.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FEkQ5pknWTXgjDm8g4ayZD

…hine names

The All-metadata form's ref:object select (e.g. Page -> Object) listed bare
object names. The page's one object-list read now keeps each entry's label,
handed to the widget as WidgetContext.objectLabels, and the option draws the
label with the name as secondary monospace text, the face ObjectPicker draws.
A label-less object shows its name once; the value written stays the name.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5pknWTXgjDm8g4ayZD
…ion in the ref:object pin

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5pknWTXgjDm8g4ayZD
@github-actions github-actions Bot added 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 14, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#2 · os-project-manager · session_01FEkQ5oF8GgTHN2jBZoDwz8

席位核对

Verdict: ACCEPT · head 7409ee45 · 2026-11-15T00:11Z

  1. Shape. Draft → main, Fixes #33104. 4 files, +252/−9:

    • ui/packages/app-shell/src/views/metadata-admin/widgets.tsx (RefObjectWidget options; a new optional WidgetContext.objectLabels)
    • ui/packages/app-shell/src/views/metadata-admin/ResourceEditPage.tsx (only the objectsState loader and the context memo line)
    • a new rendered test, RefObjectWidget.labels-33104.test.tsx
    • one root changeset (@object-ui/console patch)

    All of it is on the claimed surface, as amended (6885585876).

  2. Premise. Re-measured by the dev on f068cde8: the All-metadata form's object-reference option text was the bare name (pin red on base).

    • The fix: the page's one client.list('object') read now keeps each object's label beside its name; objectNames keeps its shape and a name → label map rides the widget context from the same state. Each option shows the label first and the name after it in the secondary monospace face the Studio object picker draws; a label-less object shows its name once; the value written stays the name.
    • Pins: labelled object → label + name line, click writes the name; CONTROL label-less → name only; the edit page reads the object list exactly once. Base: 2 red, 1 green. Ablation of the label read: 2 red.
  3. Declarations. Clause-②: no, Metadata-protocol: none, patch. Right: WidgetContext and both files live in the private @object-ui/app-shell. No contract record owed.

  4. Gates on head 7409ee45. All 51 check runs are success or skipped. The dev's local --ran is 37/37, 0 NOT-MEASURED.

  5. Accepted deviation. The order asked keyboard typeahead to match the label and the name. The control is a Radix select whose typeahead is a prefix match on one text, which now starts with the label; matching both needs a searchable control. Recorded in Acceptance notes; no card (no measured demand).

  6. Out of scope, not filed. ObjectSelectorWidget keeps bare names, but no form in the repo mounts it (filing gate: no reach). Three react-hooks lint errors in ResourceEditPage.tsx are on base unchanged, outside the touched lines, and CI's lint is green.

  7. Same-file note. console cosmetic and UX observations from the v18.4.0 sweep (6 rows) #33346 (this seat) edits a different block of ResourceEditPage.tsx (the top error box); whichever lands second takes a base sync.

  8. K. 4 first-parent commits since base f068cde8 < 15: no base sync. Path face: not governed; 261 changed lines.

  9. Authority. Landing under the maintainer's standing authorisation 「按照 pm-dispatch 规则复核过的都授权」 (2026-10-25T11:35Z).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 15, 2026 00:12
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 15, 2026
Merged via the queue into main with commit 70fa329 Nov 15, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-428ijq branch November 15, 2026 03: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/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.

Studio All-metadata form: the object-reference picker (for example Page → Object) lists bare machine names instead of labels

1 participant