Skip to content

Commit 0ab98ac

Browse files
committed
test(dogfood): a stored entry under a host plugin connector's name across a restart (WIP)
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5oNHddQQdvMrpeQxiJ
1 parent 240082d commit 0ab98ac

2 files changed

Lines changed: 32 additions & 3 deletions

File tree

‎packages/core/src/kernel.boot-phase-hooks.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ describe('ObjectKernel bootPhaseHooks', () => {
124124
const reader: Plugin = {
125125
name: 'test.reader',
126126
version: '1.0.0',
127+
init: async () => {},
127128
start: async (ctx) => { read.push(ctx.getKernel().dispatchesBootPhaseHooks()); },
128129
};
129130
const kernel = track(newKernel({ bootPhaseHooks: false }));
@@ -243,6 +244,7 @@ describe('ObjectKernel bootPhaseHooks', () => {
243244
const reader: Plugin = {
244245
name: 'test.reader',
245246
version: '1.0.0',
247+
init: async () => {},
246248
start: async (ctx) => { read.push(ctx.getKernel().dispatchesBootPhaseHooks()); },
247249
};
248250
const kernel = track(newKernel(extra));

‎packages/qa/dogfood/test/stored-connector-package-ref-restart.dogfood.test.ts‎

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,22 @@
2323
// environment-wide stdio `mcp` entry, and a control carrying its document
2424
// inline. [#28698] It also saves an environment-wide entry naming a provider
2525
// no installed plugin offers (accepted at save, skipped after boot: the shape
26-
// a row takes when the plugin that offered its provider is removed). The
27-
// second boot:
26+
// a row takes when the plugin that offered its provider is removed).
27+
// [#28713] And an environment-wide entry under the name of a connector a host
28+
// plugin registers (`slack`, ConnectorSlackPlugin): accepted at save, not
29+
// served beside the plugin's connector while the platform runs. The second
30+
// boot:
2831
//
2932
// 1. starts (no throw);
3033
// 2. does not list any refused entry, and its boot record names each entry
3134
// and its ref (or, for the unknown provider, the provider);
3235
// 3. lists the stored inline control `ready` with its operation (the rows
3336
// were hydrated, so the refusal above was read at boot, not skipped);
34-
// 4. lists the showcase's own file-ref and stdio entries `ready` (control).
37+
// 4. lists the showcase's own file-ref and stdio entries `ready` (control);
38+
// 5. [#28713] lists the plugin's `slack` connector `ready` with the plugin's
39+
// actions, not the stored entry's, and its boot record names the stored
40+
// entry; the stored inline control is already `ready` on the first read
41+
// after the start (it is served before the server answers).
3542
//
3643
// Boots fixture stacks of its own (a database file), so it stays out of
3744
// `SHARED_SHOWCASE`.
@@ -53,6 +60,8 @@ const AUTHORED_PACKAGE_ID = 'com.dogfood.storedrestart';
5360
const INLINE = 'srr_inline';
5461
/** [#28698] A stored entry whose provider no installed plugin offers. */
5562
const UNKNOWN_PROVIDER = 'srr_unknown_provider';
63+
/** [#28713] The name of the connector ConnectorSlackPlugin registers on the showcase. */
64+
const PLUGIN_NAME = 'slack';
5665
const HOST_FILE_ENTRY = 'showcase_status_openapi';
5766
const HOST_STDIO_ENTRY = 'showcase_mcp_tools';
5867

@@ -126,6 +135,7 @@ describe('dogfood: a stored connector entry refused its package-relative ref doe
126135
let before: Answer;
127136
let bootError: unknown;
128137
let after: Answer;
138+
let firstRead: Answer;
129139
let bootLines: string[] = [];
130140
let second: VerifyStack | undefined;
131141

@@ -154,6 +164,7 @@ describe('dogfood: a stored connector entry refused its package-relative ref doe
154164
...openapi(UNKNOWN_PROVIDER, DOCUMENT),
155165
provider: 'no_such_provider',
156166
}));
167+
saves[PLUGIN_NAME] = await json(await first.apiAs(token, 'PUT', `/meta/connector/${PLUGIN_NAME}`, openapi(PLUGIN_NAME, DOCUMENT)));
157168
saves[INLINE] = await json(await first.apiAs(token, 'PUT', `/meta/connector/${INLINE}`, openapi(INLINE, DOCUMENT)));
158169
before = await settle(first, token, [INLINE]);
159170
} finally {
@@ -168,6 +179,7 @@ describe('dogfood: a stored connector entry refused its package-relative ref doe
168179
return undefined;
169180
}
170181
const token = await second.signIn();
182+
firstRead = await json(await second.apiAs(token, 'GET', '/automation/connectors'));
171183
return settle(second, token, [INLINE, HOST_FILE_ENTRY, HOST_STDIO_ENTRY]);
172184
});
173185
bootLines = captured.lines;
@@ -186,6 +198,8 @@ describe('dogfood: a stored connector entry refused its package-relative ref doe
186198
expect(entryOf(before, INLINE)?.state, shown(before, INLINE)).toBe('ready');
187199
expect(entryOf(before, ENV_FILE), shown(before, ENV_FILE)).toBeUndefined();
188200
expect(entryOf(before, UNKNOWN_PROVIDER), shown(before, UNKNOWN_PROVIDER)).toBeUndefined();
201+
// [#28713] While the platform runs, the plugin's connector keeps the name.
202+
expect(entryOf(before, PLUGIN_NAME)?.actions?.map((a: any) => a.key), shown(before, PLUGIN_NAME)).not.toContain('GetThings');
189203
});
190204

191205
it('the second boot over the same database starts', () => {
@@ -210,6 +224,19 @@ describe('dogfood: a stored connector entry refused its package-relative ref doe
210224
expect(record).toContain('no provider factory is registered');
211225
});
212226

227+
it('[#28713] a stored entry under a host plugin connector\'s name: the plugin\'s connector lists ready after the restart, and the boot record names the stored entry', () => {
228+
const plugin = entryOf(after, PLUGIN_NAME);
229+
expect(plugin?.state, shown(after, PLUGIN_NAME)).toBe('ready');
230+
expect(plugin.actions.map((a: any) => a.key)).not.toContain('GetThings');
231+
expect(plugin.actions.length).toBeGreaterThan(0);
232+
const record = bootLines.find((l) => l.includes(`declarative provider-bound instance '${PLUGIN_NAME}' collides with a plugin-registered connector`));
233+
expect(record, `no boot record names '${PLUGIN_NAME}'`).toBeDefined();
234+
});
235+
236+
it('[#28713] control: the stored inline entry is already ready on the first read after the restart', () => {
237+
expect(entryOf(firstRead, INLINE)?.state, shown(firstRead, INLINE)).toBe('ready');
238+
});
239+
213240
it('controls: the stored inline entry, and the showcase\'s own file-ref and stdio entries, list ready after the restart', () => {
214241
expect(entryOf(after, INLINE)?.state, shown(after, INLINE)).toBe('ready');
215242
expect(entryOf(after, INLINE).actions.map((a: any) => a.key)).toEqual(['GetThings']);

0 commit comments

Comments
 (0)