Skip to content

feat(console): create a dashboard from the design mode's Add menu item - #36606

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/project-thread-un7cwb
Nov 23, 2026
Merged

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

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread
Part of #36364
Clause-②: yes (widening) — new @object-ui/i18n keys (designMode.menu.* for the new picker row and name step, dashboard.noCards.*), in all 11 locales; no spec, schema or public export change
Metadata-protocol: none

repo:objectstack#2 · os-steve · session_01ADHkmPiTdmLxHXBjakSvJy

维护者速读

  • 用户能看到什么变化:管理员在设计模式里「添加菜单项 → 仪表盘」,第一行是「新建仪表盘…」,填名称确定后,新仪表盘出现在占好的菜单位置,其他改动一起保存,然后直接进入它的编辑状态;没有卡片的仪表盘会显示「还没有卡片」。
  • 为什么做:设计模式专题的第三张卡,让管理员不用进 Studio 就能在应用里新建仪表盘并挂到菜单上。
  • 出错会怎样:菜单保存失败时,刚建的仪表盘会被删掉,设计模式保持打开并说明原因;中途取消什么都不写;可以直接撤回本次合并。
  • 要你做什么:不用做什么。新建报表这一半席位已定(报表必须先选数据集和指标,改为从报表搭建页新建),等 报表搭建页:右边五项(报表类型、数据来源、指标、分组、图表),选完数据来源立刻出图,缺什么就在图的位置提示 #36374 合并后另做。

What changes

Branch name: this card thread's container pushes only to claude/project-thread-un7cwb, so the claude/issue-36364-* spelling the Duplicate Fix Guard looks for is not available; the card is #36364 (claim comment 7088329990).

Overlap: touches DashboardView.tsx, which draft PR #36461 also touches; overlap-check reads both merging cleanly. This PR lands after #36461 per the claim.

Tests

Unit and component tests (head 313b6bf)

Run from the repo root under os-verify-lock; vitest root ui/.

Ablations (one-shot, not kept)
  • Removal of the created dashboard on a refused menu deleted (ablation-replace, anchor 1 to 0, restored blob equals HEAD): 3 tests red (a refused menu removes the dashboard it was made for…, …cannot be removed says the dashboard was left, a refused menu removes the new dashboard; the mode, the held place and the other staged edits stay).
  • The dashboard created before the menu-save checks: 8 of 13 red in designModeMenuCreate-36364.test.ts, every "nothing is created" case among them. A first attempt of this leg was refused by the tool (the replacement contained its own anchor) and ran no tests; the second attempt is the reading above.

Acceptance notes

  • The card's first acceptance line names the group 「数据洞察」; the CRM example's group is 「数据分析」, used for the screenshots.
  • 「Members see an empty state」 was checked as the admin in view mode; the empty-state branch has no role gate. A non-admin session was NOT MEASURED.
  • Test pins went into the existing harness files for the design mode, the menu editor and the dashboard in-page edit (AGENTS.md: a new pin for a component with a shared harness goes into that file), plus one new file for the new module, designModeMenuCreate-36364.test.ts.

Verification

Screenshots (live CRM example on a --fresh backend, console dev server, zh-CN, deviceScaleFactor 2) are stored with the seat (objectstack-seat2/36364-shots/): design mode; picker 「仪表盘」 with 「新建仪表盘…」 first; the name step; the new 「回款分析」 in its edit state, in the held place under 数据分析; Cancel leaving nothing; the new dashboard in view mode (「还没有卡片」); Studio 「界面」 listing the same 回款分析 in the app's navigation. After the run: the dashboard is the only item of com.example.crm.custom, the app's stored menu holds nav_item_1: hui_kuan_fenxi under group_analytics, no draft is pending, and the cancelled name has no item (404).

