Skip to content

Canonicalize/un-canonicalize request path at server/client stream-factory boundary - #2152

Merged
jfallows merged 39 commits into
developfrom
claude/github-issue-2145-yv5ch7
Jul 14, 2026
Merged

jfallows merged 39 commits into
developfrom
claude/github-issue-2145-yv5ch7

Conversation

@jfallows

Copy link
Copy Markdown
Contributor

Description

Fixes #2145.

Closes the abstraction leak identified in #2145: the deployment-specific
connection shape (:scheme/:authority/path prefix) no longer needs to
leak past the server/client stream-factory boundary for either openapi or
asyncapi.

binding-openapi (OpenapiServerFactory/OpenapiClientFactory):
canonicalizes the decoded HttpBeginEx down to the spec's own literal,
unresolved operation path template on the way in, and un-canonicalizes
(reapplies the resolved deployment :scheme/:authority/path prefix) on
the way out. options.specs.*.server became a plural, relocatable
servers[] list with round-robin client selection; when.servers/when.tag
route conditions decoupled from the deployment override, matching the
spec's own literal declared values instead.

binding-asyncapi (AsyncapiServerFactory/AsyncapiClientFactory):
mirrors the same canonicalize/un-canonicalize pattern for HTTP and SSE
(MQTT carries no non-relocatable server info in its BeginEx and needs no
change — verified against the IDL and left untouched, protected by the
existing byte-for-byte MQTT scripts). Also fixes a related, previously
latent bug: AsyncapiServerGenerator parsed a spec's declared
servers.*.pathname but never combined it with channel.address when
generating HTTP/SSE request paths and routes, so a spec-compliant client
prefixing requests with that pathname would 404 — fixed test-first
alongside the canonicalization work.

Verified per the issue's scope item: openapi-asyncapi's generated
http_kafka_proxy0 routing and asyncapi's own proxy (mqtt-kafka/sse-kafka/
http-kafka) route generation and runtime dispatch already key exclusively on
canonical channel.address/operation data, never on the deployment
server/servers config — no changes were needed there, confirming the
abstraction leak is fully closed.

Test plan

  • ./mvnw -pl runtime/binding-openapi clean verify — all unit tests + k3po ITs green
  • ./mvnw -pl runtime/binding-asyncapi clean verify — all unit tests + k3po ITs green (18 ITs)
  • ./mvnw -pl runtime/binding-openapi-asyncapi clean verify — green except one pre-existing,
    unrelated failure (OpenapiAsyncapiIT.shouldCreatePetWithServerPathPrefix), confirmed via
    git stash to reproduce identically on the pre-branch baseline
  • ./mvnw checkstyle:check / license:check clean on all touched modules
  • New test-first k3po fixtures proving: HTTP/SSE canonicalize+un-canonicalize round-trip,
    pathname-combination bug fix, MQTT no-op (existing byte-for-byte scripts unchanged)

Generated by Claude Code

claude added 30 commits July 12, 2026 23:48
…pe at server/client boundary

Follow-up to #2113/#2128: implements #2145's canonicalize/un-canonicalize
proposal so openapi-asyncapi and downstream bindings operate purely on
canonical specId/operationId terms, never on options.specs.*.server.

Foundational fixes required first (found while implementing):

- options.specs.<label>.server now wholesale-replaces a single declared
  server's URL instead of falling back to the literal default and
  double-prefixing the override's path on top of it (server.route.prefix.yaml
  was asserting the resulting double-prefixed /apis/v1/pets as correct).
  Multi-server exact-match disambiguation (for when.servers routing) is
  preserved unchanged.
- TCP/TLS listen-address selection (ports/injectTcpRoutes/injectTlsRoutes)
  now reads literalUrl instead of url, since url can now diverge in
  scheme/host from the spec's own declared listen address once an override
  is wholesale-applied.
- Zero declared servers (at any level) now synthesize the OpenAPI-spec's
  own implicit {url: "/"} default instead of leaving servers null, fixing a
  pre-existing silent-unreachable-route/latent-NPE gap and removing a case
  the canonicalization logic would otherwise need to special-case.

Canonicalization itself:

