Skip to content

feat(net): ADR-0029 repartition — move Service to net-http-api, add kernel Timer#58

Merged
NotAProfDev merged 8 commits into
mainfrom
feat/net-http-api-repartition
Jul 1, 2026
Merged

feat(net): ADR-0029 repartition — move Service to net-http-api, add kernel Timer#58
NotAProfDev merged 8 commits into
mainfrom
feat/net-http-api-repartition

Conversation

@NotAProfDev

@NotAProfDev NotAProfDev commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

PR 1 of Slice 0 (the net-http foundation) — executes the ADR-0029 transport-split repartition, the structural gate the whole net-http construction surface sits on.

  • Kernel gains Timer — a runtime-neutral clock contract (Clone + Send + Sync; sleep -> impl Future + Send, now -> Instant) so timing middleware can be driven by a mock clock in tests without coupling the kernel to any async runtime (ADR-0029 §4).
  • Service moves out of the kernel into the new per-transport contract crate oath-adapter-net-http-apiService is a request/reply connection shape, not a kernel primitive (ADR-0029 §2). Its doc-comment is corrected: the call future is Send (enforced), the service value is Send + Sync + 'static enforced at the composition boundary (not the trait), plus a clone-to-spawn note.
  • Kernel is now std-onlyoath-adapter-net-api sheds all external deps and renames its service.rs module → compose.rs (keeping Layer/ServiceBuilder/Stack/Identity + ErrorKind/HasErrorKind + Timer). A dependency-free kernel is the signal the cut is clean (ADR-0029 §3).
  • README dependency graph + CHANGELOG updated.
  • The opening commit lands the design spec and the Slice 0 foundation plan under docs/superpowers/.

Out of scope (later slices/PRs)

The HTTP data plane (HttpError, HttpClient, ResponseBody, the resilience layers), the net-http-mock harness, and the seam contracts (AuthSource, Guarded, RateKey) — PRs 2–4. The new crate is intentionally minimal (just the moved Service, zero dependencies) at this stage. The README mermaid edge net-http-api → net-api is forward-looking (the Cargo dep lands in PR 2).

Verification

just ci green (fmt, fmt-toml, typos, lint, check, test + doctests, deny, doc, machete, gitleaks, actionlint, shellcheck). No unsafe; kernel std-only; exactly one Service definition after the branch.

Process

Built subagent-driven: 4 tasks, each spec + code-quality reviewed, plus a clean whole-branch review (one trivial README wording fix applied).

Closes #57

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a transport-specific HTTP adapter API layer with a request → single-reply service contract.
    • Introduced a runtime-neutral timer interface for timing and elapsed-time queries.
  • Refactor
    • Updated the shared network composition surface to std-only primitives and adjusted the public composition module structure.
  • Documentation
    • Updated the changelog, README architecture diagram, and added net-http foundation and construction-surface specs to reflect the ADR-0029 split.

@NotAProfDev NotAProfDev added the enhancement New feature or request label Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3830172d-cc34-4976-a461-b5fac499782e

📥 Commits

Reviewing files that changed from the base of the PR and between 58e13bb and 130b90f.

📒 Files selected for processing (2)
  • crates/adapter/net/api/src/compose.rs
  • crates/adapter/net/api/src/timer.rs
✅ Files skipped from review due to trivial changes (1)
  • crates/adapter/net/api/src/compose.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/adapter/net/api/src/timer.rs

📝 Walkthrough

Walkthrough

This PR splits the net adapter into a std-only kernel and a new HTTP transport crate, adds a runtime-neutral Timer, and updates workspace metadata plus project docs. It also adds planning and design documents for the net-http follow-on work.

Changes

Kernel Repartition and Service Migration

Layer / File(s) Summary
Timer contract added to kernel
crates/adapter/net/api/src/timer.rs
Adds Timer with sleep and now, plus a fixed test implementation.
Kernel rename service to compose and std-only trim
crates/adapter/net/api/src/compose.rs, crates/adapter/net/api/src/lib.rs, crates/adapter/net/api/Cargo.toml
Renames module/docs to compose, updates re-exports, removes Service from the kernel, and leaves workspace lint config.
New oath-adapter-net-http-api crate with Service contract
crates/adapter/net/http/api/Cargo.toml, crates/adapter/net/http/api/src/lib.rs, crates/adapter/net/http/api/src/service.rs
Adds the new crate and defines/re-exports the HTTP Service<Req> contract.
Workspace wiring, README, and CHANGELOG updates
Cargo.toml, README.md, CHANGELOG.md
Registers the crate, updates the architecture docs, and records the repartition in the changelog.

Planning and Design Documentation

