feat(build): feature-sided builds — server/client sides independently selectable (ADR-039 Amendment 1)

Split the feature graph so consumers pulling only the import adapters
(from_openapi / from_jsonschema / from_mcp) no longer compile the axum
/ hyper server stack, and server-only deployments no longer compile
reqwest. One crate, one import path — sides cut by features, not by a
crate split.

Feature graph:
- server (default): axum host, gateway, WS upgrade, to_openapi, to_mcp
- client (default): client host, forward, from_jsonschema, from_openapi
- openapi: shared OpenAPISpec model (implied by both sides)
- mcp: from_mcp needs client, to_mcp needs server
- wss: tungstenite transport (from_wss); tungstenite half of the
  shared WS↔byte-stream adapter
- h2/http1: hyper protocol features; imply server

Wire-contract neutral: gateway endpoints, ALPNs, and all public API
shapes unchanged; defaults keep both sides on.

Supporting changes:
- forward.rs drops its axum::body::Bytes type leak (bytes crate types)
- bounded_join + error-echo caps move to input_validation (usable by
  both sides; openapi_spec no longer imports from forward)
- byte_adapter: axum flavor compiles under server, tungstenite under
  wss; the generic pumps stay shared (WS-11)
- input_validation / openapi_spec import-only internals gated to the
  side that consumes them
- http-body-util moves to dev-dependencies (was test-only)
- integration-test required-features updated for the new sides
- from_wss unit tests (axum producer harness) gated to server

Verified: cargo test (defaults, 453) and --all-features (575) pass;
lean side builds (client / server / client,mcp / client,wss /
server,wss / openapi-only) build clean with zero warnings;
clippy -D warnings clean across all feature combinations; fmt clean.
This commit is contained in:
2026-08-31 17:19:05 +00:00
parent 8e8e1f2b14
commit a80f9948b8
16 changed files with 259 additions and 99 deletions
+9 -6
View File
@@ -133,12 +133,15 @@ implementation agents.
coupling, no endpoint/accept-loop); the dial and the TLS config are
concerns of the consumer, not of this crate.
10. **Feature flags** — the HTTP transports are feature-gated: `h2` and
`http1` are default features (hyper), `mcp` gates the
`from_mcp`/`to_mcp` adapters (rmcp). The base crate should compile
lean (no `rmcp` unless the `mcp` feature is on). Verify both
`cargo test` (default) and `cargo test --all-features` pass if
features are added.
10. **Feature flags** — the crate is feature-sided (ADR-039
Amendment 1): `server` (axum host, gateway, WS upgrade, `to_*`)
and `client` (outbound client host, `from_*` adapters) are both
default features; `openapi` is the shared spec model (implied by
both); `mcp` gates the MCP adapters, `wss` the tungstenite
transport, `h2`/`http1` the hyper protocol features (imply
`server`). A lean build takes `default-features = false` plus one
side. Verify both `cargo test` (default) and
`cargo test --all-features` pass if features are added.
11. **Naming** — Rust standard: `snake_case` for functions/variables/
modules, `PascalCase` for types/traits, `SCREAMING_SNAKE_CASE` for