Repository navigation
Commit bba96ce
tooling(objectui-readiness 5): the workspace's own files come from workspace-root.mjs, so tests and the CLI generator read the same layout under the monorepo's ui/ (objectstack#25733) (#13498)
<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoKJXi9asZgeRJUKMTK6ywWF)_
Part of objectstack#25733 (child 2e of the epic). Part of
objectstack#25677.
Clause-②: no
Metadata-protocol: none
- [x] Adds no product-specific widget, dialog, hook or string (see
AGENTS.md › Product-neutral renderer)
## Why
Standalone, the objectui tree is the pnpm workspace root. Under the
objectstack monorepo it is `ui/`, and the workspace root
(`pnpm-workspace.yaml`, `node_modules/.pnpm`) is one level up.
`ui/node_modules` then holds only the ui root package's own links. There
is no `ui/node_modules/.pnpm` and no `ui/pnpm-workspace.yaml`.
Measured on a scratch worktree of the objectstack verification head
`cfa1676afc`, with this tree applied under `ui/`: 12 tests went red
across 5 files, before this change.
- `check-doc-snippet-types.test.ts`, 2 reds. The UNDECLARED and
ROOT-DECLARED controls looked for `TREE/node_modules/.pnpm`, so both
read "NOT INSTALLED", and `check:doc-snippets` exited 2.
- `vite-objectstack-client-dist.test.ts`, 5 reds. The installed client
is a workspace link to `packages/client`, not a store symlink, and that
link carries its own `node_modules`.
- `vite-objectstack-spec-dist.test.ts`, 2 reds, and
`vite-objectstack-workspace.test.ts`, 2 reds. The checkout's own console
has the framework's `packages/` three levels up, so its tests are the
merged arm and not the baseline literals.
- `packages/cli` `app-generator.test.ts`, 1 red. The in-workspace case
used the checkout root as "a workspace root", and under `ui/` it is a
member.
## What changes
- **`scripts/workspace-root.mjs`** gains `virtualStorePath(root =
uiRoot())`, which is the workspace root's `node_modules/.pnpm`. It
throws, like `workspaceRoot()`, when no workspace governs the tree.
`findInstalledCopy` in `check-doc-snippet-types.mjs` reads it, and
returns null with no workspace. The relative path it reports reads
`../node_modules/.pnpm/…` under `ui/`.
- **`@object-ui/cli` `currentContext()`** returns `isMonorepo:
isWorkspaceRoot(cwd)`. That is the predicate `dev`, `serve` and `build`
already use (`utils/workspace-vite.ts`, objectui#3890), and it is the
same expression the function used to spell inline, `existsSync(join(cwd,
'pnpm-workspace.yaml'))`. See the proposal below.
- **Console vendor-chunk tests.** The standalone arm is read off a tmp
fixture (`TMP/objectui/apps/console`, nothing beside it), and the merged
arm off the existing monorepo-shaped fixture. The checkout itself is
asked only which arm its own layout names, with `isNestedWorkspace()` as
the independent witness. `vite-objectstack-spec-dist.test.ts` compares
the config's vendor test with the arm the layout selects, and pins the
baseline literal separately. **The regexes in
`scripts/vite-objectstack-workspace.ts` are unchanged.**
- **Client-dist test.** The dependency walk through a pnpm symlink is
held on a fixture store
(`node_modules/.pnpm/@objectstack+client@1.0.0/node_modules/{client,core}`
and a console symlink). The out-of-tree copy leaves the package's own
`node_modules` behind.
- **`check:ui-root-lookups`** gains the `workspace-file-at-ui-root`
shape. It fires on a `join`/`resolve` (or a template led by a
substitution) that names `pnpm-workspace.yaml` or `node_modules/.pnpm`
and whose base resolves to the objectui tree. The base can be
`uiRoot()`, `UI_ROOT`, `__dirname` / `import.meta.dirname` /
`fileURLToPath(import.meta.url)` climbed to the tree, or a `const` or
parameter default bound to one of those. It fires once, where the path
first names the file. It adds 14 self-test cases, 51 in total. The
allowlist entry for `app-generator.ts` is removed, because it would read
stale.
## Proposal: what "runs at a workspace root" means for
`currentContext()`
`currentContext()` is product code, so its meaning is written in its doc
comment and proposed here. "Runs at a workspace root" means **cwd itself
holds `pnpm-workspace.yaml`**, the same predicate `dev`, `serve` and
`build` use to skip install and to alias. A workspace **member** gets
the standalone map. That covers a user's package inside their own
monorepo, and objectui under `ui/`. The generator does not walk up,
because walking up would hand a member the empty in-workspace maps, and
no alias table backs those maps at a member's cwd.
**A user's project behaves exactly as before.** With the file in cwd it
gets the in-workspace map, and without it the standalone map, because
the expression is the same. Two tests pin it, both from fixtures: the
in-workspace case runs from a fixture workspace root, and a new case
runs from a fixture member and expects the standalone map.
## Reverse check
The new gate shape, run on the pristine #13491 head (`f8fa141`), fires
at exactly the two sites this PR changes, and nowhere else outside the
allowlist:
- `scripts/check-doc-snippet-types.mjs` `findInstalledCopy`,
`workspace-file-at-ui-root`, `join(root, 'node_modules', '.pnpm')`
- `packages/cli/src/utils/app-generator.ts` `currentContext`,
`marker-probe`, `existsSync(join(cwd, 'pnpm-workspace.yaml'))`
## Verification
**objectui standalone**, on this branch (main `6c3340c` plus this
commit, after `pnpm run setup`). Every command exited 0:
`pnpm check:ui-root-lookups` · `node scripts/check-ui-root-lookups.mjs
--self-test` (51 cases) · `pnpm check:new-line-citations` · `node
scripts/check-changeset-presence.mjs` · `node
scripts/check-changeset-overwrite.mjs` · `pnpm check:changeset-claims` ·
`pnpm type-check:scripts` · `pnpm check:test-path-roots` · `pnpm
check:pre-install-import-graph` · `pnpm check:control-bytes` · `pnpm
exec eslint` over the changed files (0 errors) · `pnpm --filter
@object-ui/cli test` (30 files, 416 tests).
`pnpm exec vitest run scripts/__tests__` was run whole in three shards
(`--shard=K/3`, under the verify lock): 196 files passed, 5787 tests.
Two files were skipped by their own `IS_CHILD` conditions.
**Merged layout.** I used a scratch worktree of the objectstack
verification head `cfa1676afc`. I installed it and ran the CI build of
the seven `@objectstack` packages, plus the `@object-ui` closure
`check:doc-snippets` builds. Then I applied #13491's diff and this diff
under `ui/` with `git apply --directory=ui`. This diff applies to the
landed main unchanged; it is byte-identical apart from blob ids.
- The 7 touched script test files: 293/293 passed.
- `vitest run --root .
packages/cli/src/__tests__/app-generator.test.ts`: 48/48 passed.
- `pnpm --dir ui run check:ui-root-lookups`: OK, 6 allowlist entries
live.
- `pnpm --dir ui run check:doc-snippets`: exit 0, 811 blocks compiled.
Both controls are live and installed at `../node_modules/.pnpm/…`.
- Control, before this diff: the same 7 files plus the CLI test showed
the 12 reds above, and `check:doc-snippets` exited 2 with both controls
"NOT INSTALLED".
## Bound of the new gate shape
Two of the three classes this card fixes are not syntactic joins: the
CLI test treating the checkout root as a workspace root, and the vite
sibling-directory probe. They are out of the gate's reach, and so are a
path assembled through `let` or across files. The gate header states
this bound.
## Out of scope
Pin scripts (objectstack#25711), spec drift (objectstack#25727),
QUICK_REFERENCE (objectstack#25697), dependency versions
(objectstack#25726), `.github/**`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_018KHW3U8PmJue4aVvtXutRb
Co-authored-by: Claude <noreply@anthropic.com>1 parent 899f381 commit bba96ce
14 files changed
Lines changed: 436 additions & 52 deletions
File tree
- .changeset
- packages/cli/src
- __tests__
- utils
- scripts
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1380 | 1380 | | |
1381 | 1381 | | |
1382 | 1382 | | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
1383 | 1399 | | |
1384 | | - | |
1385 | | - | |
1386 | | - | |
1387 | | - | |
1388 | | - | |
1389 | | - | |
1390 | | - | |
1391 | | - | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
1392 | 1423 | | |
1393 | 1424 | | |
1394 | 1425 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
281 | 282 | | |
282 | 283 | | |
283 | 284 | | |
284 | | - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
285 | 301 | | |
286 | 302 | | |
287 | | - | |
| 303 | + | |
288 | 304 | | |
289 | 305 | | |
290 | 306 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
506 | | - | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
507 | 509 | | |
508 | 510 | | |
509 | 511 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1376 | 1376 | | |
1377 | 1377 | | |
1378 | 1378 | | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
1379 | 1407 | | |
1380 | 1408 | | |
1381 | 1409 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
42 | 52 | | |
43 | 53 | | |
44 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
102 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
103 | 109 | | |
104 | 110 | | |
105 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
106 | 138 | | |
107 | 139 | | |
108 | 140 | | |
| |||
190 | 222 | | |
191 | 223 | | |
192 | 224 | | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | 225 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
205 | 235 | | |
206 | 236 | | |
207 | 237 | | |
208 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
209 | 242 | | |
210 | 243 | | |
211 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
96 | 107 | | |
97 | 108 | | |
98 | 109 | | |
| |||
930 | 941 | | |
931 | 942 | | |
932 | 943 | | |
933 | | - | |
| 944 | + | |
| 945 | + | |
934 | 946 | | |
935 | 947 | | |
936 | 948 | | |
937 | | - | |
| 949 | + | |
| 950 | + | |
938 | 951 | | |
939 | 952 | | |
940 | 953 | | |
| |||
990 | 1003 | | |
991 | 1004 | | |
992 | 1005 | | |
993 | | - | |
| 1006 | + | |
994 | 1007 | | |
995 | 1008 | | |
996 | 1009 | | |
| |||
0 commit comments