Skip to content

Commit 5cf1aa4

Browse files
committed
test(dogfood): read the object resources through a local helper, so the pin type-checks
The record reader called this.readResource inside the returned object literal, whose this tsc types as Booted | PromiseLike<Booted>. Claude-Session: https://claude.ai/code/session_01TgbP2QERdKmh147ohacHbK Co-authored-by: Claude <noreply@anthropic.com>
1 parent dc7bee1 commit 5cf1aa4

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎packages/qa/dogfood/test/mcp-stdio-package-object-discovery.test.ts‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,12 @@ async function boot(
330330
});
331331
session.notify('notifications/initialized');
332332

333+
const readResource = async (uri: string): Promise<any> => {
334+
const frame = await session.rpc('resources/read', { uri });
335+
expect(frame.error, `resources/read ${uri} failed at the protocol level`).toBeUndefined();
336+
return JSON.parse(frame.result.contents[0].text as string);
337+
};
338+
333339
return {
334340
kernel,
335341
engine,
@@ -344,13 +350,9 @@ async function boot(
344350
return { isError: frame.result.isError === true, text, json };
345351
},
346352
async readRecord(object, id) {
347-
return this.readResource(`objectstack://objects/${object}/records/${id}`);
348-
},
349-
async readResource(uri) {
350-
const frame = await session.rpc('resources/read', { uri });
351-
expect(frame.error, `resources/read ${uri} failed at the protocol level`).toBeUndefined();
352-
return JSON.parse(frame.result.contents[0].text as string);
353+
return readResource(`objectstack://objects/${object}/records/${id}`);
353354
},
355+
readResource,
354356
};
355357
}
356358

0 commit comments

Comments
 (0)