Repository navigation
Commit a6bfac6
committed
fix(webui): the favourites test file has no tsc program checking it
Review feedback on #10: `selectWebuiRailViewTabs` gained a required `starred`
parameter, and `rail-buckets.test.ts` still called it with two arguments at four
sites. Benign at runtime -- the accesses are `starred?.[id]` -- and invisible
to every gate, because `packages/webui/tsconfig.test.json` lists exactly two
test files by name and `tsconfig.client.json` covers `src/client/**` but no
tests. Nothing in this repo compiles that file, so a required argument could be
dropped without a byte going red.
The arity errors were the symptom. The same hole was holding thirteen more in
this PR's own new test file, of the same shape and mine: `const ACTIVITY = {...}`
was left unannotated, so `busyReason: "turn"` widened to `string` and stopped
being assignable to the `WebuiActiveTurn["busyReason"]` union. Thirteen call
sites were handing a wrongly typed activity map to the filter, and the suite
stayed green on a fixture the product could not produce. Annotating the fixture
fixes the widening by checking the literal in context.
So `rail-buckets.ts:96-102` argues that `starred` is required precisely so a
missing argument cannot quietly produce wrong counts -- and at its only
consumer that guard was decorative. It is not any more, but only because both
files happen to be fixed by hand today; the hole itself is still open.
Also corrects a comment that outlived its premise. `shell.css` said "Pinned
rows sort to the top, which is a statement about order and not about the row" --
true when the mark was the only pin affordance, and no longer the whole truth
now that the row carries one. Worse, the ordering it cites lives only in the
project view's `sortWebuiProjectSessionIds`; the running, unread and favourites
views sort by activity alone, so inside those a pin buys the mark and nothing
else. The comment now says that, which is also why nothing in the rule depends
on the sort.
Left out on purpose:
- **Widening `tsconfig.test.json` to `test/unit/**/*.ts`.** Measured before
deciding: 155 errors, of which only 13 were this PR's. The rest are config
shape, not defects -- `vite.config.ts` (20, and not this PR's file to touch),
`markdown.tsx` and `WorkspacePanels.tsx` (16 each, client files handed a
server program's lib and types), plus `third_party/` and `local-runtime/`
reached by transitive import. 142 real items after this commit's fixes, spread
across 12 other test files, several of them pre-existing debt in files this PR
never opened. A blanket include is the wrong shape; the right one is a
separate program with client lib/types and a deliberate file list, and that
is its own change with its own review.
- **Giving child rows a star action.** The trap is real and staged: a child is
not in `page.sessions`, so the day `openSessionMenu`'s `isChild` branch grows
a star, that favourite becomes unreachable in 收藏 and still counts toward
nothing. It is unreachable today because there is no star item on a child
menu. Deciding whether the favourites view also walks the tree belongs with
the feature, so the precondition is written down in `rail-star.spec.mjs`
instead of half-solved here.
Validation: webui unit 1335 passed / 9 failed (the same 9 pre-existing Windows
ones), `typecheck` and `typecheck:webui` clean, `rail-star.spec.mjs` 18/18,
`check:source` 4679 files. The widened-config run above was the check for the
type fixes: 155 -> 142, with `rail-star-favorites` and `rail-buckets` at zero.1 parent aedab1d commit a6bfac6
4 files changed
Lines changed: 35 additions & 8 deletions
File tree
- packages/webui
- src/client/styles
- test/unit
- test/webui-browser
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1012 | 1012 | | |
1013 | 1013 | | |
1014 | 1014 | | |
1015 | | - | |
1016 | | - | |
1017 | | - | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
1018 | 1024 | | |
1019 | 1025 | | |
1020 | 1026 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
| 311 | + | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
55 | 61 | | |
56 | 62 | | |
57 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
360 | 375 | | |
361 | 376 | | |
362 | 377 | | |
| |||
0 commit comments