Read first: ui/packages/app-shell/src/layout/designModeMenuCreate.ts (the order and the removal), designMode.tsx (saveWith's drop rule after a commit), DashboardView.tsx (the landing effect).

Two-minute check: pnpm --dir ui exec vitest run packages/app-shell/src/layout/__tests__/designModeMenuCreate-36364.test.ts shows 14 passing.

Derived gates (head ab2257f)
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack derived 41 commands from the tree at commit ab2257f. Each was run with stdin from /dev/null, and its exit code was captured before any pipe. The two heavy commands ran under os-verify-lock: pnpm --dir ui exec vitest run scripts/ and pnpm check:type-check-debt.
  • All 41 exited 0. The reconciliation with --ran reads: Run reconciliation — 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN.
  • The record is stored with the seat (objectstack-seat2/36364-gates-ran.txt).
  • Before the PR was opened, overlap-check gave VERDICT clean exit 0 against origin/main and the open PR heads.
  • At 313b6bf8, dispatch-gates --commands derives the same 41 commands as at ab2257f4. The merge brought no new gate family for the touched paths, so the run above was not repeated. At push, overlap-check against origin/main is clean; it conflicts with open PR feat: an object's action layout per scope, pinned and more, set from the design mode (#36366) #36629 on the serial de quote-count pin, and whichever lands second rebumps it.
  • CI families (lint farm, Test shards, Test Core) are left to this PR's check-runs; none was rerun locally.

Generated by Claude Code

🤖 Generated with Claude Code

The picker's Dashboards list starts with New dashboard...: a name, then the
dashboard is created empty in the package the menu is saved to, its entry
takes the held place, every staged change is saved with it, and the new
dashboard opens in its edit state. A refused menu save removes the dashboard
again; cancel writes nothing.

Claude-Session: https://claude.ai/code/session_01ADHkmPiTdmLxHXBjakSvJy
Co-authored-by: Claude <noreply@anthropic.com>
…e and its landing

Claude-Session: https://claude.ai/code/session_01ADHkmPiTdmLxHXBjakSvJy
Co-authored-by: Claude <noreply@anthropic.com>
…-un7cwb

# Conflicts:
#	ui/packages/i18n/src/__tests__/de-quote-pairing-3876.test.ts
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmPiTdmLxHXBjakSvJy

Contract-review-claim: session_01ADHkmPiTdmLxHXBjakSvJy · head ab2257f · 2026-11-23T02:57Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmPiTdmLxHXBjakSvJy

Contract review

Served-tier: TIER_DEFAULT
Head-sha: ab2257f4bac06f86d5a7f03e56548302e75ab42d
Local-runs: none

Face: declaration only (Clause-②: yes (widening) on the PR body and the changeset). Read against the diff origin/main...ab2257f4: no packages/spec/** path, no governed path, no (narrowing) arm, so no schema, rules or narrowing face.

① Derived judgments

  • The widening is exactly the new @object-ui/i18n language-pack keys, published through TranslationKeys = typeof en: designMode.menu.newDashboard, newDashboardTitle, newItemSavesAll, create, creating, newItemPendingDraft, newItemLeft, and dashboard.noCards.title / dashboard.noCards.message, in all 11 locales (ar de en es fr ja ko pt-BR ru zh-Hans zh-Hant), each locale file +11.
  • No other public surface moves: ui/packages/app-shell/src/index.ts and package.json are untouched, the new modules (designModeMenuCreate.ts, designModeArrival.ts) are internal to layout/, and prepareAppMenuSave / writeAppMenu / saveWith are reached only inside the package.
  • Metadata-protocol: none holds: the dashboard is created through the existing /meta confirmed-save door with the existing DashboardSchema shape ({ name, label, widgets: [] }); nothing a metadata author can write changes.

② Semver level

patch for @object-ui/app-shell and @object-ui/i18n — AGENTS.md Post-Task Checklist step 3: kind none takes patch; the changeset says patch for both and carries both declaration lines.

③ Boundary flags

Implemented-by: claude/project-thread-un7cwb
Reviewed-by: session_01ADHkmPiTdmLxHXBjakSvJy

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmPiTdmLxHXBjakSvJy

席位核对

ACCEPT — PR #36606 at head ab2257f4bac06f86d5a7f03e56548302e75ab42d · card #36364 (dashboard half) · L1 read by this card thread at 2026-11-23T02:58Z · contract record 7090361692 (TIER_DEFAULT, declaration face, PASS, same head)

…-un7cwb

# Conflicts:
#	ui/packages/app-shell/src/layout/__tests__/DesignModeMenu-36363.test.tsx
…der rule

A new dashboard's entry, held between two entries of a level that carries
`order`, is saved numbered in that place, with every entry of the level
renumbered in its shown place (objectstack#36591's rule, now applied by
prepareAppMenuSave to the create-and-save path as well).

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

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmPiTdmLxHXBjakSvJy

Contract-review-claim: session_01ADHkmPiTdmLxHXBjakSvJy · head 313b6bf · 2026-11-23T07:46Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmPiTdmLxHXBjakSvJy

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 313b6bf896dd4092754d63edd2c732300f3ac315
Local-runs: none

Face: declaration only (Clause-②: yes (widening) on the PR body and the changeset). Delta read at the new head after merging origin/main (#36604, #36622, #36461; merge 577b034 + test 313b6bf) — the language-pack additions and the changeset are byte-identical to ab2257f (record 7090361692); read against the PR diff at this head: no packages/spec/** path, no governed path, no (narrowing) arm, so no schema, rules or narrowing face.

① Derived judgments

  • The widening is exactly the new @object-ui/i18n language-pack keys, published through TranslationKeys = typeof en: designMode.menu.newDashboard, newDashboardTitle, newItemSavesAll, create, creating, newItemPendingDraft, newItemLeft, and dashboard.noCards.title / dashboard.noCards.message, in all 11 locales (ar de en es fr ja ko pt-BR ru zh-Hans zh-Hant), each locale file +11.
  • No other public surface moves: ui/packages/app-shell/src/index.ts and package.json are untouched, the new modules (designModeMenuCreate.ts, designModeArrival.ts) are internal to layout/, and prepareAppMenuSave / writeAppMenu / saveWith are reached only inside the package.
  • Metadata-protocol: none holds: the dashboard is created through the existing /meta confirmed-save door with the existing DashboardSchema shape ({ name, label, widgets: [] }); nothing a metadata author can write changes.

② Semver level

patch for @object-ui/app-shell and @object-ui/i18n — AGENTS.md Post-Task Checklist step 3: kind none takes patch; the changeset says patch for both and carries both declaration lines.

③ Boundary flags

Implemented-by: claude/project-thread-un7cwb
Reviewed-by: session_01ADHkmPiTdmLxHXBjakSvJy

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmPiTdmLxHXBjakSvJy

席位核对

ACCEPT — delta · PR #36606 at head 313b6bf896dd4092754d63edd2c732300f3ac315 · card #36364 (dashboard half) · L1 delta read by this card thread at 2026-11-23T07:47Z over the first ACCEPT 7090370179 (head ab2257f) · contract record 7094697499 (TIER_DEFAULT, declaration face, PASS, same head)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY

维护者速读

席位核对

ACCEPT → PR #36606 comment 7094709368 (delta) · TIER_DEFAULT contract review PASS → comment 7094697499 · Head-sha 313b6bf896dd4092754d63edd2c732300f3ac315 · check-runs 47 success, 15 skipped, 0 failed · mergeable clean · check-governed-merges --pr 36606: not governed (0 of 23 paths), 1116 changed lines ≤ 3000. Part of #36364. Predecessors #36604, #36622, #36461 are merged.

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

Copy link
Copy Markdown
Contributor

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

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

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

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

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

    × refuses a rule guard that does not parse 5027ms
    FAIL   dom  packages/app-shell/src/views/studio-design/DataPillar.panelGate.test.tsx > DataPillar — Save is gated on the validations panel’s CEL verdict (#4527/#36511) > refuses a rule guard that does
      ↳ 失败原因: (这条 FAIL 之后 12 行内没有可识别的原因行 —— 点进 job 看)
    

↳ 失败原因 是判读的关键:超时(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/views/studio-design/DataPillar.panelGate.test.tsx — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

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

分诊清单:

  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#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY

Re-queue after triage of the queue red (run 45133910959, job 137556364792). The one failure is DataPillar.panelGate.test.tsx "refuses a rule guard that does not parse" (timeout, no studio-save). It is in Studio, which this PR does not touch, and it is filed as #36648.

Head 313b6bf896dd4092754d63edd2c732300f3ac315 is unchanged since the seat record 7094735044. That record still applies: ACCEPT 7094709368, contract review PASS 7094697499. This is the one re-queue. If the queue goes red again, that counts as real and the seat triages it before any further move.

@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit dad9b55 Nov 23, 2026
63 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-un7cwb branch November 23, 2026 08:31
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
… page header drops Edit app and Open in Studio (objectstack-ai#36485) (objectstack-ai#36621)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi92ncfFpPUpTD8314otX5oaG)_

Fixes objectstack-ai#36485
Clause-②: no
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:系统管理员在任何应用里点左上角应用名,应用列表下面、和「添加应用」同一组多了「编辑应用」,点了直接进入设计模式;页头右上角不再有「编辑应用」和「在
Studio 中查看 某应用」两个按钮,只剩 AI
助手和帮助。自建应用和安装来的应用一样;侧栏收起时从左边缘滑出的菜单里也能点到;普通成员看不到,手机上没有入口。
- 为什么做:运行界面设计模式专题的一张子卡,按你「立卡」的那条建议,把设计入口集中到应用名菜单,页头只留每页自己的按钮。
- 出错会怎样:最坏是管理员在页头找不到「编辑应用」,要去应用名菜单里点;设计模式本身和保存都没改,撤回本 PR 即恢复原来的按钮。
- 要你做什么:无。

## What changes

- **App-name menu** (`SidebarAppMenu`): a new 「Edit app」 item
(`sidebar-app-menu-edit-app`, the `topbar.editApp` key every locale
already carries, no new i18n key) under the app list, in one group with
「Add app」 (one rule above the group, none between the two). Choosing it
calls the shell's `useDesignMode().enter` for the app on screen: no
navigation, no Studio.
- **Who sees it — the header button's condition, carried over unchanged,
no new judgement**: `useStudioEntryGate` (the gate `useAppStudioEntry`
reads) answers non-null, i.e. `useWorkspaceAdminStatus().isAdmin` AND
`useCanAuthorMetadata()` (the server-reported `manage_metadata`
capability) AND the app's package is one `GET /api/v1/packages` lists
(not a kernel package: Setup, Studio, Account get none); a read-only
package (`posture: 'view'`) only where the customization door takes the
caller (`!postureHasOrgWall(useTenancyPosture()) ||
user.isPlatformAdmin`), as objectstack-ai#36363 set it. It reads the app's own Studio
path (`appStudioDesignPath`); the gate judges the package id only, so
the answer is the one the header got on every route.
- **While the mode is on** the item is not drawn (same as the header
button was). **Where no shell holds the mode** it is not drawn either
(the header used to fall back to a Studio link there; nothing in the
console renders the sidebar outside `ConsoleLayout`'s provider).
- **Collapsed sidebar**: the float from the left edge is the same panel
with the same head, so the item is there too (pinned and
browser-measured).
- **Phone**: the sidebar head with the app menu is drawn from 768 px up
only, so no entry, as before.
- **Page header** (`ShellPageActions`): `EditAppButton` is deleted: no
「Edit app」 and no 「Open {app} in Studio」 in the group on any route. The
group now reads no Studio gate at all (`useAppStudioEntry(false)`, app
only, for the help menu's package). `useAppStudioEntry` stays:
`AppHeader` (the top bar still drawn below 768 px and on docs pages)
reads it.
- **Installed apps today**: on `main` an installed (read-only) app
already enters the mode (objectstack-ai#36363 landed), so in this PR an installed
app's menu item behaves exactly as a self-built one's. Its one exception
is the walled-deployment case above: there the item is absent (the
header showed the eye into Studio; that eye is gone with the header
buttons, so such a caller reaches Studio through the app switcher's row
or Studio's landing).
- **Onboarding**: there is no step pointing at 「Edit app」:
`chrome/OnboardingWalkthrough.tsx` is a stub that renders nothing, and
no other tour exists in the console.

## Tests

<details><summary>Pins added or rewritten (vitest, root ui/)</summary>

- `SidebarAppMenu-36112.test.tsx`, new top-level describe 「Edit app」 in
the app menu enters the design mode: placement under the list with one
rule before the group; choosing it turns the real
`useDesignModeController` on and the item is gone while on; a read-only
package's app has it and enters; walled + read-only gets none, walled +
writable keeps it; controls: a member, an admin without
`manage_metadata`, the Setup app (package not listed), no shell holding
the mode. The package list is the stubbed `fetch`; the file-level
`beforeEach` now stubs it for every test, since the menu reads the gate
for admins.
- `ShellPageActions-36111.test.tsx`: the group's order is comments then
help; the old 「Edit app」 / eye / design-mode-button describes are
replaced by one asserting neither entry (test id and accessible name)
for writable and read-only packages, with and without a design-mode
shell, walled, and for a member.
- `UnifiedSidebar.hiddenCollapse-35062.test.tsx`, new top-level
describe: sidebar collapsed at 1024 px, floated by a press on the left
edge, the real Radix app menu opened from inside the float offers 「Edit
app」, and choosing it turns the mode on.

</details>

<details><summary>Runs at f7d907a</summary>

- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/app-shell/src/layout/__tests__/` plus
`ObjectView.shellPageActions-36111`, `RecordDetailView.topBar-27524`,
`PageView.consoleHeader-36111` (lock VERDICT command-exit 0): Test Files
157 passed (157), Tests 1255 passed (1255). Run at 2b4666e plus the
test edits; the float pin and typing commit followed, re-run: the two
harness files 36/36.
- `pnpm --filter @object-ui/app-shell type-check` (both `tsc --noEmit`
and `tsconfig.test.json`): VERDICT command-exit 0.
- eslint on the five changed source and test files: 0 errors.

</details>

<details><summary>Ablation (one-shot, not kept)</summary>

- Menu item: `node scripts/ablation-replace.mjs --file
ui/packages/app-shell/src/layout/SidebarAppMenu.tsx --anchor
'{enterDesignMode && EDIT_APP_ITEM_ELEMENT}' --delete -- vitest …`
(anchor 1 → 0, blob 367de8d → 71946a69): 5 failed | 31 passed: every
positive pin in both harnesses red, every control green; restored blob
367de8d = HEAD.
- Header: `ShellPageActions.tsx` swapped for its base-commit text under
an EXIT trap: 3 failed | 5 passed (the order pin and both no-entry pins
red; the member control and the scope pins green); restored blob
2e64064 = HEAD, `git status` clean.

</details>

## Acceptance notes

- Browser, own stack (CRM example on its own port, `--fresh`; Console
dev server pointed at it), 1440 px. HotCRM is not in this container: the
CRM example's `com.example.crm` is a code package served read-only, so
it stands in for the installed app; a writable app was made for the
self-built case (`POST /api/v1/packages` `com.acme.mine` plus app
`my_sales` saved into it).
- Admin, read-only CRM app and writable My Sales app: header group
children = help only, no 「in Studio」 text anywhere on the leads list,
the accounts list and the pipeline dashboard; menu reads `CRM · Setup ·
(My Sales) · Edit app · Add app`; choosing 「Edit app」 draws the
design-mode bar; reopening the menu in the mode shows no 「Edit app」;
collapsed sidebar, floated from the edge: item present, choosing it
draws the bar.
- Member (created by the admin, no CRM permissions): menu reads `CRM`,
no 「Edit app」.
  - 390 px: no app menu trigger and no 「Edit app」 anywhere.
- Not measured in the browser: a report route and a custom page route
(the CRM example has neither in its menu); the group is the same
component on every route and `PageView.consoleHeader-36111` /
`ObjectView.shellPageActions-36111` / `RecordDetailView.topBar-27524`
stayed green.
- Screenshots (before = the two files at the base commit, served by the
same dev server), in `/mnt/project-files/objectstack-seat2/`:
- header before / after: `36485-before-crm-readonly-header.png`,
`36485-before-selfbuilt-writable-header.png` /
`36485-after-crm-readonly-header.png`,
`36485-after-selfbuilt-writable-header.png`
- app menu before / after: `36485-before-crm-readonly-app-menu.png` /
`36485-after-crm-readonly-app-menu.png`,
`36485-after-selfbuilt-writable-app-menu.png`
- in the mode: `36485-after-*-design-mode-on.png`,
`36485-after-*-app-menu-in-mode.png`; float:
`36485-after-*-float-app-menu.png`,
`36485-after-*-float-design-mode-on.png`; member:
`36485-after-member-app-menu.png`
- The top bar still drawn from 640 to 767 px and on an app's docs pages
keeps its Studio pencil / eye (`AppHeader`, outside this card's file
surface): it opens Studio, not the mode. Left as is; named in the report
for the seat.
- `designMode.tsx`'s docblock still says the mode is entered from the
page header's 「Edit app」 (`ShellPageActions`); the file is read-only
here (open PR objectstack-ai#36606 edits it). `ui/packages/app-shell/README.md`'s "App
→ Studio reverse bridge" describes the top bar only and does not mention
the mode's door; also outside the file surface. Both named in the
report.
- ADR-0146 D5 says the app bar entry draws as 「Open {app} in Studio」;
the page header's copy of it is gone. The sentence goes to the seat's
ADR-revision card, not this PR.

## Verification

Read first:
1. `ui/packages/app-shell/src/layout/SidebarAppMenu.tsx`,
`useEnterDesignMode`: the gate carried over from the header; the risk is
a viewer who saw the header button and now sees no menu item, or the
reverse.
2. `ui/packages/app-shell/src/layout/ShellPageActions.tsx`,
`ShellPageActionsGroup`: the group no longer reads the gate.
3. `UnifiedSidebar.hiddenCollapse-35062.test.tsx`, the new last
describe: the float path.

Two-minute check: as an admin, open any app page at desktop width, click
the app name at the top left: 「Edit app」 sits under the app list above
「Add app」; click it and the blue Design mode bar appears; the page
header's top-right has only the AI and help buttons.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm
<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmRB34k9WUWeGpRnVNm -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
… the sidebar draws it (objectstack-ai#36622)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi92ncfFpPUpTD8314otX5oaG)_
Fixes objectstack-ai#36591
Clause-②: no
Metadata-protocol: none

## 维护者速读

-
管理员在运行界面的设计模式里调整菜单顺序(上移、下移、移到分组、在前后加一项、添加菜单项、拖动)并保存后,侧栏现在按设计模式里显示的顺序排列;以前在
AI 搭建、菜单项带排序号的应用里,保存成功却毫无变化,再进设计模式看到的顺序也和侧栏相反。
- 属于「运行界面的设计模式」专题,替用 AI 搭建应用、要在应用里直接调菜单的管理员解决「改了不生效、也不报错」的问题。
-
出错时,带排序号的应用保存菜单后侧栏顺序会和设计模式不一致;只影响菜单顺序,不丢菜单项,可以在设计模式里再调一次保存,或撤回本次合并恢复旧行为。
- 无。

## What changes

The sidebar sorts each level of an app's `navigation` by `order`
(`byNavOrder` in `@object-ui/layout`: lower first, an absent `order` as
0, ties in array order). Design mode listed and saved the array as
authored, so in an app whose entries carry `order` a move was saved and
published and changed nothing on screen.

Route taken (the claim's Route, the card's first option): **rewrite
`order` on save, never drop it.**

- **Display** — design mode seeds its menu with every level put in the
sidebar's order (`inShownOrder` in `designModeMenuModel.ts`, which sorts
each level through `inMenuOrder`, the app-shell statement of the
sidebar's rule; no new comparator). The menu reads the same in and out
of the mode.
- **Save** — `saveAppMenu` puts the stored menu in that same shown order
before the edits are replayed on it (`rebaseMenuEdits`), then rewrites
`order` on the result (`withOrderRewritten`): each level in which
**any** entry carries `order` has **every** entry numbered `0, 1, …` in
the order design mode showed; group entries and each group's children
are numbered per level. A level where no entry carries `order` is saved
by array order and gains no key (HotCRM-shaped apps are unchanged).
- **Why `0..n-1`**: it is the smallest rule that makes `byNavOrder` draw
exactly the array order (no ties are possible inside a renumbered
level), it covers the mixed level the card names, and it is idempotent:
a second save of the same menu writes the same numbers. Dropping `order`
was rejected because it deletes authored keys from AI-built apps.
- **Why the stored menu is sorted first**: the edits are replayed by
place ("after the entry before it"), and the stored array of an
`order`-carrying app is not in shown order. Without the sort an entry
added at the end of `[X(2), Y(1), Z(0)]` lands after `X` in the array
and is numbered between `X` and `Y`. A stored entry the reader was never
shown (pruned) keeps its shown place among the rest.
- `rebaseMenuEdits` and `order`: the editor never writes `order`, so the
served and edited copies of an entry always agree on it and it is never
a patch key; the stored value travels with the entry and is then
rewritten. Nothing is treated as a conflict and nothing is dropped.
Pinned by "a move up is written as `order`; a rename beside it writes
its label, and `order` is never read as an edit".

### Why objectstack-ai#36363's tests did not catch it

Every fixture in the three objectstack-ai#36363 test files authored its menu **without
`order`** (HotCRM-shaped), where array order is the sidebar order. The
save pins read the written navigation's **array positions**
(`navigation[1].children.map((c) => c.id)`), and nothing drew the saved
menu through the sidebar's renderer. Its acceptance line
"上移并保存:顺序变了;刷新后还在" was therefore true of every fixture and false of the
AI-built app the coordinator saved. The new pins draw what the save
wrote through the real `NavigationRenderer` and compare it with what
design mode showed, over menus that carry `order`.

## Tests

Read first (by risk):
1. `ui/packages/app-shell/src/layout/designModeMenuSave.ts` — the two
lines around `rebaseMenuEdits`: the sort before the replay and the
rewrite after the payload.
2. `ui/packages/app-shell/src/layout/designModeMenuModel.ts` —
`inShownOrder` and `withOrderRewritten`.
3. `ui/packages/app-shell/src/layout/DesignModeMenu.tsx` — the `served`
seed.

New pins, each a top-level `describe` in the existing shared harness of
its subject (no new test files):

- `DesignModeMenu-36363.test.tsx` · "the design-mode menu in the sidebar
order (objectstack#36591)" — real `DesignModeMenu` + mode save, the
sidebar read from a rendered `NavigationRenderer` (no sort written in
the test): ordered app reads the same in design mode and in the sidebar;
Move up on Contacts then Save → sidebar reads Contacts, Customers, …,
and the saved app re-opens design mode in that order; Add an item after
+ Move to group → the sidebar places both where design mode showed them;
CONTROL: an app with no `order` saves a move by array order and gains no
`order` key; a mixed level reads as design mode after one save.
- `designModeMenuSave-36363.test.ts` · "the save writes the order the
editor showed as `order` (objectstack#36591)" — added at the end, move
up with a rename beside it, a pruned entry, and the no-`order` control.
- `designModeMenuModel-36363.test.ts` · "a level in the sidebar order,
and that order written back as `order` (objectstack#36591)".

<details><summary>Runs (head f4425f4)</summary>

- `pnpm --dir ui exec vitest run --maxWorkers=2
packages/app-shell/src/layout/` → `Test Files 155 passed (155)`, `Tests
1247 passed (1247)`; lock `VERDICT command-exit 0`.
- The three touched files alone → `Test Files 3 passed (3)`, `Tests 75
passed (75)`.
- `pnpm --filter @object-ui/app-shell type-check` (both `tsconfig.json`
and `tsconfig.test.json`) → lock `VERDICT command-exit 0`, after
rebuilding the dependency closure the `origin/main` merge moved (a first
run against the pre-merge `dist` reported `RecordDetailView.tsx` TS2322
from main's merged change; gone after the rebuild).
</details>

<details><summary>Ablation — the order rewrite removed</summary>

`node scripts/ablation-replace.mjs --file
ui/packages/app-shell/src/layout/designModeMenuSave.ts --anchor 'const
nextNav = withOrderRewritten(navPayloadOf(rebased as unknown[]) as
Menu);' --replacement 'const nextNav = navPayloadOf(rebased as
unknown[]) as Menu; void withOrderRewritten;'` over the three files:

- `ok mutation landed: anchor 1 -> 0, blob b319aa8 -> fd40d9929ee0`
- `Test Files 2 failed | 1 passed (3)`, `Tests 6 failed | 69 passed
(75)` — red: the three `order` save pins, and in the render harness Move
up, Add after + Move to group, and the mixed level. The two CONTROL pins
(no `order`) and the display pin stay green, as they should.
- `ok restored: blob == HEAD (b319aa8) and git diff HEAD is empty`.
</details>

## Acceptance notes

- **Renumbering rewrites authored values.** Saving a menu whose level
carries `order` writes consecutive numbers on every entry of that level
(an authored `10, 20, 30` becomes `0, 1, 2`), even when the save only
renamed an entry. The order drawn is unchanged; the values are not
preserved.
- **Another package's entries (`navigationContributions`) keep their own
`order`.** They are not in the stored menu, so they are not renumbered.
One that carries no `order` keeps its place (it sorts as 0 right after
the app's first entry, as design mode now shows it); one that carries
its own `order` can sit in a different place relative to the renumbered
entries than design mode showed. No live app was found with such a
contribution; noted, not filed.
- **Two save rules for one key.** Studio's nav canvas (`AppNavCanvas`
`moveItem`) writes `order` on the moved entry only; design mode now
renumbers the level. Both draw the order their editor showed; they
differ in how many keys a save writes. Observation only.
- **Browser check: NOT MEASURED**, reason: the worktree has no built
runtime or Console (`packages/console/dist` absent), and a full build
plus a seeded backend on this shared 4-core box was not taken on for
this card; the sidebar half is measured instead by rendering the real
`NavigationRenderer` over the written navigation.
- **Overlap**: `node scripts/pm/overlap-check.mjs` exits 1 against
objectstack-ai#36606 (shares `DesignModeMenu.tsx`, `designModeMenuSave.ts`, conflicts
in `DesignModeMenu-36363.test.tsx`); the seat sequenced this card first
and objectstack-ai#36606 rebases on it.

## Verification

Two minutes: `pnpm --dir ui exec vitest run
packages/app-shell/src/layout/__tests__/DesignModeMenu-36363.test.tsx -t
"sidebar order"` — expect 5 passed, among them "「Move up」 on Contacts,
saved: the sidebar reads Contacts, Customers, …".

Local gates: `node scripts/pm/dispatch-gates.mjs --commands` derived 38
commands for this diff; all 38 ran with exit 0 and `--ran` reconciles
"38 run, 0 NOT-MEASURED". The `ui/scripts` vitest family was run with
`--maxWorkers=2` added (dispatch order). Families CI runs are read from
this PR's check-runs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm
<!-- signed: repo:objectstack#2 · os-steve ·
session_01ADHkmRB34k9WUWeGpRnVNm -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: objectstack-fleet[bot] <332303061+objectstack-fleet[bot]@users.noreply.github.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
… write Field change values (objectstack-ai#36290 part 1) (objectstack-ai#36641)

<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9NRmimMwnUgR1DbqgHtBWM3)_

Part of objectstack-ai#36290

Clause-②: yes (widening)
Metadata-protocol: none

## 维护者速读

- 管理员在 Studio 的字段设置和字段设计器里,原来的「记录历史」开关换成「字段修改值」三选一(默认 / 开 /
关),对象设置的「功能开关」里新增「字段修改值」;普通用户无感。
- 属于记录页「字段修改前后值」专题,落实「默认显示、对象或单个字段可关」的裁决:以前 Studio
写的是不再起作用的旧开关,管理员在界面上关不掉前后值。
- 若出错,管理员可能看到「默认」标成开而动态里实际不显示前后值(或相反),或关掉后回不到默认;改动只在设置界面,可直接撤回。
- 要你做的:无。

## What changes

Card objectstack-ai#36290 part ① (PR 3 of 4; ruling 7076513167 point 1: "Old → new is
shown by default on every object's record page; an object, or a single
field, can turn it off."). PR 1 (objectstack-ai#36399) gave the runtime `fieldHistory`
(field) and `enable.fieldHistory` (object); objectstack-ai#36580 gave the metadata
form a three-way `field-history` widget. The Studio's own producers
still wrote the old key. This PR moves all three named in the release
comment.

**Field inspector** (`ObjectFieldInspector.tsx`, Advanced section)
- The "Track history" box (`value={!!def.trackHistory}`, `patchDef({
trackHistory: v || undefined })`) is gone. Measured reason: since PR 1 a
field's `trackHistory: false` reads like absent and `true` does only
what `fieldHistory: true` does for a media or JSON type (spec describe
of `FieldSchema.trackHistory`), so a second box beside Field change
values could only mislead. A stored `trackHistory` is never written or
removed here; it is still read, because `resolveFieldHistory` reads it.
- New row "Field change values": Default / On / Off over the field's
`fieldHistory`. Default removes the key (`unsetDefKey`, not a patch to
`undefined`); On / Off write `true` / `false`.
- Default names what it resolves to through `resolveFieldHistory` from
`@objectstack/spec/data`, the predicate the activity writer uses. Unlike
the form widget, this rail holds the object document, so it passes the
object: an object with `enable.fieldHistory: false` makes every field's
Default read "Default (Off)", and a note under the row says the object's
off wins.
- The row sits inside the existing `DisplayPatchLock`, so on a read-only
base field it is locked with the same reason as its neighbours
(`fieldHistory` is not on `BASE_FIELD_DISPLAY_WHITELIST`).

**Object settings** (`ObjectSettingsPanel.tsx`, Features card)
- New row "Field change values" (`enable.fieldHistory`), next to "Field
change history" (`enable.trackHistory`). Ticked unless the stored value
is a literal `false`. Unticking writes `false`; ticking again REMOVES
the key (unset already means on, so no `true` the author did not need).
Sibling `enable` keys are kept, as for every other row.
- The Field change history description no longer says "pair with
per-field history tracking to pick which field diffs are summarized" (no
longer true); it points to Field change values.

**Field designer** (`plugin-designer` `FieldDesigner.tsx`, the drawer
behind `MetadataFieldsPage` and the `field-designer` SDUI type)
- The Advanced section's Track History switch wrote `trackHistory:
data.trackHistory === true` on every save, create and edit. It is
replaced by Field Change Values with the same three choices. The update
path no longer names `trackHistory`: a stored value rides the
`...editingField` spread, and a created field carries neither key at
Default.
- Default's label depends on the type, which the author can change in
the same drawer, and a drawer select's options are static. So the choice
is drawn as two rows under form-local names, one per resolved default,
each shown by a `visibleWhen` built from `resolveFieldHistory` over
`DESIGNER_FIELD_TYPES` (with the field's stored `trackHistory`). The
save reads the row shown for the saved type, which is the one on screen
at the click. Neither form-local name reaches the model.
- `DesignerFieldDefinition` (`@object-ui/types`) and its zod mirror gain
an optional `fieldHistory`. Both save paths carry it:
`MetadataFieldsPage` (`toDesignerField` / `fromDesignerField`) and
`MetadataService.toFieldPayload`. Default writes `fieldHistory:
undefined`, which overrides the carried value and is dropped on the
wire, so a stored key is removed. That is the converters' existing
clear-by-absence rule.
- It cannot import `fieldHistoryChoice.ts`, because app-shell depends on
plugin-designer. What it shares is the rule (`resolveFieldHistory` from
`@objectstack/spec/data`). Its own copy of the choice-to-value mapping
is two lines. Its strings are the language-pack keys
`appDesigner.fieldDesigner.fieldHistory`, `fieldHistoryDefault`,
`fieldHistoryOn` and `fieldHistoryOff`, in all 11 locales and the
designer's defaults table. They replace
`appDesigner.fieldDesigner.trackHistory`.

**Shared logic** (`metadata-admin/fieldHistoryChoice.ts`, new): the
three choices, the value each writes and their wording, used by both the
inspector row and the objectstack-ai#36580 `field-history` widget (refactored onto it;
its behaviour and its 10 pins unchanged). The controls stay separate on
purpose: the widget is a `WidgetProps` renderer that sees one form row
and no object; the inspector row is an `InspectorSelectField` with the
inspector's label and lock semantics and the whole object in hand.

**Strings** (studio namespace, en + zh; the other locales fall back to
en by that namespace's design): `designer.field.fieldHistory`,
`designer.field.fieldHistoryObjectOff`,
`engine.studio.settings.capFieldHistory`,
`engine.studio.settings.capFieldHistoryDesc`;
`engine.studio.settings.capTrackHistoryDesc` reworded;
`designer.field.trackHistory` removed with its box.

Not in this PR: record-page rows (part ②, landed as objectstack-ai#36613), the
per-field history card (part ③).

## Tests

- New `ObjectFieldInspector.fieldHistory-36290.test.tsx` (7): Default
(On) for a one-line type; Default (Off) for image / json / password and
Default (On) once `trackHistory: true`; Off writes `false`, On writes
`true`; Default after Off removes the key; no Track history box, no
`trackHistory` written, a stored one kept; the object's off makes
Default (Off) and shows the note; control: no note otherwise.
- New describe in `ObjectSettingsPanel.test.tsx` (4): checked for unset
and `true`, unchecked only for `false`; untick writes `false` with
siblings kept; re-tick removes the key with siblings kept; labelled by
its own title.
- New `FieldDesigner.fieldHistory-36290.test.tsx` (9), on the real
`FieldDesigner` with a drawer double that captures its schema and calls
its own `onSuccess`. The cases: two rows and no Track History row, with
the labels; for every designer type exactly one row's `visibleWhen`
evaluates true (through `evalFieldPredicate`, the form's own evaluator),
and it is the one `resolveFieldHistory` names; a stored `trackHistory:
true` moves a media type to the Default (On) row; an untouched edit
writes neither key; Off writes `false`, On on a media type writes
`true`; a stored `false` opens as Off and Default removes it; a stored
`trackHistory` is kept; a type changed in the drawer saves what is on
screen; a created field at Default carries neither key.
- New `MetadataFieldsPage.fieldHistory-36290.test.tsx` (4), on PUT bytes
through the real page and a real `MetadataClient`. A stored
`fieldHistory: false` survives and no `trackHistory` is written; a
stored `trackHistory: true` survives and gains no `fieldHistory`; a
field with neither key gains neither; every PUT field parses through
`FieldSchema`.
- Extended: `MetadataService.fieldKeyCarryOver.test.ts` adds
`fieldHistory` to its populated entry and its clearable keys;
`designer-zod-arms-10859.test.ts` adds `fieldHistory` to the fully
populated `field-designer` document.
- Forced test changes:
`ObjectFieldInspector.displayPatchReason-28986.test.tsx` names the Field
change values combobox instead of the removed Track history checkbox
among the locked controls;
`ObjectSettingsPanel.businessWording-36512.test.tsx` lists
`enable.fieldHistory` among the keys the tab writes.
`ObjectFieldInspector.externalIdNotOffered-26674.test.tsx` and
`ObjectFieldInspector.retiredIndexed.test.tsx` listed Track history
among the Advanced siblings that still render; they name Field change
values, and (being edited) now pay the formula and lint loads at module
top, as `check:test-source-alias` requires.
`FieldDesigner.externalIdNotOffered-26674.test.tsx` and
`MetadataFieldsPage.externalIdRoundTrip-26674.test.tsx` used the Track
History row as their positive control; they now use the Field Change
Values row.


## Acceptance notes

- The field designer's Default label follows the drawer's type and the
object is not in hand, so an object with `enable.fieldHistory: false` is
not reflected there, the same accepted bound as objectstack-ai#36580's widget. Neither
`FieldDesigner` nor `MetadataFieldsPage` is mounted by the Console
today; both are published exports, and `field-designer` is a registered
SDUI type.
- A stored field `trackHistory: true` on a media or JSON type makes
Default read "Default (On)"; such a field can still be turned off with
Off, but not returned to the type's off-by-default without editing the
key in the form. That is the resolver's answer, not a UI choice.
- `ui/AGENTS.md` objectstack-ai#2 (package README and `content/docs/frontend/` page)
not edited: outside this part's file surface.
- Screenshots NOT MEASURED (no Console build or backend run here).

## Verification

Read first, by risk:
1. `ui/packages/plugin-designer/src/FieldDesigner.tsx`: the
`fieldHistoryRows` memo (two rows, `visibleWhen` built from
`resolveFieldHistory`) and `fieldHistoryFromForm`, which picks the row
for the SAVED type on both save paths.
2.
`ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx`:
`patchEnable` with `unsetWhenOn` (re-ticking removes
`enable.fieldHistory`, keeps siblings).
3.
`ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.tsx`:
the Field change values row and the object-off note inside
`DisplayPatchLock`.

Two-minute check: open Studio, an object, Settings, Features: "Field
change values" is ticked. Untick, save, and reopen the object JSON: it
shows `enable.fieldHistory: false`. Tick again: the key is gone. Then
open a field's Advanced section: "Field change values" reads "Default
(Off)" with the note under it.

<details><summary>Runs (local, head 3b5b130 after merging origin/main
9e2a4ac)</summary>

- Builds under the verify lock: the
`@objectstack/{spec,formula,lint,client,sdui-parser}` closure, and
`@object-ui/app-shell^...` again after the merge (VERDICT command-exit 0
each).
- `type-check` (tsc plus `tsconfig.test.json`) of
`@object-ui/app-shell`, `@object-ui/i18n`, `@object-ui/types` and
`@object-ui/plugin-designer`: all four Done, exit 0 (after the merge;
plugin-designer again at 3b5b130).
- Post-merge union at ffa608d: `vitest run
packages/app-shell/src/views/metadata-admin/inspectors/
packages/app-shell/src/views/studio-design/ObjectSettingsPanel
packages/app-shell/src/views/metadata-admin/FieldHistoryWidget-36482.test.tsx
packages/app-shell/src/views/metadata-admin/SchemaForm
packages/plugin-designer/ packages/types/
packages/app-shell/src/services/ packages/i18n/
packages/app-shell/src/__tests__/defaults-maps-mirror-en-pack.test.tsx`
gave Test Files 851 passed (851) and Tests 16838 passed, 14 skipped.
3b5b130 changes only the designer pin's types; that file re-run: 9/9.
- Pre-merge union at 3fa510b (`metadata-admin/`, `studio-design/`,
`i18n/`) gave Test Files 1232 passed and 2 failed (1234). The 2 were
sibling pins still naming Track history, fixed in 58cef60.
- Ablations, each through `scripts/ablation-replace.mjs` (anchor 1 to
0), restored with blob equal to HEAD and `git diff HEAD` empty:
- The inspector writes `trackHistory` again: 2 of 7 new inspector pins
red.
- The settings switch writes `true` instead of removing the key: 1 of 14
red.
- The designer's update path writes `trackHistory: data.trackHistory ===
true` in place of `fieldHistory`: 7 of 13 red across the two new
designer files.
- `dispatch-gates --commands` at 3b5b130 derived 42 families; all 42
ran locally with exit 0; `--ran` reconciliation gives "42 derived, 42
run, 0 NOT-MEASURED, 0 UNRUN".
- `overlap-check` at 3b5b130: VERDICT clean exit 0 against origin/main
d7411fa (three commits past the merged 9e2a4ac; `git merge-tree` is
also clean) and objectstack-ai#36634, objectstack-ai#36629, objectstack-ai#36606, objectstack-ai#36587, objectstack-ai#36525.
- ui extras: `check:new-line-citations` 0, `check:i18n-keys` 0,
`check:i18n-drift` 0, `check:i18n-dead-keys` 0. eslint on the changed
source and test files: 0 errors, and no warnings on added lines.

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht

---------

Co-authored-by: Claude <noreply@anthropic.com>
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 23, 2026
… of the object (objectstack-ai#36651)

<!-- claude-projects-attribution: {"github_login":"os-warren"} -->
_Requested by **Warren** · [project
thread](https://claude.ai/code/project/chan_01U5RdnAAmkSQmZbqh6FtqZ8?thread=cmsg_01U5RdnAAmkSQmZbqh6FtqZ82MfFjFxvJRAyoku6XCvWt4)_

Fixes objectstack-ai#36648
Fixes objectstack-ai#36653

## What changes

- `StudioDesignSurface.tsx`, the Data pillar's object load: a re-read on
the live-metadata pulse alone (`refreshOnly`) no longer clears the dirty
flag, the kept CEL verdicts and the served verdict as its effect starts.
It drops them when it installs, after the existing in-flight check
(`refreshOnly && objBuffersHeldRef.current` ⇒ keep the buffer). A full
load (another object, a publish, a reload) resets at the start as
before.
- New `DataPillar.pulseAfterSave-36648.test.tsx` (2 cases): types into
the window deterministically (the hook wrapped to report its release;
the keystroke runs in the microtask after it) and pins that the edit
stays, that a valid one is sent by the next Save, and that an unparsable
one is held. Both cases fail on `main` (`expected '' to be …`: the edit
is gone) and pass here.
- `DataPillar.panelGate.test.tsx` and `panelHold-27629` are untouched:
nothing skipped, retried, narrowed or slowed.

## Why — root cause (product, pre-existing; not objectstack-ai#36636)

The red in run 45133910959 is the **second** Save of the first case
(`panelGate.test.tsx:166`): `findByTestId('studio-save')` ran its full 4
s and the button never came back after the case typed `record.status
==`. The button is drawn only while the page holds an edit, so the edit
was gone.

A Save's publish sends the live-metadata pulse. The pillar holds it
while the buffer has work (`useMetadataRefreshNonce(objBuffersHeld)`)
and releases it in an effect the moment the Save ends; the next render's
load effect re-reads the object. That effect called `setDirty(false)`
(and cleared the verdicts) **as it started**, before the in-flight
check. A keystroke landing between the release and that effect therefore
lost its dirty flag; the read, finding nothing held, installed the
server's body over it; the edit and the Save button went with it. The
window is one scheduler gap, which a loaded merge-queue runner can open
between the case's Save and its next keystroke. For an author it is a
keystroke right after pressing Save that silently disappears.

Not objectstack-ai#36636: `StudioDesignSurface.tsx` and `useMetadataRefreshNonce.ts`
are byte-identical between objectstack-ai#36636's parent `99ece3c4` and `main`; the
window predates it. objectstack-ai#36636 changed only when Save reads `held`, before
any write.

## Verification

Loaded box: 4-core container, 4 busy-loop CPU stressors, `vitest run
--maxWorkers=2`, 20 consecutive runs.

| tree | files | runs | red |
|:--|:--|:--|:--|
| objectstack-ai#36636's parent `99ece3c4` | panelGate | 20 | 2: both `expected
"vi.fn()" to not be called` (:167, :175), the objectstack-ai#36619 verdict race objectstack-ai#36636
fixed |
| `main` `e9fa6b5d` | panelGate | 20 | 0 (the :166 timeout did not recur
in 20; the deterministic case above reproduces it) |
| this head `6e21473c` | panelGate + panelHold-27629 +
pulseAfterSave-36648 | 20 | 0: 20 of 20 green in a row, all 10 cases
each run |

Also green locally: every studio-design test file that saves through the
top bar, reads the pulse, or is a `DataPillar.*` suite (50 files, 259
tests).

## Also: the unit-project red that blocked this PR (objectstack-ai#36653)

`Test UI (7/16)` went red on `romanizeHan.test.ts:24` (`expected '
weixiu zhongxin ' to be '维修中心'`), a file the fix above does not touch.
Cause: test order, not product. The `unit` project runs files with
`isolate: false`; `layout/__tests__/designModeMenuCreate-36364.test.ts`
(landed 08:11Z with objectstack-ai#36606) calls `loadHanRomanizer()` in its
`beforeAll`, so when it ran earlier in the same worker the shared
`romanizeHan` module was already loaded and the "before the dictionary
has loaded" cases read romanized text.

- Reproduction: `vitest run --project unit --maxWorkers=1
designModeMenuCreate-36364.test.ts romanizeHan.test.ts` fails at `:24`
with CI's exact message on `main` `3cf6a44b`.
- Fix (separate commit, test only, no product code, no changeset): the
before-load describe reads its own instance (`vi.resetModules()` +
dynamic `import('./romanizeHan')`) and still pins "unchanged and pending
until loaded"; a new case pins that the same instance stops being
pending once it loads. Nothing skipped, retried or narrowed.
- Counts: neighbour first, `--maxWorkers=1`, 4 busy-loop CPU stressors
on a 4-core box, 20 consecutive runs: 20 of 20 green (red before).
Alone: green.

Clause-②: no
Metadata-protocol: none

## Human Minimum

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01JQwxbXCSJnUMMhWxyBmuqA

<!-- signed: repo:objectstack#1 · os-warren ·
session_01JQwxbXCSJnUMMhWxyBmuqA -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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

Development

Successfully merging this pull request may close these issues.

2 participants