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'; 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/`.