Skip to content

fix(app-shell): a draft-only object's new or first-edited list view starts from its first five fields - #30507

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-9n7hb1
Nov 5, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-9n7hb1

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

domain:ui#5 · os-sales · session_01L6bhgXNFpXQRAPXfpTaqkV

Requested by Sales · project thread

Fixes #30317

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:Studio 界面里,一个还只是草稿的对象,第一次编辑它的默认列表视图、或用「新建视图」不选列时,视图现在从对象的前五个字段起步,和已发布对象一样;之前起步是零列。
  • 为什么改:面板只从外壳的合并元数据里找对象定义来生成默认列,草稿对象不在其中,于是默认列为空:第一次编辑只写进作者刚加的那一列,新建视图一列都没有。
  • 风险与回滚:只改 useObjectListViewDraft 的默认列这一段。合并元数据里找不到对象时,多读一次本包的草稿对象定义(GET /meta/object/:name?preview=draft&package=,字段选择器已在读同一个地址);已发布对象不多发请求;读失败或读不到时仍是空,和以前一样。回滚即还原本 PR。
  • 先看:ui/packages/app-shell/src/views/studio-design/ObjectListViewInspector.tsx 里 seedColumns 上方新增的 draftedDef 一段。
  • 两分钟验证:pnpm --dir ui exec vitest run packages/app-shell/src/views/studio-design/ObjectListViewInspector.draftObjectSeed-30317.test.tsx,预期 4 个用例全绿;在 main 上同一文件 3 个失败。
  • 需要你做的:无,席位落地。

What changes

In Studio › Interfaces, useObjectListViewDraft seeds the columns of a list view created in the panel (the first edit of a view that does not exist yet, and New view with no columns picked) with defaultListColumnsFromObject(objectDef, 5). objectDef came only from the shell's merged metadata.objects, which holds published objects, so on a draft-only object the seed was [].

Changeset: .changeset/30317-draft-only-object-view-seed.md, @object-ui/app-shell patch.

Branch: the harness-assigned claude/project-thread-9n7hb1, not claude/issue-30317-*; the card is #30317.

Tests

New file ObjectListViewInspector.draftObjectSeed-30317.test.tsx: the real hook over a real MetadataClient, whose transport is an in-memory server that serves GET /meta/object/:name?preview=draft in its envelope and 404 otherwise, and records the PUTs.

  • draft-only acmetrial_deal (absent from the merged metadata, a hidden field first): seedColumns is its first five visible fields, the canvas shows them, and the first edit (made as the panel makes it, adding notes) PUTs view/acmetrial_deal.default with those five plus notes;
  • New view (createView with a grid payload and no columns) PUTs view/acmetrial_deal.open_deals with the same five;
  • CONTROL: a published object seeds from the merged definition and no GET /meta/object/... is sent for it;
  • CONTROL: an object neither drafted nor published: one 404 read, seed [], no failure, the buffer still loads.

On origin/main (989ae42d) the file reads 3 failed, 1 passed (the seed is []; the 404 control fails because no read is sent). With the fix, 4 passed. Since the pre-fix run is the same file over the unpatched hook, no separate ablation was run.

Test runs and gates
  • At 0be094aa (fix, before merging main): every app-shell test file importing ObjectListViewInspector or StudioDesignSurface, 241 files, --maxWorkers=2, under the verify lock: Test Files 241 passed (241), Tests 1751 passed (1751), VERDICT command-exit 0. eslint on the two touched files: 0 errors (22 warnings, all on lines this PR does not touch).
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack at 0be094aa (3 paths): 35 commands, run serially, every one exit 0, including pnpm --dir ui exec vitest run scripts/ (Test Files 170 passed | 2 skipped (172), Tests 4985 passed | 2 skipped). --ran with the recorded exit codes: 35 derived, 35 run, 0 NOT-MEASURED (a derived zero). Also run: pnpm --filter @object-ui/app-shell run type-check, pnpm --dir ui run check:spec-symbols, pnpm check:changeset-fixed, each exit 0.
  • At af914a2d (after merging main a1d0b1ee, which carries PR feat(app-shell): configure a list view's selection-bar actions in Studio (#30089) #30339's edit of this file; no conflict; app-shell closure rebuilt): pnpm --filter @object-ui/app-shell run type-check, every test file under packages/app-shell/src/views/studio-design/ (Test Files 330 passed (330), Tests 2473 passed (2473)) and pnpm --dir ui run check:spec-symbols, one chained run, VERDICT command-exit 0.

