Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions packages/metadata-protocol/src/lint-root-preload.testkit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
//
// Import this at module top in a test file whose cases make a served `view`
// read or an object publish, so the file pays the first load of the
// `@objectstack/lint` package ROOT during collection, never inside a clocked
// case. Test-only: no product module imports it.
//
// The protocol loads the lint root lazily, on first use, in two places: a
// served `view` read decorates its `_diagnostics` with the form-layout
// warnings (`loadFormLayoutLint`, metadata-diagnostics.ts), and an object
// publish runs its build probes (`runBuildProbes`, build-probes.ts). The lazy
// shape is product design: the kernel boot path never reaches the root.
// Under vitest the first such load in a file is a cold transform of the lint
// module graph, paid inside whichever case gets there first. A module-top
// import is paid during collection, which neither `testTimeout` nor
// `hookTimeout` clocks, and the protocol's later `import()` gets the same
// module instance back (AGENTS.md § Build & Test, the clocked-window rule).
//
// Here the root resolves to `lint/dist/index.js`: this package's row in
// `check:test-source-alias` lists `@objectstack/lint` as still read from
// `dist/`.
//
// Who imports it: every test file in which a traced run of the whole suite
// saw that first load inside a case. A new file whose cases reach a view read
// or an object publish imports it too. It is not a `setupFiles` entry,
// because then every test file in the package pays the load, including the
// many that never reach it: measured, that added about 200 s of worker time
// and about a third to the suite's wall time.
import '@objectstack/lint';
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
* `saveMetaItem` / `publishPackageDrafts` run.
*/

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';
// The producer's OWN write-verb dispatch decisions, so the fake engine below
// cannot accept a call ObjectQL refuses. From `@objectstack/metadata-core`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions (#4550 delete /
// #5480 update), so the fake engine below cannot accept a call ObjectQL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
* `publishPackageDrafts`; nothing on the gate path is stubbed.
*/

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
import { assertEngineDeleteDispatch, assertEngineUpdateDispatch, assertEngineFindOnePredicate } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions (#4550 delete /
// #5480 update), so the fake engine below cannot accept a call ObjectQL
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions (#4550 delete /
// #5480 update), so the fake engine below cannot accept a call ObjectQL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* `findOne` over `sys_metadata` rows, and a registry answering a
* package-scoped lookup with that package's items only.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { assertEngineFindOnePredicate, isCodeArtifactBody } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* shape). Nothing on the save, read or publish path is stubbed.
*/

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { assertEngineDeleteDispatch, assertEngineUpdateDispatch, assertEngineFindOnePredicate, hashSpec } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* as a row stored before the rule (`residueField()`).
*/

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, describe, expect, it, vi } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions, imported from
// `@objectstack/metadata-core` and NOT from `@objectstack/objectql`: objectql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* caller naming an organization reads as the environment does, and a type in
* the overlay regime keeps its overlay.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it, vi } from 'vitest';
import { assertEngineFindOnePredicate, isCodeArtifactBody } from '@objectstack/metadata-core';
import type { FlowRegistration } from '@objectstack/spec/api';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
* `protocol.scoped-list-fallback.test.ts` (#21817): its package-less rows
* reach the merge as stand-ins, so its slot takes the same order.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
import { assertEngineFindOnePredicate, isCodeArtifactBody } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
*
* `@objectstack/objectql` cannot be imported here: it depends on this package.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { assertEngineFindOnePredicate, isCodeArtifactBody } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* its call and nothing else; the shard it is comes from its own name, and
* `protocol.lock-one-resolution.kit.test.ts` pins that the four files exist.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { registerRowShard } from './protocol.lock-one-resolution.kit.test.js';

registerRowShard();
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* its call and nothing else; the shard it is comes from its own name, and
* `protocol.lock-one-resolution.kit.test.ts` pins that the four files exist.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { registerRowShard } from './protocol.lock-one-resolution.kit.test.js';

registerRowShard();
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* its call and nothing else; the shard it is comes from its own name, and
* `protocol.lock-one-resolution.kit.test.ts` pins that the four files exist.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { registerRowShard } from './protocol.lock-one-resolution.kit.test.js';

registerRowShard();
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* its call and nothing else; the shard it is comes from its own name, and
* `protocol.lock-one-resolution.kit.test.ts` pins that the four files exist.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { registerRowShard } from './protocol.lock-one-resolution.kit.test.js';

registerRowShard();
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
* rule. Nothing the table enumerates is dropped: the 16 360 tests that ran as
* one file run under the same titles, and the kit adds two tests of its own.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import {
MetadataLockSchema,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
*
* `@objectstack/objectql` cannot be imported here: it depends on this package.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { MetadataLockSchema } from '@objectstack/spec/kernel';
import { assertEngineFindOnePredicate } from '@objectstack/metadata-core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
* Refusals are asserted as the envelope an HTTP boundary answers with
* (`resolveThrownHttpError`).
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { assertEngineDeleteDispatch, assertEngineFindOnePredicate, assertEngineUpdateDispatch } from '@objectstack/metadata-core';
import { resolveThrownHttpError } from '@objectstack/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* engine, with the real protocol, in `@objectstack/objectql`'s
* `engine-cascade-delete-objects.test.ts`).
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it, vi } from 'vitest';
import { assertEngineFindOnePredicate } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
* (pinned on the real engine, with the real protocol, in
* `@objectstack/objectql`'s `protocol-meta-disabled-actions.test.ts`).
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it, vi } from 'vitest';
import { assertEngineFindOnePredicate } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@
// 6. Comment stripper neutered to return '' -> RED in §4
// (non-vacuity: the expected count is ONE, not zero)

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it, vi } from 'vitest';
import { readFileSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
* `saveMetaItem` / `publishMetaItem` / `publishPackageDrafts`, so a harness
* that mocks them cannot see it.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, describe, expect, it } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions (#4550 delete /
// #5480 update). Imported from `@objectstack/metadata-core`, never from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
// ADR-0067 D2 in the same breath — nothing promoted, no commit row, no
// `allowed` row. See that block's header.

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it, vi } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions, imported from
// `@objectstack/metadata-core` and NOT from `@objectstack/objectql`: objectql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
* read doors run against it, and its write verbs route through the producer's
* own dispatch predicates.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { assertEngineDeleteDispatch, assertEngineFindOnePredicate, assertEngineUpdateDispatch, isCodeArtifactBody } from '@objectstack/metadata-core';
import { applyProtection } from '@objectstack/spec/shared';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
* the capture loop is reached the way a real publish reaches it.
*/

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, it, expect } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions, so the fake engine
// cannot accept a call ObjectQL refuses. From `@objectstack/metadata-core`, not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
// this helper calling `syncObjectSchema` with the folded
// spelling, rather than passing for want of an assertion)

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, describe, expect, it, vi } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions, imported from
// `@objectstack/metadata-core` and NOT from `@objectstack/objectql`: objectql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
// a blanket rule here would break ordinary publishing, and a refusal pin with
// no control cannot show the rule is selective.

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions, imported from
// `@objectstack/metadata-core` and NOT from `@objectstack/objectql`: objectql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* Reverse verification (one-shot, recorded in the PR): removing the sealed arm
* from `declinesStoredRow` turns §2 red.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import {
assertEngineDeleteDispatch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
* logged" can never pass on a harness that never published at all.
*/

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, it, expect, vi, afterEach } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions, so the fake engine
// cannot accept a call ObjectQL refuses. From `@objectstack/metadata-core`, not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* `protocol.save-flow-canonicalization.test.ts` — a fix INSIDE `saveMetaItem`
* cannot use a harness that mocks `saveMetaItem`.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions (#4550 delete /
// #5480 update), so the fake engine below cannot accept a call ObjectQL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
* 7. The lock: where the served row moves to the package-less row, the
* scoped slot's lock family still equals `getMetaItem`'s envelope.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
import { assertEngineFindOnePredicate, isCodeArtifactBody } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
* `protocol.unknown-datasource-refusal.test.ts`, kept local, with a registry
* that answers registered objects and a log of every data-table insert.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
import { assertEngineDeleteDispatch, assertEngineUpdateDispatch, assertEngineFindOnePredicate } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
* it, the write stamps it, and a row WITH a `checksum` is judged as before.
*/

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { createHmac } from 'node:crypto';
import { describe, expect, it } from 'vitest';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* bypassing `saveMetaItem`'s schema gate, exactly like a real row written
* years ago under an older protocol.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
// [#5619] The producer's OWN write-verb dispatch decisions (#4550 delete /
// #5480 update), so the fake engine below cannot accept a call ObjectQL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* path is stubbed.
*/

// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { assertEngineDeleteDispatch, assertEngineUpdateDispatch, assertEngineFindOnePredicate } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
* engine's `getDriverByName` over a mutable driver set and a registry that
* answers code-layer datasources.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
import { assertEngineDeleteDispatch, assertEngineUpdateDispatch, assertEngineFindOnePredicate } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
* `protocol.unknown-datasource-refusal.test.ts`, kept local, with a registry
* that answers `getObject` over a mutable set of registered objects.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
import { assertEngineDeleteDispatch, assertEngineUpdateDispatch, assertEngineFindOnePredicate } from '@objectstack/metadata-core';
import { ObjectStackProtocolImplementation } from './protocol.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
* rows, then `loadMetaFromDb`), and that a true orphan is adopted with the
* registry following its row at once, its record moved to the new binding.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
import {
assertEngineDeleteDispatch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* at one leaves the other empty. `hydrateOverlayIntoRegistry` is the single
* choke point all three runtime hydration callers share.
*/
// Pays the lint root's first load at collection, never inside a clocked case.
import './lint-root-preload.testkit.js';
import { describe, expect, it } from 'vitest';
import { assertEngineDeleteDispatch, assertEngineUpdateDispatch, assertEngineFindOnePredicate, isCodeArtifactBody } from '@objectstack/metadata-core';
import { expandViewContainer, isAggregatedViewContainer, ViewSchema } from '@objectstack/spec/ui';
Expand Down
1 change: 1 addition & 0 deletions packages/objectql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"zod": "^4.6.6"
},
"devDependencies": {
"@objectstack/lint": "workspace:*",
"tsx": "^4.23.15",
"typescript": "^6.0.3",
"vitest": "^4.1.11"
Expand Down
Loading
Loading