Skip to content

Commit 7b34bf2

Browse files
KSemenenkoclaude
andcommitted
Use ManagedCode.MarkdownLd.Kb 0.2.18 and test the gateway's schema refusal
MarkdownLd.Kb serialized every full-text index build in the process behind one static lock, so hosted test fixtures, each building its MCP tool-search graph, queued behind each other. 0.2.18 (released today, commit 397dc77) keeps exclusion only around dotNetRDF's shared static SHA-256 instance (reported upstream as dotnetrdf/dotnetrdf#913), so independent builds run in parallel. McpGatewayCatalogAdapterTests now calls the gateway with schema-valid arguments to prove that a tool without an admitted request does not dispatch (RecoveryRequired), and checks that arguments outside the canonical input schema are refused as Validation, the mapping added in 10bdb9a. Verification: restore and solution build with -warnaserror pass; McpGatewayCatalogAdapterTests pass. Hosted unit namespaces at ten parallel tests still time out in McpGatewayCatalogOwner.BuildInstanceAsync because every host rebuilds the same ~600 ms / ~500 MB gateway index; that is being fixed in ManagedCode.MCPGateway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent ae80955 commit 7b34bf2

3 files changed

Lines changed: 20 additions & 11 deletions

File tree

‎Directory.Packages.props‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<PackageVersion Include="ManagedCode.Orleans.Graph" Version="10.4.7" />
2020
<PackageVersion Include="ManagedCode.Orleans.Identity.Core" Version="10.4.2" />
2121
<PackageVersion Include="ManagedCode.MCPGateway" Version="2.3.0" />
22-
<PackageVersion Include="ManagedCode.MarkdownLd.Kb" Version="0.2.17" />
22+
<PackageVersion Include="ManagedCode.MarkdownLd.Kb" Version="0.2.18" />
2323
<!-- Central transitive dependency used by Aspire and StreamJsonRpc. -->
2424
<PackageVersion Include="MessagePack" Version="3.1.12" />
2525
<PackageVersion Include="Microsoft.Extensions.AI" Version="10.11.0" />

‎scripts/Features/CodeQuality/functional-coverage.unit-test-inventory.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8255,9 +8255,9 @@
82558255
"methodName": "GatewayInvocationCannotDispatchWithoutCurrentAdmittedRequest",
82568256
"instanceName": "GatewayInvocationCannotDispatchWithoutCurrentAdmittedRequest",
82578257
"sourcePath": "tests/KeyLoad.UnitTests/ClientApi/Cases/McpGateway/McpGatewayCatalogAdapterTests.cs",
8258-
"sourceSha256": "919de38273c66dd0a602cd94fce768a67537941189acfeb454de7fe793cff723",
8259-
"lineNumber": 23,
8260-
"endLineNumber": 35,
8258+
"sourceSha256": "b6976151f0bebad9d2443b1dee74a31a4223bc89993022de9375a3b560863f66",
8259+
"lineNumber": 24,
8260+
"endLineNumber": 44,
82618261
"classification": "functional",
82628262
"exclusionReason": null,
82638263
"requirements": [
@@ -59908,9 +59908,9 @@
5990859908
"methodName": "FunctionExposesExactCanonicalNameDescriptionAndSchemas",
5990959909
"instanceName": "FunctionExposesExactCanonicalNameDescriptionAndSchemas",
5991059910
"sourcePath": "tests/KeyLoad.UnitTests/ClientApi/Cases/McpGateway/McpGatewayCatalogAdapterTests.cs",
59911-
"sourceSha256": "919de38273c66dd0a602cd94fce768a67537941189acfeb454de7fe793cff723",
59912-
"lineNumber": 11,
59913-
"endLineNumber": 21,
59911+
"sourceSha256": "b6976151f0bebad9d2443b1dee74a31a4223bc89993022de9375a3b560863f66",
59912+
"lineNumber": 12,
59913+
"endLineNumber": 22,
5991459914
"classification": "required-non-contributor",
5991559915
"exclusionReason": null,
5991659916
"requirements": [

‎tests/KeyLoad.UnitTests/ClientApi/Cases/McpGateway/McpGatewayCatalogAdapterTests.cs‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
namespace KeyLoad.UnitTests.ClientApi;
55

6-
/// <summary>AC-MCPGW-004: local invokers preserve descriptor identity and fail closed without request admission.</summary>
6+
/// <summary>AC-MCPGW-004: local invokers preserve descriptor identity, fail closed without request admission and refuse
7+
/// arguments outside the canonical input schema as Validation.</summary>
78
internal sealed class McpGatewayCatalogAdapterTests
89
{
910
private const string DocumentGet = "keyload_documents_get";
@@ -26,11 +27,19 @@ public async Task GatewayInvocationCannotDispatchWithoutCurrentAdmittedRequest()
2627
await using var host = McpGatewayCatalogTestHost.Create();
2728
await host.Owner.InitializeAsync(CancellationToken.None);
2829

30+
// Schema-valid arguments reach the tool, which refuses because no admitted request owns the call.
31+
var admittedShape = new Dictionary<string, System.Text.Json.JsonElement>
32+
{
33+
[McpCanonicalTestData.RequestKey] = System.Text.Json.JsonSerializer.SerializeToElement(
34+
new GetDocumentRequest(McpCanonicalTestData.Reference), JsonDefaults.Options)
35+
};
2936
var failure = await Assert.ThrowsExactlyAsync<KeyLoadException>(() => host.Owner.InvokeAsync(
30-
DocumentGet,
31-
new Dictionary<string, System.Text.Json.JsonElement>(),
32-
CancellationToken.None));
37+
DocumentGet, admittedShape, CancellationToken.None));
3338
await Assert.That(failure).IsNotNull();
3439
await Assert.That(failure!.Code).IsEqualTo(ErrorCode.RecoveryRequired);
40+
41+
var malformed = await Assert.ThrowsExactlyAsync<KeyLoadException>(() => host.Owner.InvokeAsync(
42+
DocumentGet, new Dictionary<string, System.Text.Json.JsonElement>(), CancellationToken.None));
43+
await Assert.That(malformed!.Code).IsEqualTo(ErrorCode.Validation);
3544
}
3645
}

0 commit comments

Comments
 (0)