Repository navigation
Commit 823d0f6
fix(console): count only objectui's own packages in the chunk-membership report, so the eager-closure gate stops reading @objectstack/core as objectui core (#26225)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9CsYCNfbV9QvfmNCbWe36wP)_
Part of #26131
Clause-②: no
Metadata-protocol: none
## The module, named
The stray module is not an objectui module. It is
`packages/core/dist/logger.js` at the objectstack monorepo ROOT, a file
of the framework package `@objectstack/core` (reached through
`@objectstack/client`, which depends on it). It lands in
`vendor-objectstack`, which is the right chunk for it: the vendor
group's workspace alternative claims every module under the root
`packages/` directory.
The gate counted it as objectui's `ui/packages/core` because of how
`emitChunkMembershipReport` in `ui/apps/console/vite.config.ts`
attributes a module id. It matched any `/packages/NAME/` segment
anywhere in the id. Inside the monorepo the framework's workspace
packages resolve to a second `packages/` directory, and four of its
package names are objectui package names too: `cli`, `core`,
`sdui-parser` and `types`. So `@objectstack/core`'s logger became "1 of
objectui core's 90 modules", in `vendor-objectstack`.
How it was named: a throwaway Vite plugin, added through a wrapper
config and deleted afterwards, listed every emitted module id under a
root `packages/` directory whose name collides with an objectui package.
On `main` that is exactly two ids: `packages/core/dist/logger.js` in
`vendor-objectstack`, and `packages/sdui-parser/dist/index.mjs` in a
lazy chunk named `dist`. In `chunk-membership.json` on `main`, the only
`core` directory counted in `vendor-objectstack` is `dist`. objectui's
`packages/core` is aliased to `src` and has no `dist` module in the
bundle.
## Why neither suggested route
- (a) A grouping change would move a framework module out of the vendor
chunk it belongs in, and the only thing it would serve is a miscount.
- (b) Changing the declaration does not help. `framework` really does
hold all 89 of objectui core's modules. Dropping `core` from the list
would leave the package unwatched.
The defect is in what the report counts, so this PR fixes the producer,
the membership emitter in the same `vite.config.ts` file the claim
names. Grouping rules, ceilings, baselines and the declaration are
untouched.
## Change
- `ui/scripts/vite-objectstack-workspace.ts`:
`objectuiPackagesDir(consoleDir)` and
`workspaceModuleMatcher(packagesDir)`. The matcher is anchored on
objectui's own `packages/` directory and escapes the path. It lives next
to `workspaceChunkTests` because it fixes the same monorepo-layout
effect, and because a config file's constants cannot be imported by a
test.
- `ui/apps/console/vite.config.ts`: `emitChunkMembershipReport` takes
its `WORKSPACE_MODULE` from that matcher, and the docblock says what the
population is.
- `ui/scripts/__tests__/vite-objectstack-workspace.test.ts`: five cases.
They cover attribution of an objectui module (package and rest of the
id), refusal of each of the four colliding framework names, anchoring,
escaping, and that the config uses the matcher.
- `.changeset/26131-console-chunk-membership-attribution.md`: `patch` on
`@object-ui/console`, because `dist/chunk-membership.json` ships in the
package's `files`.
## Readings, before and after
All on this container: the `@object-ui/console^...` closure built with
turbo (70/70), then `CI=true pnpm exec vite build` in `ui/apps/console`,
then `node scripts/check-eager-closure-budget.mjs` in `ui/`. "Before" is
base `7111e14a`'s `vite.config.ts`, built from the same tree through a
temporary `--config`. "After" is this branch at `8831aac4`.
| reading | before (`main` config) | after (this branch) |
|---|---|---|
| gate exit | 1 | 0 |
| membership half | red: `packages/core` 89 in `framework`, 1 in
`vendor-objectstack` | green: `packages/core` 89 in `framework`; react
51; types 16 + `src/zod` 10 in `types-zod`; components 217; fields 90 +
date-picker 2 |
| eager closure | 1937.7 KB gz, 88 of 2390 chunks | 1937.7 KB gz, 88 of
2390 chunks |
| emitted `*.js` files (sha256 of all 2395) | — | identical to before |
| `eager-closure.json` | — | byte-identical to before |
`chunk-membership.json`, compared by package: 32 of the 38 package keys
are unchanged. The ones that changed are exactly the framework modules
that drop out: `spec` (73 modules across 6 chunks), `client`, `formula`,
`lint`, the logger counted under `core`, and the root `sdui-parser`
counted under objectui's `sdui-parser`. Every objectui package count is
unchanged.
After merging `main` at `e6dfeb08`, the head is `f1393a3c`. On that head
the closure and Console were rebuilt and the gate re-run: exit 0,
membership green with the same counts, eager closure 1938.7 KB gz across
88 of 2390 chunks. The 185 cases in `vite-objectstack-workspace.test.ts`
and `check-eager-closure-budget.test.ts` pass.
The ablation was run once, with `node scripts/ablation-replace.mjs`. It
put the unanchored segment regex back inside `workspaceModuleMatcher`.
Two of the new cases went red: "does not attribute a framework package
that shares an objectui package name" and the escaping case. The file
was then restored: the blob hash matches HEAD and `git diff HEAD` is
empty.
## Acceptance notes
- The membership gate still runs in no workflow. That belongs to the ui
CI port (epic #25677), as the card says. This PR adds no gate and does
not touch `ui/.github/**` or the root `ci.yml`.
- The `advancedChunks` group tests in `vite.config.ts` use the same
unanchored segment form, `framework`'s among them (it matches
`packages/core`, `packages/react` and `packages/types`). On this build
that changes nothing: the probe found the only two colliding root
modules in `vendor-objectstack` and in the lazy `dist` chunk, and none
in `framework`. A group could still claim a framework module if the
module ever stopped being `$initial`, because the vendor group would
then no longer outrank it. Noted only: it is not reached today, and no
card is filed for it.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01UXdEMaH3vKYJxDUxiKdp4t)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 934810c commit 823d0f6
4 files changed
Lines changed: 93 additions & 4 deletions
File tree
- .changeset
- ui
- apps/console
- scripts
- __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 | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
23 | 28 | | |
24 | 29 | | |
25 | 30 | | |
| |||
400 | 405 | | |
401 | 406 | | |
402 | 407 | | |
403 | | - | |
404 | | - | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
405 | 411 | | |
406 | 412 | | |
407 | 413 | | |
| |||
429 | 435 | | |
430 | 436 | | |
431 | 437 | | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
432 | 443 | | |
433 | 444 | | |
434 | 445 | | |
435 | | - | |
| 446 | + | |
436 | 447 | | |
437 | 448 | | |
438 | 449 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
171 | 173 | | |
172 | 174 | | |
173 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
0 commit comments