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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
// test-budget: 20 — spawns the real producer once per single-cause fixture: twenty-four in-process kernel boots, one per describe (each shape × registration, package state and artifact fixture), each answering its block's bridge and door reads; slowest CI reading 14.93 s (run 40200279306, refresh PR #25960's window (hourly runs 40200279306 to 40272142430)) x 1.25, rounded up; read before this file paid each shape's first boot at module scope

/**
* [#25120] The `/mcp` bridge sees the objects a PACKAGE contributes: listed,
Expand Down Expand Up @@ -275,6 +276,13 @@ const REGISTRATIONS = [
{ label: 'installed after the boot, as marketplace install registers it', when: 'install' },
] as const;

// [#23181] Pay each shape's first boot at module scope, never in a hook: vitest
// clocks a hook as it clocks a test, and each shape's first boot was the slow
// one (276 and 163 ms against 45 to 131 ms for the rest, isolated). The throwaway kernel is
// the first describe's own fixture, booted and shut down before any hook runs,
// so it leaves nothing behind that a later boot does not already inherit.
for (const { environmentId } of SHAPES) await shutdown(await bootKernel(environmentId, 'boot', packageOf('qa_pkg')));

for (const { shape, environmentId } of SHAPES) {
for (const { label, when } of REGISTRATIONS) {
describe(`[#25120] the /mcp bridge and a package's objects — ${shape}, ${label}`, () => {
Expand Down
34 changes: 26 additions & 8 deletions packages/runtime/src/domains/meta-list-projection-parity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,24 @@ function bootRest(callerName: CallerName, opts: Boot = {}) {
return { read, protocol };
}

/**
* [#23181] The census blocks (row A, the item read, the layered route, the book
* tree) read every cell through ONE booted pair per caller, booted on its first
* cell and reused after. They booted a fresh pair per caller per cell, about
* 3,100 boots, and `bootRest`'s `registerRoutes()` was half the file's time.
* Reuse changes no answer: neither transport keeps one between two GET reads
* (`RestServer`'s per-request memo is keyed on the request object, and the
* dispatcher's membership cache on an environment no read here names), and
* every protocol-double read clones its fixture. The blocks that assert on a
* double's calls, or boot with options, still boot their own.
*/
const censusPairs = new Map<CallerName, { dispatcher: ReturnType<typeof bootDispatcher>; rest: ReturnType<typeof bootRest> }>();
function censusPair(who: CallerName) {
let pair = censusPairs.get(who);
if (!pair) censusPairs.set(who, (pair = { dispatcher: bootDispatcher(who), rest: bootRest(who) }));
return pair;
}

const text = (a: Answer): string => JSON.stringify(a.body ?? null);
const names = (items: any[] | undefined): string[] => (items ?? []).map((i: any) => i?.name);
const brief = (a: Answer) => ({
Expand Down Expand Up @@ -636,8 +654,8 @@ describe('[#20320] row A: the dispatcher lists what RestServer lists — every t
it(`GET /meta/${type} ${probe.label}`, async () => {
const mismatches: unknown[] = [];
for (const who of LIST_CALLERS) {
const dispatcher = await bootDispatcher(who).read(`/meta/${type}`, probe.query, probe.headers);
const rest = await bootRest(who).read(`/meta/${type}`, probe.query, probe.headers);
const dispatcher = await censusPair(who).dispatcher.read(`/meta/${type}`, probe.query, probe.headers);
const rest = await censusPair(who).rest.read(`/meta/${type}`, probe.query, probe.headers);
const same = dispatcher.status === rest.status
&& dispatcher.code === rest.code
&& JSON.stringify(dispatcher.items) === JSON.stringify(rest.items)
Expand Down Expand Up @@ -996,8 +1014,8 @@ describe('[#20408] the item read: the dispatcher answers what RestServer answers
it(`GET ${path} ${probe.label}`, async () => {
const mismatches: unknown[] = [];
for (const who of ITEM_CALLERS) {
const dispatcher = await bootDispatcher(who).read(path, probe.query, probe.headers);
const rest = await bootRest(who).read(path, probe.query, probe.headers);
const dispatcher = await censusPair(who).dispatcher.read(path, probe.query, probe.headers);
const rest = await censusPair(who).rest.read(path, probe.query, probe.headers);
if (!sameAnswer(dispatcher, rest)) mismatches.push(mismatchOf(who, dispatcher, rest));
}
expect(mismatches).toEqual([]);
Expand Down Expand Up @@ -1059,8 +1077,8 @@ describe('[#20478] GET /meta/:type/:name/layers: the dispatcher serves the route
it(`GET ${path}/layers ${probe.label}`, async () => {
const mismatches: unknown[] = [];
for (const who of ITEM_CALLERS) {
const dispatcher = await bootDispatcher(who).read(`${path}/layers`, probe.query, probe.headers);
const rest = await bootRest(who).read(`${path}/layers`, probe.query, probe.headers);
const dispatcher = await censusPair(who).dispatcher.read(`${path}/layers`, probe.query, probe.headers);
const rest = await censusPair(who).rest.read(`${path}/layers`, probe.query, probe.headers);
if (!sameAnswer(dispatcher, rest)) mismatches.push(mismatchOf(who, dispatcher, rest));
}
expect(mismatches).toEqual([]);
Expand Down Expand Up @@ -1226,8 +1244,8 @@ describe('[#20408] GET /meta/book/:name/tree: the dispatcher serves the route Re
it(`GET /meta/book/${book}/tree ${probe.label}`, async () => {
const mismatches: unknown[] = [];
for (const who of TREE_CALLERS) {
const dispatcher = await bootDispatcher(who).read(`/meta/book/${book}/tree`, probe.query, probe.headers);
const rest = await bootRest(who).read(`/meta/book/${book}/tree`, probe.query, probe.headers);
const dispatcher = await censusPair(who).dispatcher.read(`/meta/book/${book}/tree`, probe.query, probe.headers);
const rest = await censusPair(who).rest.read(`/meta/book/${book}/tree`, probe.query, probe.headers);
if (!sameAnswer(dispatcher, rest)) mismatches.push(mismatchOf(who, dispatcher, rest));
}
expect(mismatches).toEqual([]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
// test-budget: 30 — spawns the real producer once per single-cause fixture: one in-process boot of the real stack, then a sandboxed body or host handler run through the real doors per reader context, verb and caller; slowest CI reading 16.31 s (run 40200279306, refresh PR #25960's window (hourly runs 40200279306 to 40272142430)) x 1.25, rounded up; the first loads already paid at module scope

/**
* The in-process reader contexts over the stored-metadata-body family
Expand Down
Loading