Skip to content

Commit 42b4060

Browse files
fix(app-shell): rename designModeMenu.ts so no layout file differs from DesignModeMenu.tsx only in case (#36604)
<!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi92ncfFpPUpTD8314otX5oaG)_ Fixes #36589 Clause-②: no Metadata-protocol: none ## 维护者速读 - 在 Mac 上自己构建的开发者:以前应用壳构建报错、点「编辑应用」整页白屏,改后构建通过、能进入设计模式;线上构建本来不受影响,用户无感。 - 属于运行界面设计模式专题,修的是设计模式菜单合并时带进来的文件名冲突。 - 只是把一个辅助文件改了名、改了引用,不改任何功能;出错会是构建或测试直接失败,可以直接撤回。 - 无。 ## What changes `ui/packages/app-shell/src/layout/` held the design-mode menu component `DesignModeMenu.tsx` beside its pure tree helpers `designModeMenu.ts`. On a case-insensitive file system (the macOS default) the sidebar's lazy `import('./DesignModeMenu.js')` tries `.ts` first and lands on the helper module (no default export): TS1149 in the app-shell build, and a white page when 「Edit app」 opens design mode. Renamed with `git mv` (history kept, similarity 100%): | Before | After | |:---|:---| | `layout/designModeMenu.ts` | `layout/designModeMenuModel.ts` | | `layout/__tests__/designModeMenu-36363.test.ts` | `layout/__tests__/designModeMenuModel-36363.test.ts` | Importers updated (one line each): `DesignModeMenu.tsx`, `designModeMenuSave.ts`, `__tests__/designModeMenuModel-36363.test.ts`, `__tests__/designModeMenuSave-36363.test.ts`. No other tracked file names the old module. No behaviour change. Changeset: `.changeset/36589-design-menu-casing.md` (`@object-ui/app-shell` patch). ### Repository scan: entries in one directory that differ only in letter case Over `git ls-files` (every tracked path, 27245 files), per directory, three comparisons, all case-insensitive: - **A**: full entry names (files and directories); - **B**: module names, the file name minus its last extension (`./X.js` resolves to `x.ts` or `X.tsx`, so `foo.ts` / `Foo.tsx` is a pair); - **C**: a file's module name against a sibling directory name. | Tree | A | B | C | |:---|:---|:---|:---| | `origin/main` c0eecb1 | 0 | 2: `layout/` `DesignModeMenu.tsx` / `designModeMenu.ts`; `layout/__tests__/` `DesignModeMenu-36363.test.tsx` / `designModeMenu-36363.test.ts` | 0 | | this branch d097435 | 0 | 0 | 0 | Nothing outside `ui/packages/app-shell/src/layout/` was found, so nothing else is renamed. The scan was a one-off script, not a committed gate (see Acceptance notes). ## Tests - `pnpm --filter @object-ui/app-shell run type-check` (both programs, `tsconfig.json` and `tsconfig.test.json`) and `pnpm --filter @object-ui/app-shell run build` (tsc + `check-dist-completeness`): pass, after building the dependency closure (`turbo run build --filter='@object-ui/app-shell^...'`, 68/68). `dist/layout/` now holds `DesignModeMenu.js` and `designModeMenuModel.js`, no `designModeMenu.js`. - The three 36363 suites that import the renamed module or the component, unchanged apart from the import line: `Test Files 3 passed (3)`, `Tests 62 passed (62)`. - Derived gate families at head `d097435bd1` (`dispatch-gates.mjs --commands`, 38 commands): each run with stdin closed, 38 × exit 0; `dispatch-gates.mjs --ran` reads `38 derived, 38 run, 0 NOT-MEASURED, 0 UNRUN`. <details><summary>Gate notes</summary> - `pnpm --dir ui exec vitest run scripts/`: the first run was killed by the container's memory cgroup (an OOM-kill of the vitest node process at about 10.8 GB RSS on a shared box), so it is not a test verdict. It was re-run with `--maxWorkers=2` and a 4 GB heap: `Test Files 172 passed | 2 skipped (174)`, `Tests 5127 passed | 2 skipped (5129)`. - `scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0` (against `origin/main` c0eecb1; no open PR shares a file). - The whole app-shell suite was not run locally. Only the three suites that import the renamed files were run; `Test UI` in CI runs the rest. </details> ## Acceptance notes - **macOS: NOT MEASURED.** This container is Linux on a case-sensitive file system. Substitute reading: TypeScript's own `resolveModuleName` (bundler resolution, the package's setting) run from `UnifiedSidebar.tsx` against each tree with a host whose `fileExists` answers case-insensitively, as the macOS default volume does: - `origin/main`: `./DesignModeMenu.js` resolves to `layout/DesignModeMenu.ts`, which opens `layout/designModeMenu.ts` on disk. This reproduces the card's TS1149 file name, so it is the positive control. - this branch: `./DesignModeMenu.js` resolves to `layout/DesignModeMenu.tsx` (the component). The new `./designModeMenuModel.js` resolves to the helper module. - With scan B at 0 for the whole tree, no relative import anywhere can reach a different file by case alone. The 「Edit app」 white screen is a consequence of the same resolution and was not re-run here either. - **The guard the card asks for is not added.** The card's item 2 is the coordinator's own addition, so the claim allows only strengthening a gate that already reads file names. None exists. Searched: the root `check:*` scripts and `scripts/`, `ui/scripts/check-*.mjs`, `ui/eslint-rules/`, and both ESLint configs. Gates that walk the tracked tree read file *contents* (`check:nul-bytes`, `ui/scripts/check-control-bytes.mjs`). Gates that touch names do so for another question: import reachability (`check-unreferenced-sources`), `vi.mock` specifiers (`check-vi-mock-specifiers`), product words (the product-neutral-renderer ratchet). A case-collision rule in any of them would be a new gate under an old name. TypeScript's `forceConsistentCasingInFileNames` is what reported TS1149 on macOS, but it can only fire on a case-insensitive host, so it never fires in CI. The gap stays open for the seat to decide on: no gate keeps a case-only pair out on Linux. ## Verification - **Read first:** `ui/packages/app-shell/src/layout/DesignModeMenu.tsx` (the import block ending `from './designModeMenuModel.js'`), `ui/packages/app-shell/src/layout/designModeMenuSave.ts` (`rebaseMenuEdits` import). - **Two-minute check:** `git ls-files ui/packages/app-shell/src/layout | grep -i 'designmodemenu\.'`. Expect `DesignModeMenu.tsx` only, with no second entry spelled the same apart from case. 🤖 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>
1 parent 50bfbb8 commit 42b4060

