refactor(net): make compose vocabulary transport-neutral (LayerBuilder / Layer::Wrapped)#121
Conversation
Rename the Service-agnostic composition primitives in oath-adapter-net-api so their names match their transport-neutral role (ADR-0029 §3): ServiceBuilder -> LayerBuilder, the Layer::Service associated type -> Layer::Wrapped, and the finalizer .service() -> .wrap(). The composition unit is shared across transports but the assembled product differs (an HTTP Service, a WS ReconnectingConnection), so the kernel output type must not name itself Service. The HTTP Service<Req> trait is unchanged. Also drop the unused Copy derive from Identity/Stack (nothing copies them; Clone is retained). Updates the five HTTP layer files, stack.rs, CHANGELOG, README, and ADRs 0029-0034 (with a dated provenance amendment on ADR-0029). Historical docs/superpowers specs/plans are left as dated snapshots. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 25 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…123) Follow-up polish to oath-adapter-net-api after the #121 vocabulary rename. All in the kernel crate; no behaviour change. - Add a lock-in test module for compose.rs asserting the ordering invariant (first .layer() is outermost), Identity pass-through, Default == new, and the zero-cost (ZST) property. The ordering invariant was previously only compile-checked by assert-nothing doctests. - Add #[must_use] to LayerBuilder::wrap(): assembling a stack and discarding the composed value is a bug (matches .layer() / new()). - Make the crate's public rustdoc self-contained by dropping the internal ADR-0029 citations from compose.rs, lib.rs, and timer.rs. - Rename the Layer value type parameter S -> T. S was tower's "Service" vestige; the kernel is transport-neutral, so the parameter carries no Service connotation. HTTP layer impls keep S (there it is genuinely a Service). Closes #122 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What
Makes the
oath-adapter-net-apicomposition vocabulary transport-neutral:ServiceBuilderLayerBuilderLayer::Service(assoc type)Layer::WrappedServiceBuilder::service(leaf)LayerBuilder::wrap(leaf)#[derive(… Copy)]onIdentity/StackClonekept)Why
Per ADR-0029 §3 the composition machinery is
Service-bound-free and shared acrosstransports; ADR-0033 §1/§3 assembles the WS reconnect stack with the same kernel builder.
The composition unit is shared, but the assembled product differs per transport (an
HTTP
Service, a WSReconnectingConnection), so the kernel output type should not nameitself
Service. The HTTPService<Req>trait — a genuine request/reply contract — isunchanged.
Scope
crates/adapter/net/api/{compose.rs,lib.rs}type Wrapped) +stack.rs(LayerBuilder/.wrap()) —the
Service<Req>trait is untouched[Unreleased], README, ADRs 0029–0034 (with a dated provenanceamendment on ADR-0029)
docs/superpowers/{specs,plans}intentionally left as dated snapshots (theyquote the old code verbatim; one references
tower::ServiceBuilder, a real type)Verification
just cigreen — fmt, clippy-D warnings, 205 tests, doctests,cargo doc -D warnings,deny, machete, gitleaks, actionlint, shellcheck
net_api2/2,net_http_api8/8)ServiceBuilder/ kerneltype Service/.service()No behaviour or runtime change — pure vocabulary rename (pre-release, workspace-internal).
Closes #120
🤖 Generated with Claude Code