Not run locally: the full ui suite (CI's Test UI shards run it).

Verification

Dev boot of examples/app-showcase (objectstack dev --seed-admin --fresh) after the @object-ui/app-shell and showcase build closure, console Vite pointed at it, Playwright Chromium at 1440×900, signed in as the dev admin. Seeded over REST: writable package com.example.acme-trial (POST /api/v1/packages), then with ?mode=draft the object acmetrial_deal (fields name, amount, stage, close_date, probability, notes) and the app acmetrial_app, whose one nav entry is the object. Opened the entry in Studio › Interfaces. Before = origin/main's hook; after = this branch's, served by Vite HMR; the view drafts were discarded (DELETE …?state=draft) between the two.

Before After
Panel on opening the entry "Columns 0 · No columns yet" Columns 5: Deal name, Amount, Stage, Close date, Probability
First edit (Add field → Notes) PUTs view/acmetrial_deal.default with columns [{ field: notes }] [name, amount, stage, close_date, probability, notes]
New view (Grid, "Open deals", no columns picked) PUTs view/acmetrial_deal.open_deals with columns [] [name, amount, stage, close_date, probability]

Shots (1440 wide) and the recorded PUT bodies are in the project's issue-30317/ folder (before-1-opened-1440.png, before-2-first-edit-1440.png, before-3-new-view-1440.png, the three after-* shots, puts.json); this repository has no place to commit them, per ui/AGENTS.md Housekeeping.

Acceptance notes

  • The drafted read is asynchronous and is sent when the leaf opens, beside the view-drafts read that already gates a default entry. An edit made before it answers would still start from no columns; on the dev boot it answered before the panel finished loading.
  • The before leg's first edit wrote the column as { field, label } and the after leg's as a bare name: the column editor keeps the shape of the list it is handed, and the seed is bare names, as it is for a published object today. Not changed here.

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgXNFpXQRAPXfpTaqkV

…ts from its first five fields (#30317)

useObjectListViewDraft seeded a view's columns from the shell's merged
objects, which hold published objects only, so on a draft-only object the
first edit of a not-yet-created view and New view started from no columns.
When the merged definition is missing, the hook now reads the package's
drafted definition with the drafts overlaid and seeds from it.

Claude-Session: https://claude.ai/code/session_01L6bhgXNFpXQRAPXfpTaqkV
Co-authored-by: Claude <noreply@anthropic.com>
… in the same file)

Claude-Session: https://claude.ai/code/session_01L6bhgXNFpXQRAPXfpTaqkV
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 5, 2026
@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 5, 2026 13:58
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 5, 2026 13:58
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 5, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:ui#5 · os-sales · session_01L6bhgVwQZbHRRM9CaXeKif

维护者速读

  • 改了什么: Studio 里一个还只是草稿的对象,第一次编辑它的默认列表视图、或者用「新建视图」不选列时,视图从对象的前五个字段起步,和已发布对象一样。之前起步是零列。
  • 为什么改: Studio Interfaces: on a draft-only object, a new or first-edited list view starts with zero columns #30317。面板只从外壳的合并元数据里找对象定义,草稿对象不在里面,所以默认列为空。
  • 风险与回滚: 只改 useObjectListViewDraft 的默认列一段。合并元数据里找不到对象时,多读一次本包的草稿对象定义(字段选择器已经在读同一个地址)。已发布对象不多发请求。读失败或读不到时仍是空列,和以前一样。回滚就是撤销本 PR。
  • 需要您做的: 无。本 PR 不在受管面,共 254 行。席位会经合并队列落地。
  • 席位意见: ACCEPT。

席位核对 — ACCEPT · domain:ui#5 · head af914a2dc71e412afd6f46c6e916bcf73ff4f0a8

  • 形态: draft,作者 objectstack-fleet[bot](中继 pr_create),目标 main,Fixes #30317。共 3 个文件,+252 −2。check-governed-merges --pr 30507:NOT governed;254 行,未超 3000。mergeable_state 读为 clean。
  • 契约面: 不碰 packages/spec/**,不碰 governed 路径。Clause-②: no:没有新导出、新键或新类型,只改 hook 内部。Metadata-protocol: none 与 diff 一致。不欠合同复核。
  • 抽查:
    • effect 只在 objectName 存在且合并定义缺失时运行,所以已发布对象不发新请求。依赖里有 publishNonce,发布后会重读。
    • 答复按 JSON.stringify([packageId, objectName]) 记键,并且只在等于 viewDraftsKey(同一个拼法,ObjectListViewInspector.tsx:518)时才用,换对象时不会拿上一个对象的定义起步。
    • 有取消标记,卸载或换键后迟到的答复不会写入。读失败和非 plain object 的答复都落到 null,种子仍是 [],不会变成面板的错误。
    • 读的是 client.withPreviewDrafts(true).get('object', name, { packageId }),和 useObjectFields 同一个地址。
  • 门禁 check-runs: af914a2d 上 55 个 run:44 success,11 skipped,0 失败。
  • 测试: 新测试文件用真 hook 和真 MetadataClient,传输层是内存服务器。两条正向用例(首次编辑写入五列加 notes、新建视图写入五列),两条对照(已发布对象不发读、两边都没有的对象读到 404 后种子为空且不报错)。卡线程报告:在 main 上同一文件 3 个失败 1 个通过,修复后 4 个通过;派生门禁 35/35 exit 0;合并 main(带 PR feat(app-shell): configure a list view's selection-bar actions in Studio (#30089) #30339 对同一文件的改动)后重跑 studio-design 下 330 个测试文件全绿。dev 启动实测的前后对比表写在 PR 正文里。
  • 接受的偏差: 草稿定义的读取是异步的,答复之前做的编辑仍从零列起步。实测时答复先于面板加载完成。PR 的 Acceptance notes 已写明。
  • 范围外去向: 无。
  • 落地条款: Fixes #30317。本席位按普通队列在这个 head 上落地:relay pr_ready + automerge_enable。MERGED 后核对 Studio Interfaces: on a draft-only object, a new or first-edited list view starts with zero columns #30317 已关闭、pm:dispatched 已摘。

Merged via the queue into main with commit 70c3b1c Nov 5, 2026
56 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-9n7hb1 branch November 5, 2026 15:17
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 Interfaces: on a draft-only object, a new or first-edited list view starts with zero columns

1 participant