Skip to content

refactor(net): make compose vocabulary transport-neutral (LayerBuilder / Layer::Wrapped)#121

Merged
NotAProfDev merged 1 commit into
mainfrom
worktree-refactor+compose-neutral-vocab
Jul 9, 2026
Merged

refactor(net): make compose vocabulary transport-neutral (LayerBuilder / Layer::Wrapped)#121
NotAProfDev merged 1 commit into
mainfrom
worktree-refactor+compose-neutral-vocab

Conversation

@NotAProfDev

Copy link
Copy Markdown
Owner

What

Makes the oath-adapter-net-api composition vocabulary transport-neutral:

Old New
ServiceBuilder LayerBuilder
Layer::Service (assoc type) Layer::Wrapped
ServiceBuilder::service(leaf) LayerBuilder::wrap(leaf)
#[derive(… Copy)] on Identity/Stack dropped (Clone kept)

Why

Per ADR-0029 §3 the composition machinery is Service-bound-free and shared across
transports; 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 WS ReconnectingConnection), so the kernel output type should not name
itself Service. The HTTP Service<Req> trait — a genuine request/reply contract — is
unchanged.

Scope

  • Kernel: crates/adapter/net/api/{compose.rs,lib.rs}
  • HTTP: the five layer files (type Wrapped) + stack.rs (LayerBuilder / .wrap()) —
    the Service<Req> trait is untouched
  • Docs: CHANGELOG [Unreleased], README, ADRs 0029–0034 (with a dated provenance
    amendment on ADR-0029)
  • Historical docs/superpowers/{specs,plans} intentionally left as dated snapshots (they
    quote the old code verbatim; one references tower::ServiceBuilder, a real type)

Verification

  • just ci green — fmt, clippy -D warnings, 205 tests, doctests, cargo doc -D warnings,
    deny, machete, gitleaks, actionlint, shellcheck
  • Doctests exercising the renamed API pass (net_api 2/2, net_http_api 8/8)
  • Exhaustive grep sweep: no stray ServiceBuilder / kernel type Service / .service()

No behaviour or runtime change — pure vocabulary rename (pre-release, workspace-internal).

Closes #120

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@NotAProfDev, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 25 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 50d8017a-b32e-4110-831e-ad2c33370fba

📥 Commits

Reviewing files that changed from the base of the PR and between 344d77a and 093bac3.

📒 Files selected for processing (16)
  • CHANGELOG.md
  • README.md
  • crates/adapter/net/api/src/compose.rs
  • crates/adapter/net/api/src/lib.rs
  • crates/adapter/net/http/api/src/circuit_breaker.rs
  • crates/adapter/net/http/api/src/rate_limit.rs
  • crates/adapter/net/http/api/src/retry.rs
  • crates/adapter/net/http/api/src/stack.rs
  • crates/adapter/net/http/api/src/timeout.rs
  • crates/adapter/net/http/api/src/trace.rs
  • docs/adr/0029-network-adapter-stack-transport-split-compile-time-composition.md
  • docs/adr/0030-http-transport-contract-wire-bytes-streaming-composition.md
  • docs/adr/0031-http-resilience-venue-pacing.md
  • docs/adr/0032-websocket-transport-contract-duplex-frames-lifecycle.md
  • docs/adr/0033-websocket-resilience-reconnect-actor-watch-lifecycle.md
  • docs/adr/0034-http-construction-surface-auth-guarded-boot-coverage.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch worktree-refactor+compose-neutral-vocab

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NotAProfDev NotAProfDev merged commit 3b1b333 into main Jul 9, 2026
4 checks passed
@NotAProfDev NotAProfDev deleted the worktree-refactor+compose-neutral-vocab branch July 9, 2026 18:01
NotAProfDev added a commit that referenced this pull request Jul 9, 2026
…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>
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.

refactor(net): make compose vocabulary transport-neutral (LayerBuilder / Layer::Wrapped)

1 participant