Skip to content

Commit fbc8206

Browse files
committed
test(cli): pay the serve test's dynamic-import loads at module top
The host crypto provider test imports `serve.ts`, which reaches eight packages through function-body `import()` calls. check-test-source-alias's source-reach half (#30969) asks a changed test file to pay those first loads during collection, so the file now imports them for their side effects at module top, as the other serve-reaching cli tests do (#10126). serve.ts keeps its dynamic imports. Also notes in serve.ts that the host provider's init-done reading assumes `ctx.getKernel`. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4czs7cUFAphQEUFSrcz
1 parent 816331a commit fbc8206

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎packages/cli/src/commands/serve-host-crypto-provider.test.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,17 @@ import {
6565
refuseTwoCryptoProviderPlugins,
6666
} from './serve.js';
6767

68+
// [#10126] Pay the first load of what `serve.ts` reaches through dynamic
69+
// `import()`s at MODULE LOAD, outside any clocked case.
70+
import '@objectstack/metadata-protocol';
71+
import '@objectstack/metadata';
72+
import '@objectstack/plugin-hono-server';
73+
import '@objectstack/rest';
74+
import '@objectstack/driver-turso';
75+
import '@objectstack/driver-sql';
76+
import '@objectstack/platform-objects/plugin';
77+
import '@objectstack/plugin-security';
78+
6879
/** …/packages/cli/src/commands — seeded from `import.meta.url`. */
6980
const HERE = resolve(fileURLToPath(import.meta.url), '..');
7081
/** `serve.ts`'s CODE, with every comment span blanked. */

‎packages/cli/src/commands/serve.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6339,6 +6339,8 @@ export function createHostCryptoProvider(local: () => ICryptoProvider): {
63396339
read: () => ctx.getServices().get(CRYPTO_PROVIDER_SERVICE),
63406340
// Every init() has run once the kernel leaves `initializing` (Phase 2
63416341
// begins) — read where the question is asked, never recorded here.
6342+
// Assumes `ctx.getKernel` (ObjectKernel's context has it); without it
6343+
// nothing is chosen before this plugin's own `kernel:ready` hook.
63426344
initDone: () => {
63436345
const state = ctx.getKernel?.()?.getState?.();
63446346
return ready || (state !== undefined && state !== 'idle' && state !== 'initializing');

0 commit comments

Comments
 (0)