Repository navigation
fix(metadata-core): drop the optional vitest peer so npm 10 installs it again - #23834
Conversation
…ever reads The `.` entry's built output (dist/index.js, its chunk, dist/index.cjs) imports nothing from vitest; only the test-only `./testing` entry does, and its docblock already tells consumers to bring vitest as a devDependency. The optional `vitest: ^4.0.0` peer led npm 10 into vitest@4.1.12, whose own peer set contradicts itself, and npm 10's resolver crashed (`Cannot read properties of null (reading 'edgesOut')`) on any install that reached this package. Claude-Session: https://claude.ai/code/session_01TQLy3Yq6vF4SDpTXdr3Uwi Co-authored-by: Claude <noreply@anthropic.com>
… peer Claude-Session: https://claude.ai/code/session_01TQLy3Yq6vF4SDpTXdr3Uwi Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check
What this run could not see
Coarse fallback — 4 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
席位核对 · ✅ ACCEPT: PR #23834 at
|
…m 10 can install the published graph (objectui#12649) (objectstack-ai#12674) Fixes objectstack-ai#12649 Clause-②: no The `Live E2E (informational)` lane's backend now installs cold on the runner's npm. `e2e/live/ci/start-backend.sh` writes one root `overrides` entry, `vitest: ~4.0.0`, into the rewritten showcase manifest. The same value is the third component of the fixture stamp, so a fixture prepared under another install recipe is rebuilt, not reused. The CI/CD guide's paragraph that said "no transitive dependency is overridden" now names this one and says what the fixture cache still cannot see. ## Reproduction - **Runner npm**, read from the failing job's `actions/setup-node` step (job 116927385035): Node 22.23.3, npm 10.9.9. - Every local run below ran the real script end to end, under npm 10.9.9 or 11.21.0 fetched into a temp prefix, with a fresh npm cache and a fresh `LIVE_BACKEND_DIR`. - **Baseline**, the `origin/main` script at `f78efdd1e` under npm 10.9.9: exit 1 with `npm error Cannot read properties of null (reading 'edgesOut')`. The stack is in `#loadPeerSet` under `idealTree:node_modules/@objectstack/cli`. That is the CI failure, reproduced on the runner's npm. - **Why it crashes:** the installed graph reaches `vitest` only as an optional peer, from `better-auth@1.7.3` (nested under `@objectstack/plugin-auth`) and from `@objectstack/metadata-core@18.0.0-next.2`. That was read by scanning the installed tree. Upstream today, `npm view vitest dist-tags` gives `V4: 4.1.12`, and the 4.x line of `@vitest/browser-webdriverio` ends at `4.1.11`. ## Remedy chosen, and the alternatives' readings | route | npm | install | boot: sign-in · `/api/v1/health` · `/api/v1/ready` | allowlist | installed tree | |---|---|---|---|---|---| | **(a) `overrides.vitest: ~4.0.0` (chosen)** | 10.9.9 | exit 0, 528 packages | ready · 200 · 200 | 5 passed | same as (b); no vitest installed | | (b) npm 11, no override | 11.21.0 | exit 0, 528 packages | ready · 200 · 200 | 5 passed | the reference | | (c) `--legacy-peer-deps` | 10.9.9 | exit 0, 506 packages | ready · 200 · 200 | 5 passed | differs from (b) | - **Why (a).** It is the simplest correct route. It is objectstack's documented remedy for this crash: the troubleshooting entry "Cannot read properties of null (reading 'edgesOut') from npm install", objectstack `7a6ba03109`. objectstack's scaffolds emit the same override (objectstack-ai/objectstack#23850). - **(a) installs the tree (b) installs.** The two lockfiles' `packages` maps were compared path for path and version for version: 554 entries each, and no difference beyond npm 10 and npm 11 writing different `optional`/`peer` flags. So the lane still tests the published pair. - **(b)** is equally correct, but it adds a runtime npm download to the script and installs no different tree. - **(c)** installs a tree nobody ships. It drops `@objectstack/plugin-auth`'s `better-sqlite3@12.11.1` peer with its 21-package build subtree, and hoists `better-auth` to the root. The claim allowed it only as the last resort. ## Boot and allowlist proof: what was measured, and what was not - **(a), cold, through the changed script:** the install exits 0. The script's own readiness probe, the seeded admin's sign-in, answered. `GET /api/v1/health` gave 200 (`status: ok`, `version: 18.0.0-next.2`), and `GET /api/v1/ready` gave 200 (`status: ready`). - **Allowlist:** the console was built with `VITE_BASE_PATH=/`, as in the workflow's `Build console` step, and served by `vite preview` with `DEV_PROXY_TARGET` at the backend. The four specs `test:e2e:live:ci` names ran: `5 passed`. - **Two container-only deviations in that run:** the browser was the preinstalled Chromium, through the launch `executablePath`, and video recording was off, because this container has no ffmpeg for this Playwright revision. Both came from a scratch config that spread `playwright.live.config.ts` and changed nothing else. It was deleted afterwards and is not in this diff. - **The stamp, both directions:** - Rerunning the changed script on its own prepared fixture printed `prepare: pins unchanged (… 18.0.0-next.2 vitest@~4.0.0), reusing`, in 13 s with no install. - Running it on a fixture the `origin/main` script had prepared printed `prepare: showcase@…` and installed cold again: exit 0, 528 packages. That fixture's stamp has no third component, which is what a restored cache would carry. - **NOT MEASURED here:** the GitHub runner itself (only its Node and npm versions were reproduced), and the nightly schedule path. ## Is this PR's own Live E2E run cold? - The fixture cache key is `live-backend-` plus the runner OS plus `hashFiles('e2e/live/ci/backend.env')`. This PR does not touch `backend.env`, so the key stays `3e640c78135ae9fa…`. - That hash was recomputed locally as the sha256 of the file's sha256. It matches the key the failing job printed, which is the positive control. - No cache under that key is readable by this PR. A pull request run reads its own caches and `main`'s, and `main`'s are written only by the nightly schedule and manual dispatch. The workflow's run list since 11:00Z on 2026-10-16 shows only `pull_request` runs, so nothing on `main` has saved a fixture since `f62b6ff` moved `backend.env`. - Even on a hit, the stamp's new third component rejects any fixture prepared without it, so the script cold-installs. - This body is written once. The reading of the run itself, from its `Start ObjectStack backend (published packages)` step, goes in the os-dev report on objectstack-ai#12649. ## What the cache still hides - The key hashes `backend.env` alone. So a cold install that breaks because the registry moved under unchanged pins stays hidden until `OBJECTSTACK_VERSION` moves. That is how this one broke: the card's `18.0.0-next.1` control fails the same way. - Closing that needs a periodic cold run or a committed backend lockfile. The first is a workflow edit, which is governed and outside this claim, so it is named here and in the report, not done. The docs page now states the limit. ## Removal condition - **Written at the override:** remove `VITEST_OVERRIDE`, the `overrides` line in `prepare()`, and the stamp's third component once the published `@objectstack/cli` at `OBJECTSTACK_VERSION` installs on npm 10 with no override. - That is not yet true. objectstack's metadata-core change (objectstack-ai/objectstack#23834) is not in a published `next`, and `better-auth`'s optional vitest peer reaches the crash on its own. - **The comment gives the re-measure recipe, and warns of a trap measured here.** Delete the override in a prepared dir and run `npm install` again, and npm answers `up to date` with exit 0, because it installs from the lockfile. That rerun proves nothing; only a fresh dir does. ## Gates (local, at `eed841f45`) - `node scripts/check-governed-queue-guard.mjs --test e2e/live/ci/start-backend.sh content/docs/guide/ci-cd-pipeline.md`: exit 0, `NOT GOVERNED`. - `node scripts/check-changeset-presence.mjs`: exit 0, no changeset owed. The two files are neither published source nor a release-covered manifest. - These all exit 0: `check-bash32-floor`, `check-doc-links`, `check-control-bytes`, `check-new-cross-file-line-citations` (0 new), `check-doc-fence-languages` and `check-shell-escape-residue`. `bash -n` on the script is clean. - `check-doc-json-fences` first refused with exit 2, a prerequisite: `@object-ui/types` was not built. After the build it exits 0. - **Tests:** `pnpm exec vitest run` over the 17 test files that name `ci-cd-pipeline.md` or `start-backend.sh` (found with `git grep -l`): 17 files and 737 tests passed. - Everything else is CI's, read from this PR's check-runs. ## Acceptance notes - **`stop-backend.sh` does not stop the backend. This is pre-existing and not touched here.** - `start()` records `$!` of a backgrounded `cd … && nohup … objectstack dev` list. That is the forked subshell, not the server. - Measured with the `origin/main` scripts: the pid file held 30766, and the server was 30767, its child. `stop-backend.sh` printed `stopped pid 30766` and exited 0, while `/api/v1/health` on the port still answered 200. The server was reparented to pid 1. - CI never calls it (ephemeral runner), so the lane is unaffected. The local recipe it exists for leaks the server and the port. It goes to the seat as a finding. - **The cache's remaining blind spot** is above. Session: `https://claude.ai/code/session_016PVjjuVPte5XEJvaQx1E4t` --- _Generated by [Claude Code](https://claude.ai/code/session_016PVjjuVPte5XEJvaQx1E4t)_ Co-authored-by: Claude <noreply@anthropic.com>
Fixes #23806
Clause-②: no
What changes
@objectstack/metadata-coreno longer declaresvitestinpeerDependencies/peerDependenciesMeta. Both objects became empty and are removed. ThevitestdevDependency stays. One patch changeset is added,.changeset/23806-metadata-core-vitest-peer.md.pnpm-lock.yamldoes not move. The importer entry never recorded the peer.pnpm install --frozen-lockfileandpnpm install --lockfile-onlyboth exit 0, and the lockfile stays byte-unchanged.dist/is byte-identical before and after the edit (diff -rexit 0).tsup.config.tslistsvitestinexternalitself, sodist/testing.jsstill imports it and does not bundle it.Why: who reads
vitest?Measured on this branch's build and on the published
18.0.0-next.2tarball:vitest?.(import)dist/index.js+dist/chunk-URJ4AGQ3.js@objectstack/specsubpaths,zod,module,crypto.(require)dist/index.cjs./testingdist/testing.jsimport { describe, it, expect } from "vitest"./testingtypesdist/testing.d.tsThe runtime entry never reads
vitest. Only the test-only./testingentry does, and the docblock insrc/testing.tsalready tells consumers to listvitestas a devDependency. That sentence is still true, so the file is unchanged.In-repo consumers. Every in-repo consumer of
@objectstack/metadata-core/testingis a test file, inmetadata-fs,metadata-protocol,restorruntime. Each of those packages:vitest: ^4.1.11in its owndevDependencies;workspace:*.So none of them relied on the peer.
../objectui(at63d00da) has no consumer. Of the 85 trackedpackage.jsonfiles, metadata-core's was the only one withvitestas a peer, a dependency or an optional dependency.Measured: npm 10 (control first), then this branch
Each install ran in an empty scratch project on 2026-10-16. Upstream at measurement time:
vitestdist-tags:V4= 4.1.12,latest= 5.0.5.vitest@4.1.12peers@vitest/browser-webdriverio: ^4.1.11.vitest: 4.1.11exactly.So the upstream peer set is still incoherent.
@objectstack/metadata-core@18.0.0-next.2(control)Cannot read properties of null (reading 'edgesOut')vitestin the tree;import('@objectstack/metadata-core')loads 121 exports@objectstack/objectql@18.0.0-next.2(a dependent)edgesOutoverridespointing metadata-core at this branch's tarballvitest@5.0.5+ published metadata-coreERESOLVE:peerOptional vitest@"^4.0.0" from @objectstack/metadata-core@18.0.0-next.2vitest@5.0.5+ this branch's tarball17 published packages declare metadata-core directly, among them
objectql,runtime,rest,cli,metadataandmetadata-protocol. The peer therefore reached every npm install of any of them.What this does not fix
@objectstack/plugin-authstill exits 1 on npm 10.9.9 with the same error, even with metadata-core overridden to this branch's tarball. The cause isbetter-auth@1.7.3, which declares its own optionalvitestpeer (^2.0.0 || ^3.0.0 || ^4.0.0). This PR does not work around it.Both user remedies were measured, and the changeset names both:
"overrides": { "vitest": "~4.0.0" }(exit 0).Putting that remedy where an installing user reads the docs is the
domain:devxhalf of the card, as triage routed it. This PR touches nocontent/docs/**.The one reader the peer had, and what replaces it
Under one non-default layout, the peer did have a reader that the docblock cannot serve. The probe below runs
await import('@objectstack/metadata-core/testing')in a consumer that listsvitest4.1.11 as a devDependency:hoist=falseERR_MODULE_NOT_FOUND:Cannot find package 'vitest'hoist=falsevitest ~4.0.0plus the same override (blank-scaffold shape)hoist=false, pluspackageExtensionsre-declaring the peerThe changeset gives that layout the measured
packageExtensionsremedy.Keeping the peer and narrowing its range was considered and rejected, for two reasons:
ERESOLVEabove for every project on vitest 5, including projects that never import./testing.Verification (at
a27899a51)pnpm --filter @objectstack/metadata-core exec vitest run --maxWorkers=2: 18 files, 733 tests passed.pnpm --filter @objectstack/metadata-core run typecheck: exit 0.node scripts/pm/dispatch-gates.mjs --commandsderived 65 commands. All 65 ran: 64 exit 0, and 1 is NOT MEASURED. That one ispnpm check:dual-build-cjs-loads, which reports PREREQUISITE NOT MET because it needs every package'sdist/; CI runs it. In its place, a direct reading:requireofpackages/metadata-core/dist/index.cjsloads 121 keys. The--ranreconciliation reads 65 derived, 64 run, 1 NOT MEASURED, 0 UNRUN.check-plugin-teardown-shape --self-testfirst exited 3; it passed after its pinned commit was fetched.check:lean-entry-closurefirst exited 3; it passed after objectql's closure was built. Both exit 0.packages/.check:authz-resolver,check:error-code-casingandcheck:filter-alias-parityeach exit 0..tssources, and this diff contains none. CI runs them.Acceptance notes
src/testing.tsis left as is; its sentence is still true.vitest@4.1.11on its own also fails on npm 10.9.9:npm install -D vitest@4.1.11in an empty project exits 1 withedgesOut. So on npm 10, consumers of./testingare held back by upstream whatever this package declares. The~4.0.0shape works.Generated by Claude Code