Skip to content

feat(console): 「Edit app」 turns on a design mode in the running app (#36362) - #36397

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

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

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steedos · project thread

repo:objectstack#7 · zhuangjianguo · session_01QsR2jSr8sNCnJrK6Q9kEF5

Fixes #36362

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

维护者速读

  • 用户能看到什么变化:有权设计应用的管理员(工作区管理员、具备元数据管理权限、应用所在的包可写)在页头点「编辑应用」后,不再跳转到 Studio,而是在当前应用里进入设计模式:窗口顶部出现一条横栏,只有「设计模式」「取消」「保存」;切换到同一应用的其它页面时模式保持,换应用或在手机上不出现;进入后侧边栏不再显示个人收藏。只读包(例如已安装的应用)仍然是原来的「在 Studio 中查看」入口。
  • 为什么做:这是「运行时设计模式」这条线的第一张卡,先把模式本身和统一的保存/取消机制立起来,后面的菜单编辑、页头按钮固定、从菜单新建仪表盘/报表都挂在它上面;这一版本身还没有任何可改的内容,所以「保存」一直是灰的。
  • 出错会怎样:最坏情况是管理员进入设计模式后看到横栏却无事可做,点「取消」即可退出;模式不写任何数据,不影响普通成员,改动只在界面层,可直接撤回。
  • 要你做什么:无。另有一个后续问题已交给席位:已安装的只读应用目前进不了设计模式(与原先进不了 Studio 编辑一致),下一张卡(菜单编辑)若要覆盖已安装应用,需要让这类应用也能进入,届时由席位提出。

What changes

「Edit app」 in the page header no longer opens Studio for an administrator who may design the app (useAppStudioEntry's edit posture: workspace admin, manage_metadata, writable package). It turns on the shell's design mode for the app on screen, in place.

  • The mode (layout/designMode.tsx) is held by ConsoleLayout for the app it was entered in: it survives moving between pages of that app, goes off (and drops what it held) when the app changes, and is never drawn on a phone (enabled: false hides it and keeps what is staged). It has no address; no URL enters it.
  • The bar (layout/DesignModeBar.tsx) is drawn in the AppShell's top slot, across the window, while the mode is on: 「Design mode」 at its left, 「Cancel」 and 「Save」 at its right, nothing else. 「Save」 is off while nothing is staged. On desktop the sidebar sits below the bar while it is shown, and the page header hides its 「Edit app」 button.
  • The extension point useDesignModeChange(key): a surface stages a change under a key together with its own commit. 「Save」 commits every staged change in the order first staged, then leaves; a failed commit stops there, keeps it and every later change staged, keeps the mode on and toasts the reason. 「Cancel」 drops all and commits none. Outside the mode nothing can be staged. This PR stages nothing yet; 设计模式(二)菜单编辑:添加已有的菜单项,上移下移、移到分组、移除、改名和图标 #36363, 设计模式(四)页头按钮:选哪些动作固定在页头、哪些收进「更多」,可以拖动排序 #36366 and 设计模式(三)在「添加菜单项」里新建仪表盘、新建报表:建完落在占好的位置,直接进入编辑 #36364 build on it.
  • Leaving with something staged goes through the existing unsaved-edits seam (chrome/unsavedEdits.ts), which gains an optional keeps(url) per registration: a link to another page of the same app does not ask (the mode goes along), a link out of the app and the app switcher ask, and a tab close or reload is held by the browser prompt.
  • The sidebar in design mode shows the app's own menu only: the Favorites section and its pin buttons are off, so the menu under edit is the app's, not the person's.
  • A read-only package's app keeps its eye entry 「Open APP in Studio」 unchanged; a member sees no entry, as before.
  • New i18n keys designMode.title, designMode.leaveUnsaved, designMode.saveFailed in every hand-written locale, zh-Hant generated.

Read first, by risk:

  1. ui/packages/app-shell/src/layout/designMode.tsx — the save loop (order, stop-on-failure, re-staged-while-sending) and the app-change reset.
  2. ui/packages/app-shell/src/chrome/unsavedEdits.ts — keeps only narrows the click guard; confirmUnsavedLeave and beforeunload still ask for every registration.
  3. ui/packages/app-shell/src/layout/ConsoleLayout.tsx / UnifiedSidebar.tsx — the header slot and the sidebar offset while the bar is on.

Tests

  • New layout/__tests__/designMode-36362.test.tsx: the bar's contents; 「Save」 off until something is staged; commit order and exit; a failed commit keeps it and later ones, keeps the mode, toasts; 「Cancel」 commits none; nothing staged outside the mode; another app drops it; a phone hides it and keeps what is staged; beforeunload held only while staged; an in-app link asks nothing, a link to Home asks; isPageOfApp with a basename.
  • ShellPageActions-36111.test.tsx: in the edit posture 「Edit app」 is a button (not a link) that enters the mode and is hidden while it is on; a member sees nothing; the read-only eye entry is unchanged.
  • UnifiedSidebar.favoritesMenu-12427.test.tsx: the Favorites section is hidden in design mode and back after.
  • unsavedEdits-13231.test.tsx: the keeps option skips only the registrations that keep the URL.
  • consoleTopBar.height-12639.test.ts: the two source pins admit the design mode's arm (same slot, same 48 px; the sidebar below it on desktop).
Readings at d78b61b
  • The touched test files: 57/57 passed; consoleTopBar.height-12639: 12/12 passed.
  • Related-test sweep (every test file naming ConsoleLayout, UnifiedSidebar, ShellPageActions, unsavedEdits or designMode, 184 files in 4 batches): 1,654 passed; the 2 reds (the top-bar source pins above) fixed in d78b61b and re-run green.
  • Ablation (the keeps check disabled in unsavedEdits.ts): 3 tests red; restored, git status clean.
  • turbo type-check for @object-ui/app-shell and @object-ui/i18n: 70/70 tasks green. pnpm build: exit 0.
  • dispatch-gates.mjs --commands derived 41 gates, all exit 0; --ran reconciliation: 41 derived, 41 run, 0 not measured.
  • overlap-check.mjs: origin/main and 8 open PRs sharing files (fix(app-shell): ⌘B / Ctrl+B does what the sidebar's expand / collapse button does #36391 shares ConsoleLayout.tsx and UnifiedSidebar.tsx; the rest share locale files) all merge cleanly.

Acceptance notes

Verification

Live run against a fresh local backend and the console (Vite), signed in as the seeded admin, on an app in a newly created writable package, at 1280 px and 1440 px: 「Edit app」 is shown in the page header; pressing it draws the bar (Design modeCancelSave, 「Save」 off), the sidebar moves below it; moving to another page of the app keeps the bar; 「Cancel」 removes it and 「Edit app」 comes back. Screenshots of both states at both widths are in the project files at repo-objectstack-7/shots/36362/ (before-1280.png, before-1440.png, design-1280.png, design-1440.png).

The card's 「PR 正文附截图」 is met by those files: a cloud container cannot upload images to the PR.

Two minutes: as a workspace admin, open an app in a package you created in Studio, press 「Edit app」 in the page header: the blue bar appears with 「Cancel」 and a disabled 「Save」; open another page from the sidebar: the bar stays; press 「Cancel」: the bar goes and 「Edit app」 is back. Open an installed app: the header still offers 「Open APP in Studio」.

🤖 Generated with Claude Code

…6362)

The shell holds the app's design mode: a bar with Design mode, Cancel
and Save across the top, kept from page to page of the app, with an
extension point surfaces stage their changes through.

Claude-Session: https://claude.ai/code/session_01QsR2jSr8sNCnJrK6Q9kEF5
Co-authored-by: Claude <noreply@anthropic.com>
The design mode draws its bar in the same AppShell slot as AppHeader and
keeps the sidebar below it on desktop; the source pins follow.

Claude-Session: https://claude.ai/code/session_01QsR2jSr8sNCnJrK6Q9kEF5
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/l documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 22, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jSpi3g1dQNTvN6zEuH

席位核对

L1 (L1-e) on head d78b61b961194a1cc58e3738bccf3b3d363931c6, card #36362: ACCEPT.

Checklist

  • Shape and card (l1-face.mjs --pr 36397, CLEAN, 13 items): open, draft, base main; first line Fixes #36362, no closing keyword near another card. Fixes is right: the card asks only for the mode shell and the extension point (要做的 7), and this PR delivers items 1 to 7. The newest Claim: (7076713389) names this branch.
  • Scope: 23 files, all in ui/packages/app-shell/src/{layout,chrome} and ui/packages/i18n/src/locales, inside the claim's file surface. No content/docs/releases/ path. No one-off script in the diff.
  • Changeset: .changeset/36362-runtime-design-mode.md. @object-ui/i18n is published and gains 3 keys (designMode.title, .leaveUnsaved, .saveFailed), so patch with Clause-②: yes (widening) holds. @object-ui/app-shell is private: true, so its entry ships nothing. I checked each sentence of the changeset against the diff: the gate (useAppStudioEntry edit posture, unchanged), the bar's three items, kept across pages / off on another app / never on a phone, Favorites hidden, Save off when nothing is staged, the ask on tab close / link out / app switcher but not on an in-app link, and the read-only eye entry unchanged. All of it is true of the code.
  • Gates at this head: 45 success, 13 expected skip, 0 failed, 0 pending. Lint & Repo Gates and TypeScript Type Check are success. dogfood is not owed (no !, no narrowing arm).

Spot checks

  • designMode.tsx, the save loop: it commits over a snapshot, in insertion order. A throw toasts designMode.saveFailed, returns false and leaves the failed change and every later one staged, with the mode on. A change re-staged while its commit was in flight stays staged (the identity check before the delete). The mode goes OFF only when nothing is left. On a change of app, the reset happens during render (setHeld(OFF)), so the previous app's staged changes are dropped. The app switcher still asks first, because the keeps check for another app is false.
  • unsavedEdits.ts: keeps narrows only the click guard (latestMessage(url) skips a keeping registration). beforeunload still fires on any registration (registrations.size), and confirmUnsavedLeave still calls latestMessage() with no url, so every registration still asks. The old signature is still accepted (the option is optional).
  • isPageOfApp: the prefix comes from the address on screen, so a basename counts, and /apps/crm2/… is not a page of /apps/crm.
  • ShellPageActions.tsx: the view posture (read-only package) returns before the new branch, so the eye entry is unchanged. A member gets no entry. 「Edit app」 is hidden while the mode is on.
  • Tests: designMode-36362.test.tsx has 13 cases, covering each card item and the acceptance lines (a failed commit, another app, a phone, beforeunload, in-app versus out-of-app links). The ablation in the body (keeps disabled → 3 tests red) is a positive control for the new guard. The new i18n keys are present in all 11 locales; common.cancel and common.save already exist.
  • The screenshots in shots/36362 (before/design at 1280 and 1440) show the bar with exactly 「Design mode」 「Cancel」 「Save」 (Save greyed), on one line, with the sidebar below it and the page header uncovered. 「Edit app」 is shown in the before state.
  • SQL push-down: not applicable (a UI-only diff, no data reads added).

Deviations / owed before ready

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC

Contract review

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

① Derived judgments

Read: card #36362 (body + all 4 comments: notice, claim, triage, os-dev-report), PR #36397 body and its 23-file list, the net diff origin/main...d78b61b961, and the 58 check-runs on the head (45 success, 13 skipped, 0 failing; Check Changeset, Type Check UI, Test UI 1-16, Lint UI, Lint · PM dispatch-gates all success).

  • @object-ui/i18n gains 3 keys — right. designMode.title, designMode.leaveUnsaved, designMode.saveFailed are added to all 10 hand-written locales (ar, de, en, es, fr, ja, ko, pt-BR, ru, zh-Hans), plus zh-Hant (header: generated from zh-Hans.ts) carrying the converted strings. The package is published (no private; files ships dist, CHANGELOG.md), so this is a real widening of the shipped catalogue and of the exported TranslationKeys = typeof en (ui/packages/i18n/src/locales/en.ts:6569). It is the same additive shape as every key addition (precedent .changeset/33865-package-create-toast.md, same two packages, patch). The changeset body names all three keys. common.cancel/common.save, used by the bar, already exist on main.
  • @object-ui/app-shell adds no package-level public surface — right, and the PR/changeset describe it so. useDesignModeChange, useDesignMode, useDesignModeActive, useDesignModeController, DesignModeProvider, isPageOfApp, DesignModeChange, DesignModeValue (ui/packages/app-shell/src/layout/designMode.tsx:53-237), UnsavedEditsOptions and the new optional options.keeps on registerUnsavedEdits (ui/packages/app-shell/src/chrome/unsavedEdits.ts:71, :155) are module exports only. None is re-exported from src/index.ts, layout/index.ts or chrome/index.ts. The entry still exports only useRegisterUnsavedEdits and confirmUnsavedLeave (src/index.ts:199), with signatures unchanged. The package is private: true besides, so nothing reaches npm. The extension point is internal to app-shell, which fits card item 7 (later cards in the same package stage through it), and the changeset claims no app-shell exports. keeps is optional and per-registration. latestMessage() with no url still asks for every registration, so confirmUnsavedLeave and beforeunload are unchanged for existing callers: widening only.
  • No accept-set change. No packages/spec path, schema, metadata key or governed path is in the diff; Metadata-protocol: none holds.
  • The user-visible change ships through @object-ui/console, which takes app-shell as a devDependency and bundles it, and which the changeset does not name. Nothing is lost: console is in the same fixed group as @object-ui/i18n, so it bumps with it, and its files ships no CHANGELOG.md. Precedent 33865 has the same shape. Not a finding.

② Semver level

'@object-ui/app-shell': patch and '@object-ui/i18n': patch are right. Per AGENTS.md Post-Task Checklist step 3, the level follows the Metadata-protocol kind: none takes patch, and a non-protocol widening ships patch. Clause-②: yes (widening) is right: the diff widens a published package's surface (the i18n catalogue and TranslationKeys). The line is carried at line start in both the PR body and the changeset body, beside Metadata-protocol: none, and both agree with each other and with the claim's declaration. Listing the private app-shell is allowed (privatePackages.version: true, app-shell not in fixed) and has precedent. No major and no BREAKING banner, and none is owed. Check Changeset is success.

③ Boundary flags

  • open_questions: empty; nothing to answer.
  • out_of_scope_findings (reach): showcase and installed read-only apps keep the eye entry and do not enter the mode. This matches the card ("现有的显示条件不放宽"). Whether installed apps should enter the mode for menu editing is routed to 设计模式(二)菜单编辑:添加已有的菜单项,上移下移、移到分组、移除、改名和图标 #36363's PR, and the claim and the PR body both send it to the seat. Carried, not escalated here.
  • Card acceptance, on the declaration face: "直接输入带模式参数的地址也进不了模式" holds by construction (the mode has no address, designMode.tsx module doc). Who may enter is unchanged (useAppStudioEntry edit posture). The mode is off on a phone (enabled: !phone). The card's "没有核对的" items (the edit-app/:editAppName route, whether others see a save live) are untouched by this PR, and nothing here depends on them.
  • SQL push-down: n/a. No data access, no id materialisation and no join in the diff. The extension point stores opaque commit closures, and this PR stages none.

Implemented-by: claude/project-thread-iqvhau
Reviewed-by: session_01QsR2jSpi3g1dQNTvN6zEuH

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · zhuangjianguo · session_01QsR2jTeURPvEm465RcoYEC

Landing (seat 7, 2026-11-22T10:23Z): head d78b61b961194a1cc58e3738bccf3b3d363931c6 · L1 ACCEPT 7077726985 (L1-e) · L2 PASS 7077747162 (TIER_DEFAULT, declaration face, no must-fix or should-fix) · check-governed-merges --pr 36397: NOT governed · CI on the head: all success or skipped. → pr_ready + automerge_enable (merge queue). The card's 「PR 正文附截图」 is met by the project-file screenshots the body names (a cloud container cannot upload images to a PR). Chain: #36363 opens from main after this merges; installed apps entering the mode change the ADR-0146 D5 eye entry, which rides the weekly ADR card #36086.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 22, 2026 10:24
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 22, 2026
Merged via the queue into main with commit ff60149 Nov 22, 2026
63 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-iqvhau branch November 22, 2026 10:44
247257110 pushed a commit to 247257110/objectstack that referenced this pull request Nov 22, 2026
…lters a card does not follow (objectstack-ai#36405)

<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9UbbCxiFE11rsKwyNffJZKYqJs)_

repo:objectstack#7 · zhuangjianguo · session_01QsR2jUeSU9HhKxjcVsyprx

Fixes objectstack-ai#36372

Clause-②: yes (widening) — one new exported core function
(`dashboardFiltersNotApplied`), two new optional `DashboardRenderer`
props (`onWidgetResize`, `onAddFilter`), and new `@object-ui/i18n` keys
(`dashboard.inPageEdit.*`, `dashboard.filters.notApplied`,
`dashboard.filters.addFilter`); nothing removed or renamed
Metadata-protocol: none

## 维护者速读
-
是什么:系统管理员在仪表盘页面上点「编辑」就能直接改:拖动和拉伸卡片、点卡片在右侧改属性、添加和删除卡片、添加和修改顶部筛选、设置每张卡片是否跟随页面筛选。「保存」后所有人立刻看到,不需要发布应用包;「放弃」丢掉全部改动。
- 为什么:以前改仪表盘必须进入工作室,管理员在看数据时发现问题要绕一大圈;现在在哪里看就在哪里改。
-
对已安装的应用:改动写进该应用的定制层(和工作室的「定制」写同一处),升级应用不会覆盖。点「编辑」本身什么都不写,定制层在第一次「保存」时才创建,所以「编辑」后「放弃」不留下任何东西。工作室不让定制的情况(本部署只有平台运营方能定制已安装应用、软件包列表没给出版本),页面也不进入编辑,并说明原因;如果工作室里已有这张仪表盘未发布的草稿,页面会提示先去工作室处理,不会替别人发布。
-
另外:每张卡片都会显示一个小标记,写明它不跟随哪些页面筛选(例如「不跟随『区域』筛选」),标记和卡片实际查到的数据用的是同一条判断,不会对不上。

## What changes

**Edit state on the dashboard page** (`DashboardView` + new
`DashboardInPageEditor.tsx`). A workspace admin who may author metadata,
on a package Studio lists (`useStudioEntryGate`, the gate of the app →
Studio entries; writable or read-only, never a kernel package), gets an
**Edit** button in the page header (from `sm` up: the edit state needs
its side panel). Edit opens the dashboard **as stored** — the layered
read's `effective` in the package a save would land in (a customization
pair that is not listed yet, or does not hold it yet, opens its base's)
— never the served, translated copy. **Opening writes nothing**: it
reads the package list and the item only. In the edit state:

- the header shows an **Editing** badge, the hint "Saved changes apply
to everyone at once", and **Add card**, **Discard**, **Save** (Save is
off until something changes);
- every card draws dashed and is in the renderer's design mode: drag to
move (the existing dnd-kit reorder), click to select, and a new corner
handle resizes it by whole grid tracks;
- the right panel is Studio's own dashboard panels, unchanged:
`DashboardWidgetInspector` for a selected card (its data, the "follow
page filters" switches, Remove) and `DashboardDefaultInspector`
otherwise (label, cards, filters, layout);
- **Add card** appends a card at the end (Studio's id and defaults) and
selects it; **Add filter**, drawn at the end of the filter bar, opens
the panel's Filters section.

**Save** (`saveDashboardInPlace`) is the confirmed-save door of objectstack-ai#35955
(ruling 7058616478): the body is staged as the item's draft under the
first-write pin and that one item is published in the same act — no
package-wide publish-drafts. Where it lands is read at open by
`resolveDashboardEditTarget` (package list only): the owning package
when the list carries it writable, else the app's customization package,
whose id is taken from the list when it is already listed
(`listedCustomizationPairOf`, the read Studio makes of a pair). At Save,
and only there, `ensureDashboardSaveTarget` asks the ensure door for the
pair (it creates `<base>.custom` on first use, as Studio's first saved
customization does), and the body declares `overrides: { package,
basedOn }` (`overrideDraftBody`, the body Studio's Customize writes;
ADR-0146 D2/D3). So an installed app's dashboard is edited too, through
the same doors Studio uses. The edit state is refused up front where
Studio's Customize is: the ensure door walled for this caller
(`useCustomizeDoorWalled`, toast "only the platform operator can
customize an installed app's dashboard") and a base listing no version
to declare the override at when the item declares none yet (Studio's
`noVersion`). Over a draft already pending there, the edit state is not
entered, and a save that races one writes nothing (`'pending-draft'`): a
Studio draft is never published on its saver's behalf. **Discard** drops
the buffer and writes nothing. After a save the bundle re-read keeps the
shown dashboard standing, so the page does not flash its skeleton. The
edit state draws the stored document with the served `_packageId` beside
it, so its cards' dataset queries keep naming the dashboard's package
(`callerPackage`, ADR-0150 D3) as in view mode; a save drops `_` keys.

**The not-filtered mark** (`plugin-dashboard`). Every card, in every
mode, names the page filters that do not reach it ("Not filtered by
Region and Owner"; zh 「不跟随『区域和负责人』筛选」): a filter it opts out of
(`filterBindings[name]: false`) or one whose `targetWidgets` leaves it
out (an explicit string binding wins over `targetWidgets`). The built-in
date filter is named as the bar names it ("Date range"), never by its
reserved name. The list is the new core
`dashboardFiltersNotApplied(widget, defs)`, which asks
`resolveBoundField` — the binding `buildWidgetScopedFilter` builds the
card's query from — so the mark and the data cannot disagree. A card
every filter reaches carries none.

**Renderer design mode** gains two opt-in affordances:
`onWidgetResize(widgetId, { w, h })` draws the corner handle (snaps as
the pointer crosses half a track; arrow keys step by one; width clamped
to the grid's columns; not drawn on a phone), and `onAddFilter()` draws
"Add filter" in the filter bar (the bar is drawn for it even before any
filter exists). Studio's canvas passes neither, so it is unchanged.

**Persistence seam.** `saveAndPublishRuntimeMetadata` itself is
unchanged: `saveDashboardInPlace` hands it a client that names the
target package on the three writes it makes (draft, publish, discard of
a refused publish).

Studio is not touched; panel wording is objectstack-ai#36373's (not touched here).

ADR: this realises the in-app half of the ADR-0146 D1 amendment row
"ADR-0146 D1, \"Studio owns all metadata\"" that seat 7 filed on the
weekly ADR card objectstack-ai#36086 (epic objectstack-ai#36359); no `docs/adr` edit here.
Persistence stays on the ADR-0034 runtime metadata seam (draft +
per-item publish through `/meta`).

## Tests

- `ui/packages/core/src/utils/__tests__/dashboard-filters.test.ts` —
`dashboardFiltersNotApplied` agrees with `buildWidgetScopedFilter` for
default, opted-out, rebound, `targetWidgets`-listed and
explicit-over-list widgets.
-
`ui/packages/plugin-dashboard/src/__tests__/DashboardRenderer.filters.test.tsx`
— the mark is on the opted-out card and only it, a rebound card has
none, a `targetWidgets`-excluded card has it, an opted-out built-in date
filter reads "Not filtered by Date range"; each case reads the query's
`runtimeFilter` beside the mark.
-
`ui/packages/plugin-dashboard/src/__tests__/DashboardRenderer.designMode.test.tsx`
— the corner handle only with `onWidgetResize` in design mode, keyboard
resize, no card selection from the handle; "Add filter" only in design
mode, drawn before any filter exists.
- `ui/packages/plugin-dashboard/src/designAffordances.test.ts` —
`resizedSpan` snapping and clamps.
- `ui/packages/app-shell/src/views/runtime-metadata-persistence.test.ts`
— edit target read from the list only (writable package; read-only
package with no pair listed: none named, ensure not called; a listed
pair named for reading; unbound; refusal), the ensure door asked at save
(pair with `basedOn`; refusal and non-writable pair throw), the save
body, the target package named on draft/publish/discard, pending-draft
writes nothing.
- `ui/packages/app-shell/src/views/DashboardInPageEditor.test.ts` —
opening (owner's layered `effective`; an installed app with no pair yet
opens its base's reading no pair and with no ensure door at all; a
listed pair that does not hold it opens its base's; refused when walled
and when no version is listed, but not for an item that already declares
its override; refused over a pending draft without reading; refusals),
add card, resize keeps unnamed coordinates.
-
`ui/packages/app-shell/src/views/DashboardView.inPageEdit-36372.test.tsx`
— through the real `DashboardView` and renderer: no Edit button behind
the gate; Edit opens the stored document in design mode with badge and
panel; resize + Save stages and publishes in the owning package and
leaves the edit state; an installed package asks the ensure door at Save
only and saves into `crm.custom` declaring the override; **Edit then
Discard on an installed app calls the ensure door zero times and writes
nothing**; a walled door refuses with its reason; a dataset card in the
edit state still queries with `callerPackage` (ablated: red without the
fix); a pending draft refuses; Discard writes nothing.

## Acceptance notes

**Live run** (L1-e's REWORK) on head `f0750e0dd`: a fresh local showcase
backend (`objectstack dev --seed-admin`, file DB) and the console from
source (`ui/apps/console` Vite against it), driven by Playwright as the
seeded admin. The writable leg uses a package created over REST
(`com.example.livedash`, depending on `com.example.showcase`) holding an
app and a four-card dashboard with one card opted out of the date range;
the installed leg uses showcase's own `showcase_ops_dashboard`
(`com.example.showcase`, listed read-only, version 0.1.0).

| Acceptance | Reading |
|---|---|
| Writable: drag, widen, add, delete, Save | Dragged "Priority Mix" to
the front, widened "Tasks all time" by its corner (192 → 400 px, `w` 3 →
6), added a Metric card (given its dataset and measure in the panel;
Save without them is refused by the server, 422 `widgets.N.dataset`,
shown in the "could not be saved" toast with that reason), removed
"Tasks by Status" through the panel. Writes on **Edit**: none. Writes on
**Save**: exactly `PUT
/api/v1/meta/dashboard/livedash_board?mode=draft&package=com.example.livedash`
(200, `state=draft`) then `POST
…/livedash_board/publish?package=com.example.livedash` (200). No
`/packages/:id/publish-drafts`. |
| After a reload the layout holds | The served dashboard reads
`w_priority, w_tasks, w_all_time (w 6), widget_1`; the page draws that
order, the widened card, the added "Open tasks (added live)" and no
"Tasks by Status". |
| Installed app: Edit then Discard | Writes on Edit: none; package list
before and after Edit → change → Discard: `["com.example.showcase"]` (no
`.custom` created); the page shows the original titles. |
| Installed app: Save lands in `<base>.custom` | Writes on Save: `POST
/api/v1/packages/com.example.showcase/ensure-customization`, `PUT
…/showcase_ops_dashboard?mode=draft&package=com.example.showcase.custom`
with `overrides: { package: "com.example.showcase", basedOn: "0.1.0" }`
(server: "Saved customization overlay"), `POST
…/publish?package=com.example.showcase.custom`. After a reload the page
shows "Total Budget (customized live)". Studio's Interfaces
(`/studio/com.example.showcase/interfaces?surface=dashboard:showcase_ops_dashboard`)
shows the same title, the "Overrides ObjectStack Showcase" badge and
"Only customizations (1)". |
| Discard after a change | Covered in the installed leg above: the page
is as before and nothing is written. |
| Mark on an opted-out time-filter card | "Tasks all time"
(`filterBindings: { dateRange: false }`) reads "Not filtered by Date
range"; no other card is marked. Last 90 days: follows 10, all-time 10;
Yesterday: follows 1, all-time **10** (unchanged). |
| Its switch turned on and saved | The panel's dateRange "Apply"
checkbox on that card, then Save: the body's card has no
`filterBindings`; draft + per-item publish only. After a reload: no mark
on any card; Yesterday: follows 1, all-time **1** (now follows). |

The live run found two defects, fixed in `f0750e0dd` and pinned: the
mark named the built-in date filter by its reserved name ("dateRange"),
and the edit state's dataset queries dropped `?callerPackage=` (the
stored document carries no `_packageId`).

**Screenshots** (live run, 2× scale) are in the project's shared files,
under `repo-objectstack-7/shots/36372/`; they cannot be uploaded to
GitHub from the cloud seat, as on objectstack-ai#36397. They replace the harness
shots.
- `live-en-edit-writable.png` — edit state on the writable dashboard:
Editing badge, hint, Add card / Discard / Save, dashed cards, the
widened card selected with its panel, the marked card.
- `live-en-view-marked-card.png` — view mode with "Not filtered by Date
range" on the opted-out card, under "Yesterday".
- `live-en-edit-installed.png`, `live-zh-edit-installed.png` — edit
state on the installed showcase dashboard (zh: 「编辑中」「保存后所有人立刻看到」, five
cards marked 「不跟随「Task Status」筛选」).
- `live-en-after-reload-writable.png`,
`live-en-after-reload-installed.png`, `live-en-studio-interfaces.png`,
`live-en-view-after-switch-on.png` — the after-reload and Studio
readings above.

**Known gap** (not in this card): leaving the page in the edit state
with unsaved changes drops them without asking. objectstack-ai#36362's unsaved-edits
seam (`useRegisterUnsavedEdits`) is the place to register it, in a later
card.

Undo, a business user's own copy, a new dashboard, chart drawing and
drill-down are out of scope, per the card.

## Verification

- At `f0750e0dd`: type check `@object-ui/app-shell` and
`@object-ui/plugin-dashboard` green; `packages/plugin-dashboard/src`,
the dashboard view / editor / persistence files, `core`
dashboard-filters and `AppContent.dashboardRouteReads-28784` — 223
files, 2213 tests green; `packages/i18n/src/__tests__` 106 files green;
`check-i18n-en-drift`, `check-i18n-call-site-keys`,
`check-i18n-dead-keys` green. `overlap-check`: clean against main and 7
open PRs (objectstack-ai#36398 included).
- At `3e7995a73` (before this round): `node
scripts/pm/dispatch-gates.mjs --commands`, 72 derived families all run
and accounted (`--ran`); four first-pass reds re-run exit 0
(comment-mask sweep reading a deleted harness file, `vitest run
scripts/` killed for memory, `check:skill-examples` prerequisite,
`check:test-source-alias` fixed in the tests). This round's diff
(app-shell editor, two i18n keys in every locale, the mark's label,
docs) is left to CI's gates.

https://claude.ai/code/session_01QsR2jUeSU9HhKxjcVsyprx

🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- signed: repo:objectstack#7 · zhuangjianguo ·
session_01QsR2jUeSU9HhKxjcVsyprx -->

---------

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/l 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