From 4a273ce7bbe503bf2206902117da923c62bd6975 Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Date: Mon, 27 Jul 2026 15:55:44 +0000 Subject: [PATCH] Fix main: bridge test references removed meta key set main does not build its tests: pkg/vmcp/server/bridge_regression_test.go references mcpparser.ReservedModernMetaKeys, which no longer exists. Both `go vet ./...` and `task lint` fail for everyone on main. Neither PR was wrong on its own. #6024 replaced the enumerated reserved-key slice with ReservedMetaPrefix plus a passthrough exemption, converting the three call sites that existed on its branch. #6006 added this file, which uses the old symbol. Each was green; the merge of both is not -- the same semantic-conflict class as an interface change landing beside a new call site. Convert the assertion to the prefix scan #6024 established in modern_envelope_test.go and revision_realbackend_test.go. This is also strictly stronger than the original: it catches any reserved key, including ones added after this test was written, rather than only the four the old slice happened to list. The passthrough keys are mirrored locally because pkg/mcp's set is unexported, with a comment to keep them in sync. --- pkg/vmcp/server/bridge_regression_test.go | 28 +++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/pkg/vmcp/server/bridge_regression_test.go b/pkg/vmcp/server/bridge_regression_test.go index da4d473ce0..fbbef7d331 100644 --- a/pkg/vmcp/server/bridge_regression_test.go +++ b/pkg/vmcp/server/bridge_regression_test.go @@ -11,6 +11,7 @@ import ( "net/http" "net/http/httptest" "slices" + "strings" "sync" "testing" "time" @@ -467,8 +468,19 @@ func TestRegression_BridgeCellA_PerPrincipalSessionIsolation(t *testing.T) { // Modern client's request carries reserved io.modelcontextprotocol/* _meta // keys, but vMCP -- not the downstream caller -- is the Legacy backend's MCP // peer on this hop, and go-sdk v1.7 hard-rejects (HTTP 400) ANY +// legacyRequestPassthroughMetaKeys mirrors pkg/mcp's unexported +// passthroughMetaKeys: the reserved keys StripReservedMeta deliberately does NOT +// remove, because they are end-to-end payload for the original endpoints rather +// than per-hop control. Duplicated here only because the production set is +// unexported; keep the two in sync, and prefer widening the production set over +// adding exemptions here. +var legacyRequestPassthroughMetaKeys = map[string]struct{}{ + mcpparser.ReservedMetaPrefix + "related-task": {}, + mcpparser.ReservedMetaPrefix + "model-immediate-response": {}, +} + // _meta.protocolVersion on a stateful server. legacyCallTool strips them via -// mcpparser.StripReservedModernMeta before forwarding +// mcpparser.StripReservedMeta before forwarding // (pkg/vmcp/client/client.go); this asserts the Legacy backend receives NO // io.modelcontextprotocol/* key in the tools/call request body it actually // gets. Request path only -- response _meta is issue #5986's scope. @@ -503,10 +515,16 @@ func TestRegression_BridgeCellA_NoReservedMetaLeakToLegacyBackend(t *testing.T) sawToolCall = true params, _ := r.body["params"].(map[string]any) meta, _ := params["_meta"].(map[string]any) - for _, reserved := range mcpparser.ReservedModernMetaKeys { - _, present := meta[reserved] - assert.False(t, present, - "Legacy backend must never see reserved Modern _meta key %q on the request path; got %+v", reserved, meta) + // Scan by prefix rather than against a fixed key list: #6024 replaced the + // enumerated strip set with ReservedMetaPrefix + a passthrough exemption, + // so a prefix scan also catches reserved keys added later. Matches the + // assertion style in modern_envelope_test.go and revision_realbackend_test.go. + for k := range meta { + if _, passthrough := legacyRequestPassthroughMetaKeys[k]; passthrough { + continue + } + assert.False(t, strings.HasPrefix(k, mcpparser.ReservedMetaPrefix), + "Legacy backend must never see reserved Modern _meta key %q on the request path; got %+v", k, meta) } assert.Equal(t, "n1", meta["vmcp.test/nonce"], "the strip must be surgical, not a blanket _meta drop; got %+v", meta)