Repository navigation
Commit 031325d
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
_Requested by **Leehom** · [project
thread](https://claude.ai/code/project/chan_01TenzsRopZj4jMbvjX8uz1X?thread=cmsg_01TenzsRopZj4jMbvjX8uz1X6okWxYPWAsooBsJoAhnT1u)_
repo:objectstack#4 · os-project-manager ·
session_01FEkQ5oK4fFfnLADcipbEeT
Fixes #36112
This is PR B of two for the card: the sidebar's docking model. PR A
(#36187) moved everything off the desktop top bar.
Clause-②: no
Metadata-protocol: none
Seat claim: [#36112
claim](#36112 (comment)).
Ruling: [F1,
7069868269](#36112 (comment)).
## 维护者速读
- 电脑上打开应用:窗口 1280
宽及以上侧边栏默认展开,更窄默认收起;收起和展开按钮是唯一开关,浏览器按宽窄两边各自记住;「保持侧边栏展开」开关去掉;侧边栏的「最近使用」只列当前应用里的;手机不变。
- 「去掉顶栏、侧栏常驻」这张卡的后一半,按你 11 月 21 日的裁定(1280 起默认展开,更窄才收起)收尾,合并后这张卡关闭。
-
出错时用户看到的是侧边栏开始时的展开或收起不对,点一下按钮就能改回,选择会被记住;只改界面,不动数据,可以直接撤回;以前选过「保持展开」的人在窄窗口上照旧是展开的。
- 无
## Upgrade change and accepted cost
- **Upgrade change (stated as the ruling asks):** on 1280–1415 px
windows, a user who never set 「保持展开」 now starts with the sidebar
expanded (it folded before), unless they had collapsed it on a wide
window.
- **Accepted cost (stated on the card):** on a 1280 px window the list
beside an open record drawer is 304 px wide (560 today), and on
1280–1415 px with the sidebar expanded, opening the comment panel
returns the record page's fields to the tab row; collapsing the sidebar
restores the three columns. The 304 / 560 figures are pinned in
`consoleSidebarRail.width-27593.test.tsx` against the primitive's
sidebar width and plugin-view's drawer width.
## What changes
`@object-ui/app-shell`
- `layout/consoleSidebarRail.ts`
- `CONSOLE_SIDEBAR_RAIL_BELOW_WIDTH` is `1280`, one constant, no longer
derived (`RECORD_DRAWER_MIN_CONTENT_WIDTH` removed; the drawer and list
constants stay, to state the accepted cost).
- The narrow-window choice is `CONSOLE_SIDEBAR_NARROW_OPEN_PREFERENCE`
(was `CONSOLE_SIDEBAR_KEEP_OPEN_PREFERENCE`), stored under the same name
`console.sidebar.keepOpen`, so an existing `on` reads as "expanded on
narrow" with no migration. The wide-window choice keeps its key
(`os:console-sidebar:wide-open`). Wide and narrow stay stored
separately.
- New `startingSidebarOpen(wide)`: the reader's choice for that side,
else expanded on wide and collapsed on narrow. `primeConsoleSidebarOpen`
writes it into the primitive's cookie before the first frame;
`seedWideWindowOpen` is gone (with an explicit wide default it has
nothing to seed).
- `useConsoleSidebarRail` answers `narrowOpen` / `setNarrowOpen` instead
of `keepOpen` / `setKeepOpen`; `railMode` is "narrow and collapsed by
the narrow choice".
- `useConsoleSidebarRailPanel`: `keepOpenControl`, `dock` / `undock` and
the `'dock'` closer are removed. While the sidebar is hidden, a press on
a sidebar trigger (the page header's expand button, or the corner
fallback) now docks it: on a narrow window the capture phase sets the
narrow choice to expanded before the provider's toggle opens it, so the
open is not a float. ⌘B still floats the menu over a collapsed sidebar
(unchanged), and so does the left edge.
- `hooks/useResponsiveSidebar.ts`: gives a window its starting state on
load and when it crosses 1280 px or the phone breakpoint; keeps an
open/close on a wide window as the wide choice (only on a change, so a
default is never recorded as a choice), and a close of the docked
sidebar on a narrow window as the narrow choice; a narrow choice turned
collapsed (this tab or another) collapses an open sidebar. Public
signature unchanged.
- `layout/UnifiedSidebar.tsx`: the 「保持侧边栏展开」 footer row is gone (the
foot holds only the account menu). From 768 px up the Recent group lists
only entries whose address names the current app (resolved by
`matchAppBySegment`, as Home resolves a recent row's app); the phone
drawer is unchanged.
`@object-ui/i18n`: `sidebar.keepOpen` removed from all 11 packs (zh-Hant
regenerated with `gen:zh-hant`).
Text that named 1416 (the ruling's list, plus one more found by grep):
- `ui/packages/plugin-detail/src/synth/recordPageColumns.ts` comment
(also corrected: it still described the retired 48 px icon rail).
Comment only, no bump for plugin-detail.
- `docs/qa/platform-checklist/areas/platform-core.json`
`platform-core.builtin-apps-nav-render` steps[2], revision 17 → 18 with
a history row.
- `examples/app-showcase/e2e/detail-shapes.spec.ts`: its comment cited
1416 and the case docked the sidebar with the retired "Keep sidebar
open"; it now docks with the page header's expand button.
## Tests
New (card-named):
- `layout/__tests__/consoleSidebarRail.docking-36112.test.tsx`:
threshold 1280; first frame at 1279 collapsed and 1280 expanded whatever
the cookie, 768 / 1920 edges, phone keeps the cookie; the mounted layout
at 1279 → 1280; a stored choice beats the default on each side and the
two sides stay apart; a raw legacy `os:pref:console.sidebar.keepOpen`
record `{"value":"on","v":1}` reads as expanded on a narrow window.
- `layout/__tests__/UnifiedSidebar.recentThisApp-36112.test.tsx`: Recent
lists only this app's entries (other app, Setup, Studio item left out),
its five are this app's newest five, no group when this app has none,
and the phone drawer still lists every app's.
Rewritten (they encoded 1416 or the keep-open switch):
- `hooks/__tests__/useResponsiveSidebar.test.tsx`: defaults at 1279 /
1280, no choice recorded by a default, each side's state across the
threshold, wide collapse kept, narrow close kept as the narrow choice, a
narrow choice turned collapsed elsewhere, phone untouched.
- `layout/__tests__/ConsoleLayout.sidebarFirstFrame-28077.test.tsx`:
1280 → 1279 for the collapsed first frame; new cases for 1280 expanded
against a collapsed cookie, a wide collapse, and a narrow expand.
- `layout/__tests__/consoleSidebarRail.width-27593.test.tsx`: no longer
pins the derived 1416; pins 1280, the 256 px width (F2) and the 304 /
560 cost.
- `layout/__tests__/UnifiedSidebar.hiddenCollapse-35062.test.tsx`:
narrow width 1280 → 1024; the trigger-floats cases now float with ⌘B;
the "Keep sidebar open" cases are replaced by "the expand button docks
(wide and narrow), a reload keeps it, the collapse button takes it
back", the legacy keep-open read, and "the expand button docks even when
React renders between the capture phase and the trigger's handler" (the
old render-between case, now for the dock).
- `layout/__tests__/UnifiedSidebar.railOverlay-27593.test.tsx`: 1280 /
1360 → 1024; floats with ⌘B; the three "Keep sidebar open" cases and the
Esc-on-keep-open case are replaced by the expand-button dock and the
narrow/wide choices kept apart (objectstack#28079).
- `examples/app-showcase/e2e/detail-shapes.spec.ts` (see above).
Retired: none as a file. The removed cases are the ones that drove the
retired control; each behaviour they pinned that still exists (float,
Esc, focus, fold on navigation, choices kept apart) is pinned in the
rewritten files above.
<details><summary>Local runs (head ce00125)</summary>
All at head `ce00125fc`, under the shared verify lock unless marked
lock-free.
- `pnpm --filter @object-ui/app-shell type-check && pnpm --filter
@object-ui/i18n test && vitest run` the seven changed or new app-shell
test files: VERDICT command-exit 0; i18n `Test Files 105 passed (105)`,
`Tests 1962 passed | 13 skipped`; app-shell `Test Files 7 passed (7)`,
`Tests 71 passed (71)`.
- Earlier, at `114ccd7a7` (source identical to the head; the last commit
adds one import line to a test): `vitest run` app-shell `layout`,
`hooks`, `chrome`: `Test Files 279 passed (279)`, `Tests 2217 passed
(2217)`.
- Derived gate families (`dispatch-gates.mjs`, 65 derived, `--ran`
reconciliation: 65 run, 0 unrun): 62 lock-free families re-run at the
head, exit 0 each; `check:type-check-debt` exit 0 under the lock;
`vitest run scripts/` under `ui/` exit 0 under the lock (the lock-free
attempt was SIGKILLed by the box's memory limit, not a red);
`check:test-source-alias` red on the first run, fixed by `ce00125fc` and
green since.
- NOT MEASURED: `check:dual-build-cjs-loads` exit 3, PREREQUISITE NOT
MET (needs a full `pnpm build` of 36 framework packages this PR does not
touch); CI runs it.
- Declared to CI: `test:repo` and the full lint farm.
</details>
<details><summary>Ablations (one per leg; each mutation committed-first,
landed on disk by `scripts/ablation-replace.mjs`, restored to HEAD and
proven by blob hash)</summary>
Six legs, one lock hold (VERDICT command-exit 0), at head `ce00125fc`.
Each leg red, each restored with `git diff HEAD` empty and the file's
blob equal to HEAD's.
| Leg | Mutation | Suite | Result |
|:---|:---|:---|:---|
| L1 | threshold 1280 back to 1416 | `consoleSidebarRail.docking-36112`
| 4 failed / 8 |
| L2 | the narrow choice (legacy keep-open) read always false |
`consoleSidebarRail.docking-36112` | 2 failed / 8 |
| L3 | the expand press no longer sets the narrow choice |
`UnifiedSidebar.hiddenCollapse-35062` | 2 failed / 20 |
| L4 | Recent filter removed | `UnifiedSidebar.recentThisApp-36112` | 3
failed / 4 |
| L5 | Recent filter applied on the phone too |
`UnifiedSidebar.recentThisApp-36112` | 1 failed / 4 |
| L6 | a narrow-window close no longer kept | `useResponsiveSidebar` | 1
failed / 7 |
The suites import the edited modules by relative path (source), so no
build sits between the mutation and the run.
</details>
## Acceptance notes
Card acceptance, walked against main after PR A (a5a5312) and this
branch:
| Card acceptance line | Met by |
|:---|:---|
| Desktop app page: no top bar; sidebar on the left, content beside it,
not covered | PR A (no top bar); this PR (docked by default from 1280
px; below it collapsed by default, as ruled) |
| Collapse: sidebar disappears, content widens, expand button top-left;
left edge slides it out; still collapsed after refresh | PR A (collapse,
expand button, edge); this PR (the expand button docks instead of
floating; the choice is kept on both sides of 1280) |
| App name opens only the app list (search when many) and 「添加应用」; Setup
for admins only; switching works | PR A |
| Sidebar search works, shortcut works | PR A |
| Avatar at the bottom; its menu has switch organization and sign out |
PR A |
| Bell beside search; panel and count as before | PR A |
| Impersonation banner at the content top, exit works; lost-connection
notice | PR A |
| List, record, dashboard, report, custom page all carry the
page-actions group | #36111 and PR A (always on) |
| Phone width unchanged | PR A; this PR leaves the phone drawer's Recent
unfiltered and the phone sidebar state untouched |
| Setup and Account use the new shell, menus unchanged | PR A |
| Onboarding walks through | PR A (the walkthrough component renders
nothing on main; no step points at the top bar) |
| PR body: before/after desktop screenshots (expanded, collapsed, app
menu, banner) and the changed components and rewritten tests | this PR
(before/after shots at 1440, 1280 and 1279 (expanded, collapsed, app
menu open, the 1279 expand press, and a reload after it), saved with the
seat's evidence; the banner was not shot, see Acceptance notes;
components and tests above) |
| Item 2: 「保持侧边栏展开」 removed | this PR |
| Item 5: Recent lists this app's items | this PR |
The PR A rows are read from PR A's body and main's code, not re-driven
here except where the screenshots show them.
Browser evidence (showcase booted on a private port, console served by
Vite from this branch; the before set from the same server with the
three sidebar files and the English pack swapped back to the merge base,
then restored to HEAD and checked by blob hash):
- Fresh profile, 1440 px: expanded, before and after. 1280 px: collapsed
before, expanded after.
- 1279 px: collapsed on load in both. Pressing the expand button:
before, the menu floats over the page with the 「Keep sidebar open」 row
at its foot, and a reload brings back the collapsed state; after, the
sidebar docks beside the page (content reflows), and a reload keeps it
docked.
- App menu open at 1440: same in both (Showcase, Setup, Add app).
- The impersonation banner was not shot: it needs a second user to
impersonate on a fresh database, and its surface is PR A's and is not
changed here.
- Recent was not shot: a fresh profile has no recent items; the filter
is pinned by `UnifiedSidebar.recentThisApp-36112` and its ablations L4
and L5.
Reading taken where the ruling is literal, carried as an open question
in the report:
- The expand button's tooltip names ⌘B (it draws the chord the sidebar
primitive answers to), but with ⌘B kept unchanged as ruled, ⌘B over a
collapsed sidebar floats the menu while a press on the button docks it.
Before this PR both floated. Either ⌘B docks too, or the tooltip stops
naming it; this PR does neither and leaves it to the seat.
Out of scope, noted not filed: none.
Overlap: `overlap-check.mjs` exit 1 against #34223 (a draft from
2026-11-19 that already conflicts with main on another file) in
`docs/qa/platform-checklist/areas/platform-core.json`; not merged
around, per the order. #36234 and #36208 share the i18n packs and merge
cleanly.
## Verification
Read first (riskiest first):
1. `ui/packages/app-shell/src/layout/consoleSidebarRail.ts`, the capture
listener in `useConsoleSidebarRailPanel` (expand docks; ⌘B floats) and
`startingSidebarOpen`.
2. `ui/packages/app-shell/src/hooks/useResponsiveSidebar.ts`, the layout
effect (which transitions write which choice).
3. `ui/packages/app-shell/src/layout/UnifiedSidebar.tsx`, the
`recentItems` filter.
Two-minute check: in a fresh browser profile open any app at a 1280 px
window: the sidebar is expanded beside the page. Resize to 1279 px: it
collapses and the page header shows the expand button; press it: the
sidebar docks, and a reload keeps it docked.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5oK4fFfnLADcipbEeT)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01FEkQ5oK4fFfnLADcipbEeT
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent d33bf5a commit 031325d
25 files changed
Lines changed: 843 additions & 576 deletions
File tree
- .changeset
- docs/qa/platform-checklist/areas
- examples/app-showcase/e2e
- ui/packages
- app-shell/src
- hooks
- __tests__
- layout
- __tests__
- i18n/src/locales
- plugin-detail/src/synth
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
640 | 640 | | |
641 | 641 | | |
642 | 642 | | |
643 | | - | |
| 643 | + | |
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
| |||
662 | 662 | | |
663 | 663 | | |
664 | 664 | | |
665 | | - | |
| 665 | + | |
666 | 666 | | |
667 | 667 | | |
668 | 668 | | |
| |||
822 | 822 | | |
823 | 823 | | |
824 | 824 | | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
825 | 831 | | |
826 | 832 | | |
827 | 833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
200 | 198 | | |
201 | 199 | | |
202 | | - | |
203 | | - | |
204 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
205 | 203 | | |
206 | 204 | | |
207 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
18 | | - | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
87 | | - | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | | - | |
| 102 | + | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
103 | | - | |
| 106 | + | |
104 | 107 | | |
105 | | - | |
106 | 108 | | |
107 | | - | |
| 109 | + | |
108 | 110 | | |
109 | | - | |
110 | 111 | | |
111 | 112 | | |
112 | | - | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| 117 | + | |
116 | 118 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 119 | + | |
| 120 | + | |
123 | 121 | | |
124 | 122 | | |
125 | 123 | | |
126 | 124 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
134 | 128 | | |
135 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
136 | 135 | | |
137 | 136 | | |
138 | | - | |
139 | | - | |
140 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
141 | 140 | | |
142 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
143 | 146 | | |
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| 152 | + | |
149 | 153 | | |
150 | 154 | | |
0 commit comments