Skip to content

Commit 1cdac15

Browse files
backspaceclaude
andcommitted
ci: Skip dev-realm boot index in realm-server tests instead of mount gate
Replaces the mount-only readiness gate with a cleaner fix for the same goal. The realm-server suite runs its own in-process realms + test Postgres and only needs the boot dev realms (base/skills/openrouter/software-factory) to serve *source* — definitions resolve lazily via the prerenderer, so those realms don't need a populated index. CI uses a fresh Postgres every run, so each boot realm would otherwise run a from-scratch index (~minutes) that both delayed `_readiness-check` and competed with the tests' own renders for the prerender page pool, intermittently starving render-heavy tests into timeouts. New `REALM_SERVER_SKIP_BOOT_INDEX` env (Realm `skipBootIndex` option) makes a realm mount and serve source without the boot index, even on a new index. It's set only on the phase-1 dev realm server in the test launcher — the phase-2 node-test realm, whose indexed content the suite reads, still indexes. With no boot index to await, `_readiness-check` resolves at mount, so the readiness gate reverts to `_readiness-check`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9f884d5 commit 1cdac15

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

mise-tasks/test-services/realm-server

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ NODE_TEST_REALM_READY="${REALM_TEST_READY_SCHEME}://${REALM_TEST_URL#*://}/node-
2727
# on wait-on (overriding NODE_TLS_REJECT_UNAUTHORIZED), so the documented
2828
# INSECURE flag is the right escape hatch. Does not affect services
2929
# under test.
30+
#
31+
# REALM_SERVER_SKIP_BOOT_INDEX=true is scoped to the phase-1 dev realm
32+
# server (base/skills/openrouter/software-factory) only — not the phase-2
33+
# node-test realm, which the suite reads indexed content from. Those boot
34+
# realms only need to serve source for the suite, so skipping their
35+
# from-scratch index keeps `_readiness-check` fast and frees the prerender
36+
# pool for the tests' own renders.
3037
WAIT_ON_TIMEOUT=900000 \
3138
SKIP_EXPERIMENTS=true \
3239
SKIP_CATALOG=true \
@@ -35,7 +42,7 @@ WAIT_ON_TIMEOUT=900000 \
3542
NODE_NO_WARNINGS=1 \
3643
START_SERVER_AND_TEST_INSECURE=1 \
3744
start-server-and-test \
38-
'run-p -ln start:icons start:host-dist start:pg start:prerender-dev start:prerender-manager-dev start:matrix start:smtp start:worker-development start:development' \
45+
'REALM_SERVER_SKIP_BOOT_INDEX=true run-p -ln start:icons start:host-dist start:pg start:prerender-dev start:prerender-manager-dev start:matrix start:smtp start:worker-development start:development' \
3946
"${BASE_REALM_READY}|${REALM_READY_SCHEME}://${REALM_BASE_URL#*://}/software-factory/${READY_PATH}|${MATRIX_URL_VAL}|http://localhost:5001|${ICONS_URL}|${HOST_URL}" \
4047
'run-p -ln start:worker-test start:test-realms' \
4148
"${NODE_TEST_REALM_READY}" \

packages/realm-server/main.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ const FULL_INDEX_ON_STARTUP_OVERRIDE =
153153
// test's first lookupDefinition.
154154
const SKIP_MODULES_CACHE_CLEAR_ON_STARTUP =
155155
process.env.REALM_SERVER_SKIP_MODULES_CACHE_CLEAR_ON_STARTUP === 'true';
156+
// When set to 'true', every realm in this process mounts and serves source
157+
// without running a from-scratch index on startup (even on a new/empty index).
158+
// Definitions resolve lazily via the prerenderer on first lookup. Used by the
159+
// realm-server test stack's boot realm server: the suite runs its own
160+
// in-process realms and only needs the boot realms to serve source, so
161+
// skipping their boot index removes both the ~minutes-long startup wait and
162+
// the prerender-pool contention that index would create with the tests.
163+
const SKIP_BOOT_INDEX = process.env.REALM_SERVER_SKIP_BOOT_INDEX === 'true';
156164
// CS-10953 cross-process prerender coalesce. Off by default — flip on
157165
// after a stage burn-in. Effectively inert at N=1 (no contention; the
158166
// in-process #inFlight coalescer already dedups same-process callers),
@@ -526,6 +534,7 @@ const smokeTestHostApp = async () => {
526534
},
527535
{
528536
...(fullIndexOnStartup ? { fullIndexOnStartup: true as const } : {}),
537+
...(SKIP_BOOT_INDEX ? { skipBootIndex: true as const } : {}),
529538
...(process.env.DISABLE_MODULE_CACHING === 'true'
530539
? { disableModuleCaching: true }
531540
: {}),

packages/runtime-common/realm.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,15 @@ interface Options {
669669
copiedFromRealm?: URL;
670670
fullIndexOnStartup?: true;
671671
fromScratchIndexPriority?: number;
672+
// When set, the realm mounts and serves source but does not run a
673+
// from-scratch index on startup, even when its index is empty (new). Card
674+
// definitions are still resolved lazily on demand via the prerenderer, so
675+
// source serving and definition lookup keep working. Used by the
676+
// realm-server test stack, whose suite runs its own in-process realms and
677+
// only needs the boot realms to serve source — skipping their boot index
678+
// removes both the startup wait and the prerender-pool contention it would
679+
// otherwise create with the tests.
680+
skipBootIndex?: true;
672681
}
673682

674683
interface UpdateItem {
@@ -700,6 +709,7 @@ export class Realm {
700709
#realmSecretSeed: string;
701710
#disableModuleCaching = false;
702711
#fullIndexOnStartup = false;
712+
#skipBootIndex = false;
703713
#fromScratchIndexPriority = systemInitiatedPriority;
704714
#definitionLookup: DefinitionLookup;
705715
#copiedFromRealm: URL | undefined;
@@ -842,6 +852,7 @@ export class Realm {
842852
this.#queue = queue;
843853
this.#virtualNetwork = virtualNetwork;
844854
this.#fullIndexOnStartup = opts?.fullIndexOnStartup ?? false;
855+
this.#skipBootIndex = opts?.skipBootIndex ?? false;
845856
this.#fromScratchIndexPriority =
846857
opts?.fromScratchIndexPriority ?? systemInitiatedPriority;
847858
this.#matrixClient = matrixClient;
@@ -2475,7 +2486,10 @@ export class Realm {
24752486
});
24762487
} else {
24772488
let isNewIndex = await this.#realmIndexUpdater.isNewIndex();
2478-
if (isNewIndex || this.#fullIndexOnStartup) {
2489+
if (this.#skipBootIndex) {
2490+
// Mount-and-serve only: no from-scratch index, even on a new index.
2491+
// Definitions resolve lazily via the prerenderer on first lookup.
2492+
} else if (isNewIndex || this.#fullIndexOnStartup) {
24792493
if (this.#fullIndexOnStartup) {
24802494
// CS-11245: bootstrap realms (kind='bootstrap': base,
24812495
// catalog, skills, …) full-index on every realm-server

0 commit comments

Comments
 (0)