6 files changed

Lines changed: 14 additions & 4 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
---
4+
5+
fix(app-shell): the design-mode menu builds on a case-insensitive file system — its helper module no longer shares the component's name up to letter case
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
`layout/` held the menu editor component `DesignModeMenu.tsx` beside its pure tree helpers `designModeMenu.ts`. On a case-insensitive file system (the macOS default) the sidebar's lazy `import('./DesignModeMenu.js')` tried `.ts` first and found the helper module, which has no default export: the `@object-ui/app-shell` build failed with TS1149 ("differs from already included file name … only in casing"), and a Console bundled there turned the whole page white when 「Edit app」 opened design mode. The helpers are now `designModeMenuModel.ts` (its test `designModeMenuModel-36363.test.ts`), so `./DesignModeMenu.js` can only reach the component. No behaviour changes; Linux builds were never affected.

‎ui/packages/app-shell/src/layout/DesignModeMenu.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ import {
137137
type Menu,
138138
type MenuEntry,
139139
type MenuTargetKind,
140-
} from './designModeMenu.js';
140+
} from './designModeMenuModel.js';
141141
import {
142142
consoleAppMenuDoors,
143143
fetchDefaultLocale,

ui/packages/app-shell/src/layout/__tests__/designModeMenu-36363.test.ts renamed to ui/packages/app-shell/src/layout/__tests__/designModeMenuModel-36363.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
targetKeyOf,
2525
withEntryIds,
2626
type Menu,
27-
} from '../designModeMenu';
27+
} from '../designModeMenuModel';
2828

2929
const MENU: Menu = Object.freeze([
3030
{ id: 'home', type: 'dashboard', dashboardName: 'home' },

‎ui/packages/app-shell/src/layout/__tests__/designModeMenuSave-36363.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ vi.mock('../../assistant/assistantBus', async (importOriginal) => ({
1616
emitMetadataRefresh,
1717
}));
1818

19-
import { withEntryIds, moveBy, insertEntry, patchEntry, type Menu } from '../designModeMenu';
19+
import { withEntryIds, moveBy, insertEntry, patchEntry, type Menu } from '../designModeMenuModel';
2020
import { isSameLanguage, saveAppMenu, type AppMenuSaveDoors } from '../designModeMenuSave';
2121

2222
const TEXTS = { notListed: 'not listed', pendingDraft: 'pending draft', noVersion: 'no version', notWritable: 'not writable' };
File renamed without changes.

‎ui/packages/app-shell/src/layout/designModeMenuSave.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import {
5151
type ListedPackageManifest,
5252
} from '../views/studio-design/packages-io.js';
5353
import { navPayloadOf } from '../views/metadata-admin/previews/AppNavCanvas.js';
54-
import { rebaseMenuEdits, type Menu } from './designModeMenu.js';
54+
import { rebaseMenuEdits, type Menu } from './designModeMenuModel.js';
5555

5656
/** The doors the save goes through; the defaults are the console's own. */
5757
export interface AppMenuSaveDoors {

0 commit comments

Comments
 (0)