Repository navigation
test(runtime): pay the view read's lint load at module top in meta-write-org-scope - #29622
Conversation
The D6 overlay case in meta-write-org-scope.test.ts timed out once at 5000 ms on a loaded shard. Its GET is the file's first view read, and a served view read imports @objectstack/lint lazily (loadFormLayoutLint, metadata-protocol metadata-diagnostics.ts): under vitest that first import is a cold transform of the lint module graph, 1.2 s p50 / 1.7 s max idle, all inside the clocked case. A module-top import pays it during collection; the protocol's later import() gets the same module instance back. No timeout raised, no assertion moved. Claude-Session: https://claude.ai/code/session_01ADHkmRczGnhouFCUs9DfQ2 Co-authored-by: Claude <noreply@anthropic.com>
…9603) check:test-source-alias reds a test that imports a workspace dep through dist/. The module-top preload of @objectstack/lint is one, so the bare specifier gets its anchored entry beside the /runtime one; the protocol's lazy view-read import resolves through the same entry, so the read judges the lint rule in the checkout. Claude-Session: https://claude.ai/code/session_01ADHkmRczGnhouFCUs9DfQ2 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check
What this run could not see
Coarse fallback — 28 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
|
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt Contract reviewServed-tier: Face: none of the four (no ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentNot owed on this face (no schema, governed or narrowing path). The one design question the card raises, whether the lazy load is product cost to fix at the source, is answered in ①.6: the lazy root import is the declared design, the delta's product-code clause does not reach it, and no measured user-side latency is on record. VERDICT: PASS Must-fix: none.
Generated by Claude Code |
|
domain:server#2 · os-steve · session_01ADHkmQxwoGb5fSnrFkpxmt 席位核对ACCEPT ·
Generated by Claude Code |
Requested by Steve · project thread
Fixes #29603
Clause-②: no
Metadata-protocol: none
维护者速读
meta-write-org-scope.test.ts在文件顶部预先加载@objectstack/lint,runtime 的 vitest 配置把这个包根指到源码。packages/runtime/src/meta-write-org-scope.test.ts(顶部那条 import 和注释),packages/runtime/vitest.config.ts(新的@objectstack/lint别名)。pnpm --filter @objectstack/runtime exec vitest run --project local src/meta-write-org-scope.test.ts --reporter=verbose,预期 20 个用例全绿,⭐ D6 用例几十毫秒(main 上约 1.2 秒)。What changes
packages/runtime/src/meta-write-org-scope.test.ts: a module-topimport '@objectstack/lint', with a comment naming the cost it moves. No case, assertion or timeout changes.packages/runtime/vitest.config.ts: one anchored alias,^@objectstack/lint$→../lint/src/index.ts, beside the existing/runtimeentry.check:test-source-aliasrequires it for the new import (its remedy text, verbatim shape), and it is the same entry metadata-protocol's lazy import resolves through, so the view read now judges the lint rule in the checkout rather thandist/.Why
The failure on
1a95c746(run 41514567522, Test Core 3/8, job 125515971369) was a timeout, not an assertion:Error: Test timed out in 5000ms.atmeta-write-org-scope.test.ts:419:5; the file ran 5978 ms that run.Where the time goes, measured by timing the case's steps in a scratch copy (deleted):
makeStack0 ms, thePUT /view/…19 ms, the firstGET /view/…1500 ms, a second identical GET 2 ms. The first GET is the first view read in the file. A served view read decorates_diagnosticswith the lint's form-layout warnings (withFormLayoutWarnings, called fromgetMetaItem'sserveFormLayout), and that helper imports the lint package root lazily on first use:loadFormLayoutLint,packages/metadata-protocol/src/metadata-diagnostics.ts:481. Under vitest that first import is a cold transform of the lint module graph, inside the clocked case. The sibling plural-spelling case does the same PUT but no GET, which is why it runs in 3 ms.The lazy import is deliberate product design (the kernel boot path reaches
@objectstack/lintonly through/runtime), so the product code stays as it is. The fix is the repo's clocked-window rule (AGENTS.md § Build & Test;scripts/check-test-source-alias.mjs): pay the first load at module top, during collection, which no timeout clocks. The protocol's laterimport()gets the same module instance back (measured: the first GET drops from 1500 ms to 7 ms).check:test-source-aliascannot see this load on its own, because it happens in another package's code.Tests
Duration of the ⭐ case and the file (sum of its 20 case durations),
--maxWorkers=1, one vitest process per run, underos-verify-lock.sh(shared-box seconds):2da42e74, 20 runs867f4777, 20 runsThe case now runs at sibling speed. The load moved into collection (the run's
importphase), whichtestTimeoutdoes not clock.Forced test edits: none. No assertion, timeout or case moved; the case still proves the overlay-enabled
viewlands env-wide and the read serves it.Runtime suite on the final head
pnpm --filter @objectstack/runtime test(vitest projectlocal) on867f4777, under the lock:Test Files 528 passed (528),Tests 8506 passed | 19 skipped (8525), VERDICT command-exit 0. The same suite on the first headda6bf162(preload only): 528/528, 8506 passed.Verification
Head
867f4777(branch merged withorigin/main81cd9eb0ebefore the PR).node scripts/pm/dispatch-gates.mjs --commandson867f4777: 50 commands (2 paths, 19 changed lines). All 50 ran on this head, each exit 0.--ranreconciliation:50 derived, 50 run, 0 NOT-MEASURED, 0 UNRUN.check:test-source-aliaswas red (NEW unaliased artifact import(s) … @objectstack/lint); the alias invitest.config.tsis its remedy, green on this head (120 packages with tests scanned).pnpm --filter @objectstack/runtime typecheck: exit 0 (check:test-typecheck: OK, debt ledger held).packages/runtimewith--no-inline-config(the package has no lint script): exit 0.!, no(narrowing)arm).Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses. (eslint onpackages/runtime, exit 0)main, one pull request.skip-changeset)packages/spectouched: n/a.content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.Generated by Claude Code