Repository navigation
Commit 5b8ca36
fix(pm): dispatch-gates ui/scripts suite roots cover the whole ui tree (#38118)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDypKu7B9nwbu5WuV7AEio8)_
Fixes #37254
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 用户无感:开发代理改动界面包里任何文件(包括各包自带的脚本目录)时,派发门禁清单现在会提示它先跑界面脚本测试套件。
- 属于车队开发效率治理,替那些因清单漏报、等 CI 才发现界面测试变红的开发代理解决问题。
- 若出错,最坏是界面改动多跑一次约五分钟的测试套件,或继续漏报;只改一张数据表,可直接撤回。
- 无。
## What changes
- `UI_SCRIPTS_SUITE_ROOTS` in `scripts/pm/dispatch-gates.data.mjs` is
widened from five sub-tree roots (`ui/packages/**/src`,
`ui/packages/**/src/**`, `ui/apps/**`, `skills/objectui/**`,
`ui/scripts/**`) to `ui`, `ui/**` and `skills/objectui/**`. The row's
`kind` and `why` prose follow.
- **Widen, not derive** — the reading on origin/main 93fa911:
- `ui/scripts/check-ui-root-lookups.mjs` walks `SCAN_ROOTS = ['scripts',
'packages', 'apps']` under the ui root, with no exclusion for a
package's own `scripts/` directory, and `check-ui-root-lookups.test.ts`
runs that scan (`scan(repoRoot)`, `scanned > 100`). Six such directories
exist today (`components`, `fields`, `i18n`, `plugin-gantt`,
`plugin-grid`, `plugin-kanban`).
- Files under `ui/scripts/` and `ui/scripts/__tests__/` that name each
top-level ui directory: `packages` 210, `scripts` 239, `apps` 121,
`docs` 58, `examples` 53, `e2e` 26, `eslint-rules` 13, `patches` 8. Ui
root files: `package.json` 144, `.changeset` 36, `tsconfig.json` 35,
`vitest.config.mts` 32, `eslint.config.js` 15, `playwright.config.ts` 4.
- So the suite reads every top-level part of the ui tree. Building the
list from what the suite reads would mean parsing about 180 tests' read
sites, and it would still end up at roughly `ui/**`. CI's own `ui` path
filter in `ci.yml` is `ui/**` too. Including the few unread root files
(`cliff.toml`, `.gitattributes`) costs one extra suite run. Leaving a
reader out costs a red CI round trip.
- The old control `ui/packages/core/package.json` ("outside the roots")
was wrong: `package-files-exist.test.ts` reads every ui package
manifest. It is now a specimen.
## Tests
- `scripts/pm/dispatch-gates.self-test.mjs`: specimens are now keyed by
the reader that makes them suite inputs. New ones are
`ui/packages/components/scripts/new-script.mjs` (the card's miss),
`ui/packages/core/package.json` and `ui/vitest.config.mts`. Each one is
checked through the predicate, the whole table and the runnable union.
The directory case now covers `ui/packages/fields/scripts` and bare
`ui`. A `uikit/...` control checks that the `ui` root does not
over-match on a shared prefix.
- Reverse check: run against the old five roots, `readByUiScriptsSuite`
returns `false` for all three new specimens, so the new cases fail on
the pre-fix list.
<details><summary>Self-test and Done-when readings at 20a777d</summary>
```
✓ dispatch-gates self-test (fast tier): 2369 cases pass; 9 slow section(s) deferred.
os-verify-lock: VERDICT command-exit 0
✓ a path under a ui package's own scripts/ directory is read by the ui/scripts suite (ui/packages/components/scripts/new-script.mjs)
✓ through the whole table, a diff under a ui package's own scripts/ directory derives the suite, anchored on the delimiter
✓ CONTROL: uikit/packages/core/scripts/x.mjs is outside the roots
node scripts/pm/dispatch-gates.mjs --commands ui/packages/components/scripts/build-css.mjs -> exit 0, prints: pnpm --dir ui exec vitest run scripts/
old roots: ui/packages/components/scripts/new-script.mjs false · ui/packages/core/package.json false · ui/vitest.config.mts false
```
</details>
## Acceptance notes
- The slow tier of the self-test (`pnpm check:pm-dispatch-gates`) is not
measured locally. It runs longer than the foreground limit, so CI runs
the full battery.
- Ran locally, all exit 0: `check:nul-bytes`, `check:issue-citations`
and its census, `check-declaration-mirrors`, `check-self-test-wired`,
`check:pm-governed-prose`, `check:scripts-symbol-anchors`,
`check:ratchet-remedy-authority`, `check-published-list-mirrors`,
`check-comment-mask-corpus`, plus the fast self-test. This is a declared
narrowing: `--ran` reports 54 of 63 derived families unrun, and those
are left to CI.
- Read first: (1) `UI_SCRIPTS_SUITE_ROOTS` and its docblock in
`dispatch-gates.data.mjs`, the riskiest hunk because a wider root
changes every ui card's gate list; (2) the specimen and control tables
in the self-test.
## Verification
Two-minute check: `node scripts/pm/dispatch-gates.mjs --commands
ui/packages/components/scripts/build-css.mjs | grep 'vitest run
scripts/'` should print `pnpm --dir ui exec vitest run scripts/`. On
main it prints nothing.
---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cxRDKprCtjpEdtiPFW)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent fcdeb3e commit 5b8ca36
2 files changed
Lines changed: 37 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1170 | 1170 | | |
1171 | 1171 | | |
1172 | 1172 | | |
1173 | | - | |
| 1173 | + | |
1174 | 1174 | | |
1175 | 1175 | | |
1176 | 1176 | | |
1177 | 1177 | | |
1178 | 1178 | | |
1179 | 1179 | | |
1180 | | - | |
| 1180 | + | |
1181 | 1181 | | |
1182 | 1182 | | |
1183 | 1183 | | |
| |||
1408 | 1408 | | |
1409 | 1409 | | |
1410 | 1410 | | |
1411 | | - | |
1412 | | - | |
1413 | | - | |
1414 | | - | |
1415 | | - | |
1416 | | - | |
1417 | | - | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
1418 | 1423 | | |
1419 | 1424 | | |
1420 | | - | |
1421 | | - | |
1422 | | - | |
| 1425 | + | |
| 1426 | + | |
1423 | 1427 | | |
1424 | | - | |
1425 | 1428 | | |
1426 | 1429 | | |
1427 | 1430 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5493 | 5493 | | |
5494 | 5494 | | |
5495 | 5495 | | |
5496 | | - | |
| 5496 | + | |
5497 | 5497 | | |
5498 | 5498 | | |
5499 | 5499 | | |
| 5500 | + | |
| 5501 | + | |
5500 | 5502 | | |
5501 | | - | |
5502 | | - | |
5503 | | - | |
5504 | | - | |
| 5503 | + | |
| 5504 | + | |
| 5505 | + | |
| 5506 | + | |
| 5507 | + | |
| 5508 | + | |
| 5509 | + | |
| 5510 | + | |
| 5511 | + | |
| 5512 | + | |
| 5513 | + | |
5505 | 5514 | | |
5506 | 5515 | | |
5507 | 5516 | | |
5508 | | - | |
| 5517 | + | |
5509 | 5518 | | |
5510 | 5519 | | |
5511 | 5520 | | |
5512 | 5521 | | |
5513 | 5522 | | |
5514 | 5523 | | |
5515 | | - | |
| 5524 | + | |
5516 | 5525 | | |
5517 | 5526 | | |
5518 | 5527 | | |
5519 | | - | |
| 5528 | + | |
5520 | 5529 | | |
5521 | | - | |
| 5530 | + | |
5522 | 5531 | | |
5523 | 5532 | | |
5524 | 5533 | | |
| |||
5532 | 5541 | | |
5533 | 5542 | | |
5534 | 5543 | | |
5535 | | - | |
| 5544 | + | |
5536 | 5545 | | |
5537 | 5546 | | |
5538 | | - | |
| 5547 | + | |
5539 | 5548 | | |
5540 | 5549 | | |
5541 | 5550 | | |
5542 | 5551 | | |
5543 | 5552 | | |
5544 | 5553 | | |
5545 | 5554 | | |
5546 | | - | |
| 5555 | + | |
5547 | 5556 | | |
5548 | 5557 | | |
5549 | 5558 | | |
| |||
0 commit comments