Repository navigation
Commit 42b4060
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
- .changeset
- ui/packages/app-shell/src/layout
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
0 commit comments