Layer / File(s) Summary
Foundation implementation plan
docs/superpowers/plans/2026-06-30-net-http-foundation.md
Adds the Slice 0 implementation plan, task breakdown, and follow-on PR roadmap.
Construction surface design spec
docs/superpowers/specs/2026-06-30-net-http-construction-surface-design.md
Adds the design spec for the net-http construction seams, test coverage, and dependency constraints.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • NotAProfDev/oath#56: Closely matches this repartition by introducing the kernel split, the new HTTP API crate, and the relocated Service<Req> contract.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title uses Conventional Commits and accurately summarizes the ADR-0029 repartition work.
Linked Issues check ✅ Passed The changes implement the linked ADR-0029 foundation scope: add Timer, move Service to net-http-api, keep kernel std-only, and update docs.
Out of Scope Changes check ✅ Passed No clear out-of-scope code changes are present; the added docs align with the stated ADR-0029 foundation plan.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/net-http-api-repartition

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/superpowers/plans/2026-06-30-net-http-foundation.md`:
- Around line 131-135: The `Timer` bullet in the module-list doc comment is
malformed because the inline code fence is broken, so update the `lib.rs`
re-export/docs note to use valid Markdown for the `timer` item. Keep the `pub
use timer::Timer;` instruction unchanged, but rewrite the `//! - [...]` entry so
the `Timer` symbol is wrapped with a correctly closed inline code span and
remains copyable and markdownlint-clean.

In `@docs/superpowers/specs/2026-06-30-net-http-construction-surface-design.md`:
- Around line 373-380: The diagram block in the ADR reconciliation section is
missing the Mermaid fence label. Update the fenced code block identified by the
ADR reconciliation content so it uses a mermaid-tagged fence, keeping the block
location around the “ADR-0030 §3 + Consequences” text and the surrounding
diagram snippet intact.
- Around line 61-65: The scope summary still refers to a superseded Permit enum,
while the finalized model uses Guarded<B> carrying
Option<async_lock::SemaphoreGuardArc>. Update the opening bullets in the spec to
match the final permit shape and terminology, and keep the references to
AuthSource, Auth, NoAuth, and HttpError::Auth unchanged so implementers are
guided toward the current abstraction.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: aa97dd0c-0808-474d-9c5a-4fbe291552e8

📥 Commits

Reviewing files that changed from the base of the PR and between 0d942b1 and db426c1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (12)
  • CHANGELOG.md
  • Cargo.toml
  • README.md
  • crates/adapter/net/api/Cargo.toml
  • crates/adapter/net/api/src/compose.rs
  • crates/adapter/net/api/src/lib.rs
  • crates/adapter/net/api/src/timer.rs
  • crates/adapter/net/http/api/Cargo.toml
  • crates/adapter/net/http/api/src/lib.rs
  • crates/adapter/net/http/api/src/service.rs
  • docs/superpowers/plans/2026-06-30-net-http-foundation.md
  • docs/superpowers/specs/2026-06-30-net-http-construction-surface-design.md
💤 Files with no reviewable changes (1)
  • crates/adapter/net/api/Cargo.toml

Comment thread docs/superpowers/plans/2026-06-30-net-http-foundation.md
NotAProfDev and others added 2 commits July 1, 2026 17:18
Address review feedback:
- compose.rs: the `Layer` trait heading was mechanically find-replaced from
  "Transform one Service into another Service" to "...one Layer into another
  Layer" when Service left the crate, which misdescribes the trait — a Layer
  wraps a value (S -> Self::Service), not a Layer. Reword accurately.
- plan md: fix the malformed inline code span for the `timer` module-list
  bullet (markdownlint MD038) using a padded double-backtick span so it stays
  copyable (CodeRabbit).
- spec md: the Scope-in summary and Definition-of-done still named the
  superseded `Permit` enum; the finalized model carries
  `Option<async_lock::SemaphoreGuardArc>` directly (CodeRabbit).

CodeRabbit's third comment (add a `mermaid` fence in the ADR-reconciliation
section) was refuted — that region is prose bullets, not a diagram.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cleanup from /simplify review (doc + test only, no behaviour change):
- compose.rs: drop residual "service"/request-centric wording on the now
  transport-neutral composition types — `Layer::Service` ("wrapped type"),
  `Identity` ("inner value"), `Stack` ("outermost wrapper") — so the docs match
  the module's "composes anything" contract (Layer carries no Service bound).
- timer.rs: import `Future` in the test module instead of the fully-qualified
  `std::future::Future`, matching how the module imports its std types.

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

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(net): ADR-0029 repartition — move Service to net-http-api, add kernel Timer

1 participant