From 46b1bee8fb7bbfc8205df534a1491248b64faf66 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 2 Nov 2026 21:18:52 +0000 Subject: [PATCH 1/2] test(runtime): pay the lint load of the view read at module top (#29603) 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 --- packages/runtime/src/meta-write-org-scope.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/runtime/src/meta-write-org-scope.test.ts b/packages/runtime/src/meta-write-org-scope.test.ts index ea7dd97e634..fc147e5e52a 100644 --- a/packages/runtime/src/meta-write-org-scope.test.ts +++ b/packages/runtime/src/meta-write-org-scope.test.ts @@ -82,6 +82,20 @@ import { ObjectStackProtocolImplementation } from '@objectstack/metadata-protoco // quantified over the CONTRACT rather than over a hand-copied specimen list // (Prime Directive #8): a future spelling limb arrives inside the quantifier. import { META_URL_TO_SINGULAR, canonicalMetaUrlType } from '@objectstack/spec/shared'; +// [#29603] Pay the first load of `@objectstack/lint` at MODULE LOAD, never +// inside a clocked case. A served VIEW read adds the lint's form-layout +// warnings to `_diagnostics` (`withFormLayoutWarnings`), and the protocol +// imports that package root lazily, on the first view read of the process +// (`loadFormLayoutLint`, packages/metadata-protocol/src/metadata-diagnostics.ts). +// Under vitest that first import is a cold transform of the lint package's +// whole module graph: measured 1.2 s p50 / 1.7 s max idle, all of it inside the +// GET of the ⭐ D6 case below, the first view read in this file. A shard under +// load stretched it past the 5000 ms `testTimeout` once. The protocol's later +// `import()` gets this same module instance back, so with it paid here the +// case times the write and the read, not the compiler (the clocked-window rule, +// `scripts/check-test-source-alias.mjs`; that gate cannot see this load, +// because it happens in another package's code). The read still runs the rule. +import '@objectstack/lint'; import { HttpDispatcher } from './http-dispatcher.js'; import type { HttpDispatcherResult } from './http-dispatcher.js'; From 867f477774a5239467d5213259c234fc9fea391e Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 2 Nov 2026 21:51:00 +0000 Subject: [PATCH 2/2] test(runtime): alias the @objectstack/lint package root to source (#29603) 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 --- packages/runtime/vitest.config.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/runtime/vitest.config.ts b/packages/runtime/vitest.config.ts index 7aff9514f98..8e78e65c9d2 100644 --- a/packages/runtime/vitest.config.ts +++ b/packages/runtime/vitest.config.ts @@ -152,6 +152,11 @@ export default defineConfig({ // dependency closure with `resolvePackageClosure`, the one walk the save // door's publish gate uses; its tests judge the source, never `dist/`. { find: /^@objectstack\/lint\/runtime$/, replacement: path.resolve(__dirname, '../lint/src/runtime.ts') }, + // [#29603] The package root: a served view read imports it lazily for the + // form-layout warnings (metadata-protocol's `loadFormLayoutLint`), and + // `meta-write-org-scope.test.ts` pays that load at module top. Both + // resolve here, so the read judges the lint rule in the checkout, never `dist/`. + { find: /^@objectstack\/lint$/, replacement: path.resolve(__dirname, '../lint/src/index.ts') }, // The MCP bridge (`domains/mcp.ts`) reads "this field declares options" // through `@objectstack/formula`'s `declaresOptions`; its tests judge the // predicate in the checkout, never `dist/`.