Skip to content

Commit 46b1bee

Browse files
committed
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 <noreply@anthropic.com>
1 parent 2da42e7 commit 46b1bee

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎packages/runtime/src/meta-write-org-scope.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ import { ObjectStackProtocolImplementation } from '@objectstack/metadata-protoco
8282
// quantified over the CONTRACT rather than over a hand-copied specimen list
8383
// (Prime Directive #8): a future spelling limb arrives inside the quantifier.
8484
import { META_URL_TO_SINGULAR, canonicalMetaUrlType } from '@objectstack/spec/shared';
85+
// [#29603] Pay the first load of `@objectstack/lint` at MODULE LOAD, never
86+
// inside a clocked case. A served VIEW read adds the lint's form-layout
87+
// warnings to `_diagnostics` (`withFormLayoutWarnings`), and the protocol
88+
// imports that package root lazily, on the first view read of the process
89+
// (`loadFormLayoutLint`, packages/metadata-protocol/src/metadata-diagnostics.ts).
90+
// Under vitest that first import is a cold transform of the lint package's
91+
// whole module graph: measured 1.2 s p50 / 1.7 s max idle, all of it inside the
92+
// GET of the ⭐ D6 case below, the first view read in this file. A shard under
93+
// load stretched it past the 5000 ms `testTimeout` once. The protocol's later
94+
// `import()` gets this same module instance back, so with it paid here the
95+
// case times the write and the read, not the compiler (the clocked-window rule,
96+
// `scripts/check-test-source-alias.mjs`; that gate cannot see this load,
97+
// because it happens in another package's code). The read still runs the rule.
98+
import '@objectstack/lint';
8599
import { HttpDispatcher } from './http-dispatcher.js';
86100
import type { HttpDispatcherResult } from './http-dispatcher.js';
87101

0 commit comments

Comments
 (0)