Repository navigation
fix(app-shell): a menu reordered in design mode is saved in the order the sidebar draws it - #36622
Merged
objectstack-fleet[bot] merged 8 commits intoNov 23, 2026
Merged
Conversation
… differs from another only in case
`layout/DesignModeMenu.tsx` and `layout/designModeMenu.ts` were one module
name on a case-insensitive file system: the sidebar's lazy
`import('./DesignModeMenu.js')` resolved to the helper module there, the
app-shell build failed with TS1149 and design mode white-screened. The
helpers move to `designModeMenuModel.ts` (git mv), their test to
`designModeMenuModel-36363.test.ts`, and the three importers follow.
Claude-Session: https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm
Co-authored-by: Claude <noreply@anthropic.com>
…asing' into claude/issue-36591-design-menu-order
… order Claude-Session: https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm Co-authored-by: Claude <noreply@anthropic.com>
…r alone would misplace them Claude-Session: https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm Co-authored-by: Claude <noreply@anthropic.com>
…sign-menu-order # Conflicts: # ui/packages/app-shell/src/layout/__tests__/designModeMenuSave-36363.test.ts # ui/packages/app-shell/src/layout/designModeMenuSave.ts
Contributor
Author
|
repo:objectstack#2 · os-steve · session_01ADHkmRB34k9WUWeGpRnVNm Flake reading — PR #36622 @ f4425f4 · 2026-11-23T04:25Z
|
Contributor
Author
|
repo:objectstack#2 · os-steve · session_01ADHkmRB34k9WUWeGpRnVNm Second red — PR #36622 @ f4425f4 · 2026-11-23T04:42Z
|
This was referenced Nov 23, 2026
Contributor
Author
|
repo:objectstack#2 · os-steve · session_01ADHkmRB34k9WUWeGpRnVNm 席位核对ACCEPT — PR #36622 @ 78acf16 (head of record, full sha on the PR;
|
objectstack-fleet
Bot
deleted the
claude/issue-36591-design-menu-order
branch
November 23, 2026 07:02
247257110
pushed a commit
to 247257110/objectstack
that referenced
this pull request
Nov 23, 2026
objectstack-ai#36606) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi93yJM5eSHAibimwWb6xCgvP)_ Part of objectstack-ai#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 就能在应用里新建仪表盘并挂到菜单上。 - 出错会怎样:菜单保存失败时,刚建的仪表盘会被删掉,设计模式保持打开并说明原因;中途取消什么都不写;可以直接撤回本次合并。 - 要你做什么:不用做什么。新建报表这一半席位已定(报表必须先选数据集和指标,改为从报表搭建页新建),等 objectstack-ai#36374 合并后另做。 ## What changes - The design-mode picker's Dashboards list starts with 「New dashboard…」 (`DesignModeMenu.tsx`). It asks for a name only. 「Cancel」 (or closing the dialog) writes nothing and drops the held place. - 「Create」 runs, in order (`designModeMenuCreate.ts`): every check of the menu save first (`prepareAppMenuSave`, split out of `saveAppMenu` unchanged in behaviour); the dashboard created empty (`{ name, label, widgets: [] }`) and published in the menu's own package (the app's package when listed writable, else its `.custom` pair via the ensure door; ADR-0146 D2, objectstack-ai#35624 ruling C) through the existing confirmed-save door `saveDashboardInPlace`; then the menu written and published with the new entry in the held place and every other staged menu edit (`writeAppMenu`). Where the menu cannot be saved, nothing is created: no package-less fallback. - A refused menu removes the dashboard again (the item DELETE with `?package=`, measured on a live server: `Deleted dashboard ... it no longer exists`). If that removal is refused too, the error says the dashboard was left. - The design mode gains `saveWith(key, change)` (`designMode.tsx`): commit everything staged with one change in its key's place, never staging it on its own, so a failed create leaves no half-written entry staged for a later Save. - The machine name is generated from the name (Chinese through pinyin), and checked free on the server (`GET /meta/dashboard/:name`) so a create never publishes over an existing dashboard. - On success the mode is left and the page navigates to the dashboard with a one-time navigation-state landing (`designModeArrival.ts`); `DashboardView.tsx` opens its objectstack-ai#36372 edit state on that landing once the Edit button is offered, and clears it. - A dashboard with no cards now draws 「No cards yet」 instead of a blank canvas (view mode only). - **Not in this PR: 「New report…」.** The spec refuses a report without `dataset` + `values`, and the server's draft save refuses it too (`INVALID_METADATA`, measured), so a name-only report cannot be created. The seat's premise correction on the card (comment 7090058961) settles it: 「New report…」 opens the report builder (objectstack-ai#36374) in a create mode and writes the report and its menu entry once a dataset and a measure are picked; that half follows after objectstack-ai#36374 merges. 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 objectstack-ai#36364 (claim comment 7088329990). Overlap: touches `DashboardView.tsx`, which draft PR objectstack-ai#36461 also touches; `overlap-check` reads both merging cleanly. This PR lands after objectstack-ai#36461 per the claim. ## Tests <details><summary>Unit and component tests (head 313b6bf)</summary> Run from the repo root under `os-verify-lock`; vitest root `ui/`. - Head `313b6bf8` merges `origin/main`, bringing objectstack-ai#36604 (the `designModeMenu.ts` rename to `designModeMenuModel.ts`), objectstack-ai#36622 (objectstack-ai#36591's menu `order` rule) and objectstack-ai#36461. The one conflict, in `DesignModeMenu-36363.test.tsx`, was resolved by keeping both sides: this card's `server` mock, its reset and its describe, next to objectstack-ai#36591's `servedNav` and its describe. Two imports were moved to the renamed module (`designModeMenuCreate.ts` and its test); no file names the old module any more. objectstack-ai#36591's `inShownOrder` / `withOrderRewritten` auto-merged into `prepareAppMenuSave`, so the create path applies the same rule. It is pinned by a new test: the new entry, held between two entries of an `order`-carrying level, is saved as `[customer 0, nav_item_1 1, contact 2, opportunity 3]`. - At `313b6bf8`, after rebuilding the app-shell dependency closure (`VERDICT command-exit 0`): `pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/layout/ packages/i18n/` plus the 9 `packages/app-shell/src/views/DashboardView*.test.tsx` files gives `Test Files 271 passed (271)`, `Tests 3301 passed | 13 skipped (3314)`, `VERDICT command-exit 0`. This covers the 4 card files and every layout/i18n/DashboardView test the merge touched. - At `313b6bf8`: `designModeMenuCreate-36364.test.ts` alone gives `Tests 14 passed (14)`. - At `313b6bf8`: `pnpm --dir ui --filter @object-ui/app-shell --filter @object-ui/i18n run type-check` (both `tsc --noEmit` and `tsconfig.test.json`) gives `VERDICT command-exit 0`, 0 `error TS`. - Earlier, at `ab2257f4`: the i18n run plus the 4 card files gave 110 files and 2050 tests passing. At `0647077c`, a narrowed app-shell + i18n run found 3 failures caused by this change: zh-Hant was not regenerated, and the de quote count was 125 against 126. Both were fixed. The full app-shell suite is left to CI's `Test` shards. - New and extended pins: - `designModeMenuCreate-36364.test.ts`: 14 tests (13, plus the `order` pin). - `DesignModeMenu-36363.test.tsx`: 4 tests (the create row, Cancel writes nothing, the create-and-land flow, a refused menu). - `designMode-36362.test.tsx`: 3 tests for `saveWith`. - `DashboardView.inPageEdit-36372.test.tsx`: 3 landing tests and 2 empty-state tests. </details> <details><summary>Ablations (one-shot, not kept)</summary> - 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. </details> ## 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. <details><summary>Derived gates (head ab2257f)</summary> - `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 objectstack-ai#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. </details> --- _Generated by [Claude Code](https://claude.ai/code/session_01ADHkmPiTdmLxHXBjakSvJy)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- signed: repo:objectstack#2 · os-steve · session_01ADHkmPiTdmLxHXBjakSvJy --> --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steve · project thread
Fixes #36591
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
The sidebar sorts each level of an app's
navigationbyorder(byNavOrderin@object-ui/layout: lower first, an absentorderas 0, ties in array order). Design mode listed and saved the array as authored, so in an app whose entries carryordera move was saved and published and changed nothing on screen.Route taken (the claim's Route, the card's first option): rewrite
orderon save, never drop it.inShownOrderindesignModeMenuModel.ts, which sorts each level throughinMenuOrder, the app-shell statement of the sidebar's rule; no new comparator). The menu reads the same in and out of the mode.saveAppMenuputs the stored menu in that same shown order before the edits are replayed on it (rebaseMenuEdits), then rewritesorderon the result (withOrderRewritten): each level in which any entry carriesorderhas every entry numbered0, 1, …in the order design mode showed; group entries and each group's children are numbered per level. A level where no entry carriesorderis saved by array order and gains no key (HotCRM-shaped apps are unchanged).0..n-1: it is the smallest rule that makesbyNavOrderdraw 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. Droppingorderwas rejected because it deletes authored keys from AI-built apps.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 afterXin the array and is numbered betweenXandY. A stored entry the reader was never shown (pruned) keeps its shown place among the rest.rebaseMenuEditsandorder: the editor never writesorder, 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 asorder; a rename beside it writes its label, andorderis never read as an edit".Why #36363's tests did not catch it
Every fixture in the three #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 realNavigationRendererand compare it with what design mode showed, over menus that carryorder.Tests
Read first (by risk):
ui/packages/app-shell/src/layout/designModeMenuSave.ts— the two lines aroundrebaseMenuEdits: the sort before the replay and the rewrite after the payload.ui/packages/app-shell/src/layout/designModeMenuModel.ts—inShownOrderandwithOrderRewritten.ui/packages/app-shell/src/layout/DesignModeMenu.tsx— theservedseed.New pins, each a top-level
describein 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)" — realDesignModeMenu+ mode save, the sidebar read from a renderedNavigationRenderer(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 noordersaves a move by array order and gains noorderkey; a mixed level reads as design mode after one save.designModeMenuSave-36363.test.ts· "the save writes the order the editor showed asorder(objectstack#36591)" — added at the end, move up with a rename beside it, a pruned entry, and the no-ordercontrol.designModeMenuModel-36363.test.ts· "a level in the sidebar order, and that order written back asorder(objectstack#36591)".Runs (head f4425f4)
pnpm --dir ui exec vitest run --maxWorkers=2 packages/app-shell/src/layout/→Test Files 155 passed (155),Tests 1247 passed (1247); lockVERDICT command-exit 0.Test Files 3 passed (3),Tests 75 passed (75).pnpm --filter @object-ui/app-shell type-check(bothtsconfig.jsonandtsconfig.test.json) → lockVERDICT command-exit 0, after rebuilding the dependency closure theorigin/mainmerge moved (a first run against the pre-mergedistreportedRecordDetailView.tsxTS2322 from main's merged change; gone after the rebuild).Ablation — the order rewrite removed
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 b319aa8229c4 -> fd40d9929ee0Test Files 2 failed | 1 passed (3),Tests 6 failed | 69 passed (75)— red: the threeordersave pins, and in the render harness Move up, Add after + Move to group, and the mixed level. The two CONTROL pins (noorder) and the display pin stay green, as they should.ok restored: blob == HEAD (b319aa8229c4) and git diff HEAD is empty.Acceptance notes
orderwrites consecutive numbers on every entry of that level (an authored10, 20, 30becomes0, 1, 2), even when the save only renamed an entry. The order drawn is unchanged; the values are not preserved.navigationContributions) keep their ownorder. They are not in the stored menu, so they are not renumbered. One that carries noorderkeeps its place (it sorts as 0 right after the app's first entry, as design mode now shows it); one that carries its ownordercan 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.AppNavCanvasmoveItem) writesorderon 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.packages/console/distabsent), 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 realNavigationRendererover the written navigation.node scripts/pm/overlap-check.mjsexits 1 against feat(console): create a dashboard from the design mode's Add menu item #36606 (sharesDesignModeMenu.tsx,designModeMenuSave.ts, conflicts inDesignModeMenu-36363.test.tsx); the seat sequenced this card first and feat(console): create a dashboard from the design mode's Add menu item #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 --commandsderived 38 commands for this diff; all 38 ran with exit 0 and--ranreconciles "38 run, 0 NOT-MEASURED". Theui/scriptsvitest family was run with--maxWorkers=2added (dispatch order). Families CI runs are read from this PR's check-runs.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmRB34k9WUWeGpRnVNm