mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 14:59:05 +00:00
test(mcp): share source publication router fixtures (#16526)
This commit is contained in:
1 parent
d0e94a19e1
commit
e8ca68f637
1 file changed
+18
-39
@@ -17,11 +17,14 @@ import { compareApplicationVersionsEvidence } from "../../../src/application/jav
|
||||
import { createToolResultDelivery } from "../../../src/server/toolResult.js";
|
||||
import { recoveryOmissionRemediation } from "../../../src/domain/analysisErrorProjection.js";
|
||||
|
||||
const sourceOnlyRouter = () =>
|
||||
createTestProviderRouter(() => {
|
||||
throw new Error("no provider needed");
|
||||
});
|
||||
|
||||
it("preserves the source when an inline result with unknown retention exceeds delivery", async () => {
|
||||
const session = new BinarySession(
|
||||
createTestProviderRouter(() => {
|
||||
throw new Error("no provider needed");
|
||||
}),
|
||||
sourceOnlyRouter(),
|
||||
new InvestigationRecords({ maximumRepresentationBytes: 0 }),
|
||||
);
|
||||
const input = JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE;
|
||||
@@ -62,9 +65,7 @@ it("preserves the source when an inline result with unknown retention exceeds de
|
||||
await full.close();
|
||||
|
||||
const boundedSession = new BinarySession(
|
||||
createTestProviderRouter(() => {
|
||||
throw new Error("no provider needed");
|
||||
}),
|
||||
sourceOnlyRouter(),
|
||||
new InvestigationRecords({ maximumRepresentationBytes: 0 }),
|
||||
);
|
||||
const { client } = await createApplicationMcpHarness({
|
||||
@@ -105,9 +106,7 @@ it("preserves both identities and distinct retention when neither payload fits t
|
||||
);
|
||||
if (!completed.ok) throw completed.error;
|
||||
const session = new BinarySession(
|
||||
createTestProviderRouter(() => {
|
||||
throw new Error("no provider needed");
|
||||
}),
|
||||
sourceOnlyRouter(),
|
||||
new InvestigationRecords({ maximumRepresentationBytes: 0 }),
|
||||
);
|
||||
const { client } = await createApplicationMcpHarness({
|
||||
@@ -162,12 +161,7 @@ it("does not infer ledger membership from an independently registered reader", a
|
||||
maximumRepresentationBytes: sizing.statistics().retainedRepresentationBytes,
|
||||
});
|
||||
expect(records.recordEvidence(computed.value.evidence).ok).toBe(true);
|
||||
const session = new BinarySession(
|
||||
createTestProviderRouter(() => {
|
||||
throw new Error("no provider needed");
|
||||
}),
|
||||
records,
|
||||
);
|
||||
const session = new BinarySession(sourceOnlyRouter(), records);
|
||||
const { client } = await createApplicationMcpHarness({ session });
|
||||
const response = await client.callTool({
|
||||
name: "compare_application_versions",
|
||||
@@ -200,9 +194,7 @@ it.each([
|
||||
"returns completed $name with honest retention when source recording fails",
|
||||
async ({ name, input, kind }) => {
|
||||
const session = new BinarySession(
|
||||
createTestProviderRouter(() => {
|
||||
throw new Error("no provider needed");
|
||||
}),
|
||||
sourceOnlyRouter(),
|
||||
new InvestigationRecords({ maximumRepresentationBytes: 0 }),
|
||||
);
|
||||
const { client } = await createApplicationMcpHarness({ session });
|
||||
@@ -233,12 +225,7 @@ it.each(["zero", "normal"] as const)(
|
||||
const records = new InvestigationRecords(
|
||||
mode === "zero" ? { maximumRepresentationBytes: 0 } : {},
|
||||
);
|
||||
const session = new BinarySession(
|
||||
createTestProviderRouter(() => {
|
||||
throw new Error("no provider needed");
|
||||
}),
|
||||
records,
|
||||
);
|
||||
const session = new BinarySession(sourceOnlyRouter(), records);
|
||||
const { client } = await createApplicationMcpHarness({ session });
|
||||
const input = { ...FUNCTION_COMPARISON_EXAMPLE };
|
||||
const expected = compareFunctionEvidence(input);
|
||||
@@ -296,12 +283,7 @@ it("reports a preexisting primary when source admission fails", async () => {
|
||||
maximumRepresentationBytes: sizing.statistics().retainedRepresentationBytes,
|
||||
});
|
||||
expect(records.recordEvidence(expected.value.evidence).ok).toBe(true);
|
||||
const session = new BinarySession(
|
||||
createTestProviderRouter(() => {
|
||||
throw new Error("no provider needed");
|
||||
}),
|
||||
records,
|
||||
);
|
||||
const session = new BinarySession(sourceOnlyRouter(), records);
|
||||
const { client } = await createApplicationMcpHarness({ session });
|
||||
const response = await client.callTool({
|
||||
name: "compare_functions",
|
||||
@@ -341,9 +323,7 @@ it.each([
|
||||
"returns the selected $name view when source publication is refused",
|
||||
async ({ name, input }) => {
|
||||
const session = new BinarySession(
|
||||
createTestProviderRouter(() => {
|
||||
throw new Error("no provider needed");
|
||||
}),
|
||||
sourceOnlyRouter(),
|
||||
new InvestigationRecords({ maximumRepresentationBytes: 0 }),
|
||||
);
|
||||
const { client } = await createApplicationMcpHarness({ session });
|
||||
@@ -380,11 +360,10 @@ it.each([
|
||||
] as const)(
|
||||
"preserves the completed $name parent when a selected view cannot be retained",
|
||||
async ({ name, input }) => {
|
||||
const router = () =>
|
||||
createTestProviderRouter(() => {
|
||||
throw new Error("no provider needed");
|
||||
});
|
||||
const normal = new BinarySession(router(), new InvestigationRecords());
|
||||
const normal = new BinarySession(
|
||||
sourceOnlyRouter(),
|
||||
new InvestigationRecords(),
|
||||
);
|
||||
const normalHarness = await createApplicationMcpHarness({
|
||||
session: normal,
|
||||
});
|
||||
@@ -402,7 +381,7 @@ it.each([
|
||||
expect(sizing.recordEvidence(source).ok).toBe(true);
|
||||
}
|
||||
const session = new BinarySession(
|
||||
router(),
|
||||
sourceOnlyRouter(),
|
||||
new InvestigationRecords({
|
||||
maximumRepresentationBytes:
|
||||
sizing.statistics().retainedRepresentationBytes,
|
||||
|
||||
Reference in new issue
Block a user