- OpenapiServerFactory now rewrites the HttpBeginEx it forwards downstream:
  drops :scheme/:authority and rewrites :path down to the operation's own
  canonical (unprefixed) shape, via a new OpenapiBindingConfig.resolve(...)
  entry point.
- OpenapiClientFactory reconstructs the effective, deployment-specific
  shape (re-injecting :scheme/:authority, re-prefixing :path) via the
  symmetric OpenapiBindingConfig.resolve(...) overload before handing off
  to the generated http_client0 binding.
- OpenapiServerView gains effectivePrefixLength()/canonicalPrefixLength(),
  pure functions of url/literalUrl, used by both rewrite directions.
- binding-openapi-asyncapi needs no code change: it already always parses
  with an empty OpenapiServerConfig, so its generated http_kafka_proxy0
  when.path conditions were already canonical-shaped; they become correct
  now that the upstream bytes are too.

Verified: full ./mvnw verify green on runtime/binding-openapi,
runtime/common-openapi, specs/binding-openapi.spec, and
runtime/binding-openapi-asyncapi (unchanged, confirming no regression).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…, derive canonical path from operation

OpenapiServerView (and OpenapiView/OpenapiOperationView) no longer take an
options.specs.*.server override at construction time - they stay a faithful,
config-free view of the parsed spec. Generators combine that pure view with
the binding's own options.specs.*.server via OpenapiBindingConfig.resolveEffectiveUrl,
instead of baking the override into the view itself.

This also simplifies the runtime (un)canonicalize transform at the
server/client boundary: canonicalizing no longer needs any prefix-length
arithmetic or config lookup at all - it just rebuilds :path from the already
resolved operation's own path against the canonical server. Un-canonicalizing
on the client side resolves the effective base (override or canonical) once
per BEGIN and reconstructs :scheme/:authority/:path from it.

Fixes the canonical path shape itself: it must retain the spec's own declared
server prefix (e.g. /v1/pets) rather than the bare operation path, which is
what the openapi-asyncapi proxy's independently generated Kafka route
already expects. Adds a red/green composite test
(shouldCreatePetWithServerPathPrefix) proving a server path-prefix override
combined with Kafka-proxying now routes correctly.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…ctiveUrl into resolveServer

The two static helpers were always called back-to-back at every call site
(look up the override, then combine it with the canonical view), so fold
them into one instance method on OpenapiBindingConfig - the natural owner,
since it already holds the options this combination depends on.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…es TCP/TLS/HTTP uniformly, make it required

