Repository navigation
fix(binding-tcp): enforce per-route exit requirement for kind: server - #2241
Merged
Merged
Conversation
The anyOf branch intended to allow routes[].exit as an alternative to top-level exit only checked "required": ["exit"] directly against the routes array, which is vacuously true for any array instance. Wrap it in "items" so the check actually reaches each route object, rejecting a kind: server binding whose routes have no exit anywhere. Fixes #2239
An empty routes array satisfied the per-route exit check vacuously (items has nothing to iterate), so kind: server with routes: [] and no top-level exit still passed schema validation despite providing no usable exit at all. Add minItems: 1 to close this gap.
Contributor
Author
|
Pushed a follow-up commit: added Generated by Claude Code |
jfallows
pushed a commit
that referenced
this pull request
Jul 31, 2026
…t/proxy kind Now that binding-mcp-http supports kind: client (implicit sys:http_client exit via zilla.binding.mcp.http.client.exit, #2243), the generated mcp_http0 no longer needs to always be kind: proxy defaulting to a JVM-wide httpClientExit Configuration property owned by mcp_openapi itself. McpOpenapiCompositeGenerator now mirrors kind: proxy when a resolved exit exists (whether authored directly or passed through by a generator like binding-mcp-schema-registry), kind: client otherwise, relying entirely on mcp-http's own default. Removes the now-redundant zilla.binding.mcp.openapi.http.client.exit Configuration property. McpOpenapiClientIT and McpSchemaRegistryClientIT switch their exit override to zilla.binding.mcp.http.client.exit (owned by mcp-http) since there is no longer an mcp-openapi-level exit for kind: client. Also updates the mcp_openapi schema patch's kind: proxy per-route exit requirement to match binding-mcp-http's actual if/with-then/exit shape (and binding-tcp's now-fixed #2241 items-based enforcement) rather than the vacuous array-level "required" this mirrored initially. Rebased onto latest develop (#2241, #2243, #2244). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SgdvrgkrnhEy7uUpoan62L
jfallows
added a commit
that referenced
this pull request
Jul 31, 2026
…xit (#2242) * feat(binding-mcp-openapi): add kind: proxy variant with operator-declared exit Widens mcp_openapi's kind enum to [client, proxy]. kind: proxy requires exit (top-level or per-route, mirroring binding-tcp's kind: server pattern, written to actually enforce per-route via "contains" rather than tcp's vacuous array-typed "required"); kind: client keeps disallowing exit. McpOpenapiBindingConfig now resolves a binding-level exit from the engine's own pre-resolved route.id (set generically by EngineManager for every route before binding-specific code runs) rather than re-resolving the raw route.exit string, and McpOpenapiCompositeGenerator prefers it over the configured httpClientExit default when stamping mcp_http0's routes. McpOpenapiBinding/McpOpenapiBindingContext widen their kind == CLIENT gates to also accept PROXY, mirroring the client+proxy dual-kind pattern binding-mcp-schema-registry uses for its own kind: proxy variant. Adds McpOpenapiProxyIT (reusing the existing mcp/http .rpt scripts against a kind: proxy + exit fixture) and SchemaTest coverage for the valid/invalid kind/exit combinations. Fixes #2237 Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SgdvrgkrnhEy7uUpoan62L * refactor(binding-mcp-openapi): generate mcp_http0 with matching client/proxy kind Now that binding-mcp-http supports kind: client (implicit sys:http_client exit via zilla.binding.mcp.http.client.exit, #2243), the generated mcp_http0 no longer needs to always be kind: proxy defaulting to a JVM-wide httpClientExit Configuration property owned by mcp_openapi itself. McpOpenapiCompositeGenerator now mirrors kind: proxy when a resolved exit exists (whether authored directly or passed through by a generator like binding-mcp-schema-registry), kind: client otherwise, relying entirely on mcp-http's own default. Removes the now-redundant zilla.binding.mcp.openapi.http.client.exit Configuration property. McpOpenapiClientIT and McpSchemaRegistryClientIT switch their exit override to zilla.binding.mcp.http.client.exit (owned by mcp-http) since there is no longer an mcp-openapi-level exit for kind: client. Also updates the mcp_openapi schema patch's kind: proxy per-route exit requirement to match binding-mcp-http's actual if/with-then/exit shape (and binding-tcp's now-fixed #2241 items-based enforcement) rather than the vacuous array-level "required" this mirrored initially. Rebased onto latest develop (#2241, #2243, #2244). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SgdvrgkrnhEy7uUpoan62L * refactor(binding-mcp-openapi): propagate own kind onto generated mcp_http0 directly Replace the derived binding.exit != null ? PROXY : CLIENT check with a direct .kind(binding.kind) propagation. client (no exit anywhere) and proxy (exit required) now have a precisely-specified meaning enforced by the schema, and every caller of McpOpenapiBindingConfig lives in this codebase — so trust the kind a caller sets rather than deriving it defensively from exit presence. A caller that sets kind and exit inconsistently (e.g. kind: client with an exit stamped on a route) will now simply not route correctly, which is the right failure mode: it gets caught by tests and fixed at the source, rather than silently papered over here. Updates the one unit test exercising this path to author its binding as kind: proxy (the real, schema-valid way to declare an exit) instead of kind: client + exit (a caller-side inconsistency this no longer special-cases). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SgdvrgkrnhEy7uUpoan62L --------- Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
binding-tcp's schema patch requireskind: serverto declareexiteither top-level or per-route, via ananyOfwith two branches. The per-route branch checked"routes": { "required": ["exit"] }, but per JSON Schema semanticsrequiredonly constrains object instances —routesis atype: array, so the check was vacuously true against any array and never actually inspected route contents.Net effect: a
kind: serverbinding withroutes:and noexitanywhere (top-level or per-route) passed schema validation, when it should be rejected. Such a route resolves toroute.id = 0at engine-attach time (EngineManager.NameResolver.resolvereturns0Lfor anullname), silently breaking routing instead of failing at startup with a clear error.Fix: wrap the per-route check in
itemsso it actually reaches each route object:"routes": { "items": { "required": ["exit"] } }.Added
SchemaTestfixtures:server.routes.exit.yaml— routes with per-routeexit, no top-levelexit— confirms the intended valid case still passes.server.routes.exit.missing.invalid.yaml— routes with noexitanywhere — confirms it is now rejected. Verified this test fails for the right reason against the pre-fix schema.Fixes #2239
Test plan
./mvnw -pl specs/binding-tcp.spec test -Dtest=SchemaTest— all 15 cases passJsonExceptionwas not thrown)./mvnw -pl specs/binding-tcp.spec license:check checkstyle:checkpasses🤖 Generated with Claude Code
Generated by Claude Code