options.specs.*.server is meant to make the API's base URL wholesale
relocatable (per OpenAPI's own servers: semantics) - so it must drive TCP/TLS
listen address and HTTP path generation together, not just HTTP path while
TCP/TLS stay pinned to the spec's own declared server. Collapses
resolveServerOverride+resolveEffectiveUrl into a single resolveBaseURL(specLabel)
returning the resolved override URI directly (no server/singular argument
needed - override, when present, always wins wholesale, uniformly across every
declared server for that spec label, since there's exactly one physical
deployment target).

Since an override now determines physical bind behavior, options.specs.*.server
becomes a required field in the openapi binding's JSON schema (previously
optional) - omitting it left "does this spec have a real deployment address"
ambiguous. Existing fixtures whose override previously differed from the
physical listen address (e.g. https://frontend.example.com) are updated to a
value consistent with where they actually listen, to avoid needing to fabricate
TLS material just for the override's scheme to be real.

Fixture updates for the remaining configs that omitted options.specs.*.server
entirely are in progress as a follow-up commit.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…nfig fixtures

Follow-up to 702dc0a, which made options.specs.*.server required in the
openapi binding's JSON schema. These fixtures previously omitted it entirely;
each now declares a server matching its own embedded spec's canonical
servers: url, so behavior is unchanged.

Remaining binding-openapi-asyncapi.spec fixtures still need the same fix.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…nerator, add missing server: fixture

OpenapiClientGenerator.injectHttpRequests had a leftover extra closing block
from an earlier edit (dropped the now-unneeded singular local but left its
enclosing braces behind). server.secure.yaml was missed by the earlier
required-server fixture pass because it also declares a `server:` vault,
which threw off the file-level grep check.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…ver is required

resolveBaseURL never returns a missing override for a schema-valid config, so
the generators and OpenapiBindingConfig.resolve() no longer need to fall back
to each canonical server's own url. TCP/TLS/HTTP server generation and the
client's scheme/authority/path resolution now use a single resolved base URL
directly. Per-operation HTTP request/response validation entries collapse to
one per operation instead of one per declared canonical server, since they'd
otherwise be exact duplicates - only the per-server compositeId route
disambiguation in injectHttpRoutes still iterates every declared server,
since that's what lets OpenapiServerFactory resolve which canonical server
matched for routes[].when.servers filtering.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…p no-override fallback

Mirrors the binding-openapi fix: options.specs.*.server is now schema-required
for server/client/proxy kinds, since a spec's declared server is meant to be
wholesale relocatable, not merged with a deployment-specific override. Drops
the now-dead null-server fallback branches in AsyncapiClientGenerator and
AsyncapiCompositeGenerator.

Known consequence, accepted: a multi-broker Kafka bootstrap list in a spec's
servers: collapses to the single configured override broker, since the
override is one address, not a list.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…locatable base-URL list

Replace the singular required options.specs.<name>.server string with a
servers array (minItems 1). A spec's declared servers can now be relocated
to several equivalent deployment base URLs at once, not just one.

Server kind fans out TCP/TLS/HTTP route and request-template generation
across every configured server URI within the same tcp_server0/tls_server0/
http_server0 trio, instead of one physical listener per override.

Client kind keeps a single http_client0/tls_client0 pair; OpenapiClientFactory
now round-robins across the configured servers per (binding, spec) so every
entry is a real, reachable target, and drops the static ":authority" options
override that would have clobbered per-stream dynamic target selection.

Also removes routes[].when[].servers: tracing OpenapiServerFactory showed it
already matched against the canonical per-declared-server url while every
generated route for an operation carried an identical :path condition once
the override became uniform, so the filter had already gone silently inert.

repurpose server.route.servers.yaml as a multiple-servers regression fixture
now that its former when.servers-based route disambiguation is gone.
…po IT

Drop OpenapiClientFactoryTest (this binding proves stream-factory behavior
through k3po ITs, not Mockito unit tests, matching every other test class in
this module). Add OpenapiClientIT#shouldRoundRobinAcrossServers instead: a
two-server client config with real accept sockets on two different ports,
proving consecutive requests actually land on both configured targets in
order, not just that the in-memory selector alternates.
… drop compositeId server-index

The options.specs.*.servers[] rollout introduced arbitrary compositeId
resolution whenever an operation declares more than one canonical server:
injectHttpRoutes looped the canonical-server axis outer and the deployment
override axis inner, so every canonical variant produced an identical :path
condition and first-match-wins made compositeId's server-index arbitrary.
Since compositeId drove canonicalize's server lookup, a request could be
canonicalized against the wrong declared server.

Separate the two axes that were conflated: deployment relocation
(options.specs.*.servers[], a pure runtime concern, unchanged) from
canonical declared-server scoping (a pure generation-time concern). Restore
when.servers as a generation-time inclusion filter only (not a runtime
route disambiguator) — it now decides which operations a route's config
includes, based on the operation's own declared servers.

Once inclusion is decided once at generation time, compositeId no longer
needs a server-index component at all: canonicalize only needs the bare
operation path, and un-canonicalize only needs the resolved deployment URI
plus the path already on the wire. This eliminates the bug structurally.

Also fixes canonicalize/un-canonicalize to use the operation's bare path as
the canonical form, rather than prefixing with the canonical server's own
base path, removing the need to resolve "which declared server" at runtime.
OpenapiView.of dropped its trailing List<OpenapiServerConfig> parameter
when OpenapiServerView was made pure (713dcd4), but this call site was
never updated and always passed an empty list for it — a no-op that only
now surfaced as a compile break with the plain 3-arg overload in scope.
Drop the extra argument; behavior is unchanged.
…ompositeId

AsyncapiCompositeId carried the same bit-packed server-index dimension
that OpenapiCompositeId had before it caused a real correctness bug
(#2145) -- but here it was always dead: no production code ever called
the 3-arg constructor or read serverIndex(), since AsyncapiOperationView
has no per-operation canonical-server concept to disambiguate in the
first place. Removing it now so the shape can't be reused the same
broken way if per-channel server scoping (see #2150) is ever added.
… routing

Swap the three call sites that fed the coarse, spec-wide server list into
AsyncapiConditionConfig/AsyncapiBindingConfig.resolve for the real,
per-operation-scoped list added by #2151: AsyncapiProxyGenerator's
generation-time route matching, and AsyncapiServerFactory/AsyncapiProxyFactory's
runtime route dispatch. A channel scoped to a subset of a spec's servers now
correctly excludes routes whose when.servers[] condition targets a different
server.

Realign the composite/asyncapi mqtt and kafka k3po fixtures' hardcoded
compositeId literals with AsyncapiCompositeId's simplified 2-field
(specIndex, operationId) encoding now that the vestigial server-index
dimension is gone.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
Add a new AsyncapiServerIT scenario (shouldPublishToChannelAddedByOverlay)
proving AsyncapiServerGenerator applies an options.specs.*.overlay document
before generating routes, using a channel/operation only present after the
overlay merge. Existing shouldPublishAndSubscribe/shouldPublishAndSubscribeWithStore
already exercise configured-vs-default MQTT store selection end to end, so
those two AsyncapiServerGeneratorTest cases are redundant and removed.

Trim AsyncapiServerGeneratorTest, AsyncapiProxyGeneratorTest, and
AsyncapiClientGeneratorTest down to only the assertions that have no
reasonable k3po IT equivalent, documenting the specific blocker on each
class: an attach-time exception message with no IT-visible surface, a
servers[]-scoping condition only reachable via an internal-composite-origin
dispatch path with no k3po test harness support for kind: proxy, and
Kafka SASL/TLS/host-port wiring that only takes effect on a real outbound
broker connection the existing IT intentionally bypasses.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…bination bug

AsyncapiServerGenerator never combined a declared server's pathname
(servers.*.pathname) with the channel address when generating HTTP/SSE
request paths and routes, so a spec-compliant client prefixing requests
with that pathname would 404. Fix by prepending the resolved pathname(s)
to the channel address in injectHttpRequests/injectHttpRoutes/injectSseRequests/
injectSseRoutes.

Also canonicalize the HTTP/SSE inner extension at AsyncapiServerFactory's
exit (strip :scheme/:authority, rewrite path to the canonical channel
address template) and un-canonicalize it at AsyncapiClientFactory's entry
(reapply the resolved server URI and pathname), mirroring the existing
OpenapiServerFactory/OpenapiClientFactory canonicalization. MQTT carries no
non-relocatable server info in its BeginEx and is left untouched (already
covered by existing byte-for-byte MQTT scripts).

Update existing HTTP/SSE k3po fixtures to reflect the new canonical form
and add new pathname-specific server/client ITs.
…cal form

AsyncapiSseIT runs asyncapi/sse/data.multiple/client and /server directly
against each other without Zilla, so both sides must already agree on the
canonical (stripped scheme/authority) SseBeginEx shape now that
AsyncapiServerFactory canonicalizes it. Only the server-side matcher was
updated previously; align the client-side builder to match, fixing the CI
failure on PR #2152.

Also add the missing peer-to-peer IT coverage for the new
create.pet.pathname scenario in AsyncapiHttpIT/CompositeHttpIT, per the
one-scenario-needs-both-a-binding-IT-and-a-peer-to-peer-IT convention.
… examples

The openapi and asyncapi binding schemas require options.specs.*.server
(asyncapi, singular string) or options.specs.*.servers (openapi, array),
but several example configs predate that requirement and were missing it
entirely, so Zilla failed engine config validation on startup.

Verified all seven openapi/asyncapi examples end-to-end against a locally
built image from this branch: openapi.proxy, openapi.asyncapi.kakfa.proxy,
asyncapi.http.kafka.proxy (sync + async flows), asyncapi.mqtt.kafka.proxy,
asyncapi.mqtt.proxy, asyncapi.sse.kafka.proxy, asyncapi.sse.proxy.
…stency with openapi

Aligns the asyncapi binding's server override config with the already-migrated
openapi binding shape: options.specs.<label>.server (single string) becomes
options.specs.<label>.servers (array, minItems 1, required).

- AsyncapiSpecificationConfig.servers is now a List<String>; the builder's
  serverOverride(String) accumulates repeated calls into that list
- AsyncapiCompositeGenerator builds one AsyncapiServerConfig per configured
  server and cross-products them against the AsyncAPI document's own
  declared servers, same as before but generalized from exactly one entry
- AsyncapiBindingConfig.resolveServers(specLabel) resolves the configured
  URIs, mirroring OpenapiBindingConfig.resolveBaseURLs
- AsyncapiClientFactory now round-robins across multiple configured servers
  per (bindingId, specLabel) when resolving the HTTP/SSE un-canonicalize
  target, mirroring OpenapiClientFactory.selectServer
- Updated the asyncapi JSON schema patch and every spec/example fixture
  referencing the old singular server: key
…h server base path

http_kafka_proxy0's route condition combined the OpenAPI document's declared
server base path into its :path match, even though by the time a request
reaches this internal route, openapi_server0 has already canonicalized :path
down to the bare operation path. Match on the bare path instead.

Updates the two script pairs that connect directly to composite0 (bypassing
the canonicalizing server) to send/expect the now-bare path; their Location
header values, produced independently by the async-produce config, are
unaffected.
…ts own domain, not the shared delegate's

KafkaCorrelateProxy.onKafkaReset compared and wrote delegate.initialAck,
a field shared with the sibling KafkaProduceProxy. When an async POST's
produce leg advances delegate.initialAck (via its own window accounting)
after the correlater's begin-time snapshot, the fetch-domain reset
acknowledge no longer satisfies delegate.initialAck's invariant, crashing
the worker. Compare/write the correlater's own local initialAck/initialSeq
instead, matching its sibling onKafkaWindow.
…rver exit

Issue #2145 asks to canonicalize/un-canonicalize both request path and
location values. OpenapiServerFactory already canonicalized the request
path but passed the reply-direction Location header straight through in
bare, canonical form, never reapplying the deployment's configured server
path prefix.

Add OpenapiBindingConfig.resolveServer (finds which configured
options.specs.*.servers[] entry the real incoming request matched) and
resolveLocation (reapplies that server's path prefix onto a bare Location
header). OpenapiServerFactory's OpenapiStream stores the matched server as
a plain per-stream field, set in the request-direction doOpenapiBegin and
read back in the reply-direction onOpenapiBegin, since one OpenapiStream
instance already handles both directions of the same exchange.
…erver exit

Mirrors the OpenAPI-side fix for issue #2145's location-values half.
AsyncapiServerFactory canonicalized the request path but passed the
reply-direction Location header straight through in bare, canonical form,
never reapplying the operation's declared server pathname.

Add AsyncapiBindingConfig.resolveLocation (HTTP-only, gated the same way
as canonicalize/resolve dispatch on SSE having no Location semantics),
prepending the resolved pathname onto a bare Location header. Promote
resolvePathname from AsyncapiClientFactory's private static helper to a
shared AsyncapiBindingConfig method so AsyncapiServerFactory can reuse it;
AsyncapiClientFactory now delegates to it instead of keeping its own copy.
AsyncapiServerFactory threads the resolved pathname through AsyncapiStream
and calls resolveLocation in the reply-direction onAsyncapiBegin.
…correlation-id matcher unblocking shouldVerifyCustomerAsync

Route-matching fix in 05179aa let shouldVerifyCustomerAsync's async
produce/correlate/fetch path execute for the first time, surfacing several
latent bugs it never previously reached:

- CompositeClientStream.doCompositeWindow relayed replyPad into an
  initial-direction window, and doCompositeFlush used the wrong-domain
  budgetId; both are no-op violations on what should be a transparent relay
- HttpKafkaProxyFactory: missing `+ reserved` on two FLUSH sequence
  trackers, a parameter-order swap in doKafkaEndAck, and a missing
  correlater window refresh in onHttpWindow
- The correlate-listener's advisory flush never reached the wire because
  the correlation-id embedded in its filter no longer matched the request's
  canonical :path (see below), so the k3po script never got past its begin
  match; test fixtures hardcoded the stale pre-canonicalization hash

Root cause of the correlation-id mismatch, and of getVerifiedCustomer being
misrouted through HttpProduceAsyncProxy instead of HttpCorrelateAsyncProxy
(producing a 400 instead of 204): OpenapiAsyncapiProxyGenerator still built
the GET's correlation-id extraction regex from
httpServer.requestPath(v.schema.format), which re-prepends the server's
path prefix. Everything internal to the composite operates on canonical,
prefix-stripped paths -- 05179aa fixed the route-match path but missed
this second call site, so the regex could never match the canonical :path
it actually sees at runtime, correlation-id extraction failed, and the
code fell back to generating a random idempotency key.

Fixed by building the matcher from the bare v.schema.format. Updated the
.rpt fixtures' stale correlation-id hash and Location prefix to match.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…ation

injectHttpKafkaRoute looped over httpOp.servers to generate one route per
declared OpenAPI spec-server, threading the OpenapiServerView through to
injectHttpKafkaRouteWith/FetchWith/ProduceWith. None of those methods used
it once route-path canonicalization removed the last httpServer.requestPath
call, so the loop only produced duplicate, byte-for-byte identical routes
per spec-server. Collapse it to generate the route once per operation.
AsyncapiServerView took an AsyncapiServerConfig at construction and baked
a deployment override into .url/.host/.pathname, while separately
computing config-independent literalUrl/literalHost/literalPathname
fields for when.servers[] route matching. Drop the config parameter
entirely -- .url/.host/.pathname now always resolve to the spec's own
declared default, identical to what the literal* fields used to compute,
so the separate fields become redundant. Mirrors the same purification
already done on OpenapiServerView.

AsyncapiView/AsyncapiCompositeId no longer take or cross a
List<AsyncapiServerConfig>; delete AsyncapiServerConfig/
AsyncapiServerConfigBuilder outright, matching the OpenAPI side (no
OpenapiServerConfig equivalent exists there either).
…sing at AsyncapiView.of

Follows the AsyncapiServerView purification -- neither composite
generator needs to build an AsyncapiServerConfig list anymore since the
view no longer takes one.
claude added 8 commits July 14, 2026 05:08
server.literalUrl no longer exists; server.url now computes the exact
same config-independent value directly, since the view is pure.

Deletes shouldMatchServerByLiteralUrlRegardlessOfOverride -- its premise
(comparing an overridden view against a literal one) is gone by
construction; the invariant it proved is redundant with existing
spec-variable-default coverage.
…lveServers()

TCP listener ports, plain/secure TCP routing, TLS SNI routes, and
protocol-family dispatch used to read .port/.hostname/.protocol off the
config-crossed AsyncapiServerView list. Now that the view is pure, these
fan out over AsyncapiBindingConfig.resolveServers(specLabel) instead --
a List<URI> parsed directly from options.specs.*.servers[], deriving
plain-vs-secure and protocol-family dispatch from URI.getScheme() rather
than the spec's own protocol field. Mirrors OpenapiServerGenerator's
resolveServers() pattern exactly; AsyncapiClientGenerator/
AsyncapiClientFactory already worked this way.

resolvePathnames(operation) is untouched -- it correctly continues
reading operation.servers/.protocol/.pathname off the now-pure view,
since neither field was ever affected by config baking in practice.

AsyncapiServerGeneratorTest.shouldPopulateTlsAuthorityForSniRouting
needs an explicit serverOverride now that resolveServers() is the
source of TLS listener ports/authorities.
….servers[]

resolveServers() parses each entry via URI.create, which needs a scheme
to correctly extract host:port -- a schemeless "host:port" string parses
as an opaque URI (host becomes the scheme) rather than an authority.
Client-side fixtures already used scheme-prefixed strings; server-side
ones were bare. Scheme-prefix every server-side fixture to match its own
already-declared spec-level protocol. No behavior change -- resolved
ports/hosts are numerically identical, only the parsing mechanism
changed.
…address as one URI

AsyncAPI 3.0 splits what 2.x expressed as a single `url` into `host`
(may include port) + `protocol` + `pathname`, intended to reconstruct as
`{protocol}://{host}{pathname}`. AsyncapiServerView kept these as four
separate fields instead (url, host, hostname, port), with hostname/port
derived through a synthetic "tcp://"+host wrapper that ignored both the
real protocol and pathname. All four had zero consumers left outside the
view's own constructor -- orphaned once TCP/TLS generation moved to
resolveServers() earlier in this branch's history.

Replace them with a single `url` (URI), composed from host+protocol+
pathname for 3.0-style documents or parsed directly for legacy 2.x `url`
declarations, mirroring OpenapiServerView.url exactly. pathname/protocol
stay as their own fields -- pathname because URI.getPath() would turn a
genuinely-absent pathname into "" instead of null, changing existing
nonNull-filtering behavior in AsyncapiBindingConfig.resolvePathname/
AsyncapiServerGenerator.resolvePathnames; protocol because its call
sites are clearer than .url.getScheme() would be.

This also fixes a real bug: AsyncapiConditionServerConfig.matches (the
when.servers[].url route filter) compared against the legacy url string,
which is always null for a spec-compliant 3.0 document (host+protocol
documents have no url property at all per the AsyncAPI 3.0 schema) -- so
when.servers[].url silently never matched on any 3.0 spec. Now compares
against the composed URI's string form, working for both spec styles.
…piServerView.url

pathname was kept as its own field alongside the newly-unified url on
the stated concern that URI.getPath() returns "" for a path-less
hierarchical URI while pathname was null, and both consumers
(AsyncapiBindingConfig.resolvePathname, AsyncapiServerGenerator's
resolvePathnames) filtered on Objects::nonNull. On closer look that
distinction wasn't protecting a real invariant -- both callers already
fall back to "" at the end regardless, and the null-filter's only
actual effect was silently dropping a server that declares no pathname
whenever another server for the same operation/spec does declare one,
which is a bug (that server's un-prefixed route stops being generated),
not a feature worth preserving.

Folding also fixes a related latent gap: pathname was populated only
from AsyncAPI 3.0's separate `pathname` field, so a legacy 2.x server
declaring `url: https://host/v1` had its embedded /v1 path silently
ignored for HTTP route generation. url.getPath() picks it up correctly
regardless of which spec style produced it.

protocol stays its own field (not url.getScheme()) -- it's the
document's directly-declared value rather than something re-derived
from a parsed URI, and its call sites read more clearly as .protocol.
…piServerView.url

protocol duplicated what url's own scheme already carries: for the
host+protocol (3.0) branch, url is composed using model.protocol as
the scheme directly, so url.getScheme() equals protocol by
construction; for the legacy url-style branch, the declared protocol
was a separately-trusted value alongside the address actually used for
routing, rather than derived from it. Drop the field and read
url.getScheme() at all four call sites instead (AsyncapiView.hasProtocol,
AsyncapiBindingConfig.resolvePathname, AsyncapiServerGenerator's
resolvePathnames, AsyncapiClientGenerator's protocol-family dispatch),
so the address actually used for routing/generation is the single
source of truth for its own scheme, with no separately-synthesized
value to drift from it.
AsyncapiServerView.url is now a single parsed URI, so these methods
return a URI path component, not a legacy pathname string.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
…path/serverPath

AsyncapiServerGenerator's per-operation loop variables now read as
plain URI path values (path). The deployment-path-prefix threaded
through AsyncapiServerFactory/AsyncapiClientFactory/AsyncapiBindingConfig's
resolve/resolveLocation family is renamed to serverPath to avoid
colliding with the existing path parameter in requestPath().

Left untouched: AsyncapiServer.pathname (the AsyncAPI 3.0 Server Object's
own JSON property name) and AsyncapiServerView's constructor locals that
parse it directly.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k

@jfallows jfallows left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

The sse-server test double broadcasts events live with no buffering:
if curl's SSE subscription hasn't finished connecting through Zilla
before the event is published via nc, it's lost for good. The old
script backgrounded curl and published immediately, racing the
subscription's HTTP/2 upgrade handshake — reproduced the same drop
connecting straight to the sse-server, bypassing Zilla entirely.

Wait for the subscription to establish before publishing, and retry
the whole cycle using the shared retry_until helper, matching the
pattern already used by other examples in .github/test-lib.sh.

Verified locally: 6/6 clean passes after the fix, versus frequent
failures before it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HzJgppmUNpSfzpJbzgxf8k
@jfallows
jfallows merged commit d97437d into develop Jul 14, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Canonicalize/un-canonicalize request path and location values at the server/client stream-factory boundary

2 participants