Skip to content

refactor(net): extract MockTimer into shared oath-adapter-net-mock crate (WS resilience PR0)#74

Merged
NotAProfDev merged 5 commits into
mainfrom
refactor/net-mock-extract
Jul 4, 2026
Merged

refactor(net): extract MockTimer into shared oath-adapter-net-mock crate (WS resilience PR0)#74
NotAProfDev merged 5 commits into
mainfrom
refactor/net-mock-extract

Conversation

@NotAProfDev

@NotAProfDev NotAProfDev commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Closes #73

PR0 of the net-ws resilience surface (spec: docs/superpowers/specs/2026-07-04-net-ws-resilience-design.md), mandated by ADR-0034 §Amendments.4.

  • New dev-only crate oath-adapter-net-mock holding MockTimer, beside the Timer contract in oath-adapter-net-api.
  • MockTimer moved verbatim (history preserved via git mv); oath-adapter-net-http-mock now provides only MockClient/MockBody.
  • Lets the HTTP and (forthcoming) WS mock stacks share one fake clock without a WS-mock → HTTP-mock cross-dependency.
  • No behavior change; MockTimer had no consumers yet, so nothing external is repointed. Both mock crates keep the cargo tree -e no-dev -i production-reachability guard.

This PR also lands the WS resilience design spec (docs/superpowers/specs/2026-07-04-net-ws-resilience-design.md) and this plan.

Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Added a new shared, dev-only mock package for network adapter testing.
    • Moved the virtual MockTimer from the HTTP mock package into the new shared mock package.
    • Updated workspace configuration so the new mock package is available across the project; HTTP mock now provides only request/response-style mocks.
  • Documentation
    • Updated changelog entries for the mock split.
    • Added a planning document for the mock extraction and a design spec for upcoming WebSocket resilience work.

NotAProfDev and others added 3 commits July 4, 2026 10:41
Spec decomposes the ADR-0033 resilience stack into PRs 0-5 (PR6/tungstenite
leaf roadmapped to its own spec); PR0 plan extracts MockTimer into a shared
oath-adapter-net-mock crate per ADR-0034 §Amendments.4.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 4, 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: c8859e45-6217-4f93-8a75-aca1df2c4394

📥 Commits

Reviewing files that changed from the base of the PR and between 077cb7c and 9e5497e.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • docs/superpowers/plans/2026-07-04-net-mock-extract.md
✅ Files skipped from review due to trivial changes (2)
  • CHANGELOG.md
  • docs/superpowers/plans/2026-07-04-net-mock-extract.md

📝 Walkthrough

Walkthrough

Extracts MockTimer into a new dev-only oath-adapter-net-mock crate, updates workspace and net-http-mock wiring, records the change in the changelog, and adds planning/spec documents for the net-ws resilience work.

Changes

MockTimer extraction

Layer / File(s) Summary
New shared mock crate
crates/adapter/net/mock/Cargo.toml, crates/adapter/net/mock/src/lib.rs
New dev-only crate defines MockTimer, exposes the timer module/re-export, and includes a poison-tolerant lock helper.
Workspace wiring and http-mock cleanup
Cargo.toml, crates/adapter/net/http/mock/Cargo.toml, crates/adapter/net/http/mock/src/lib.rs
Workspace membership/dependency entries are added for oath-adapter-net-mock; net-http-mock removes the net-api dependency and drops the timer export.
Changelog update
CHANGELOG.md
Documents the MockTimer relocation and the reduced net-http-mock surface.

Planning and design documentation

Layer / File(s) Summary
PR0 implementation plan
docs/superpowers/plans/2026-07-04-net-mock-extract.md
Outlines the extraction plan, constraints, file edits, verification steps, and self-review checklist.
Net-ws resilience design spec
docs/superpowers/specs/2026-07-04-net-ws-resilience-design.md
Defines the PR0–PR6 slice map, scope, non-goals, resolved questions, and consequences for the resilience surface.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related issues

Possibly related PRs

  • NotAProfDev/oath#58: Introduces the Timer contract that MockTimer continues to implement after relocation.
  • NotAProfDev/oath#60: Originally added MockTimer inside oath-adapter-net-http-mock, which this PR extracts.
  • NotAProfDev/oath#62: Related net-ws resilience work that references the shared mock clock design.

Suggested labels: enhancement

🚥 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 follows Conventional Commits and accurately describes the MockTimer extraction work.
Linked Issues check ✅ Passed The PR fulfills #73 by moving MockTimer to a new dev-only crate and leaving net-http-mock with MockClient/MockBody.
Out of Scope Changes check ✅ Passed The added design and implementation docs are part of the stated PR objectives, and no unrelated code changes are evident.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/net-mock-extract

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: 1

🤖 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-07-04-net-mock-extract.md`:
- Around line 27-33: The extraction plan is missing the manifest update for
oath-adapter-net-http-mock, so include crates/adapter/net/http/mock/Cargo.toml
in Task 1 alongside the existing lib.rs changes. Update the plan so it reflects
removal of oath-adapter-net-api from that crate’s dependencies and keeps the
file list accurate for the just machete/reachability checks; use the identifiers
oath-adapter-net-http-mock and oath-adapter-net-api to locate the affected task
scope.
🪄 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: 7e9e4f03-5cf1-4594-a5c5-fc6184b00cd1

📥 Commits

Reviewing files that changed from the base of the PR and between ff0b5db and 077cb7c.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock, !**/*.lock
📒 Files selected for processing (9)
  • CHANGELOG.md
  • Cargo.toml
  • crates/adapter/net/http/mock/Cargo.toml
  • crates/adapter/net/http/mock/src/lib.rs
  • crates/adapter/net/mock/Cargo.toml
  • crates/adapter/net/mock/src/lib.rs
  • crates/adapter/net/mock/src/timer.rs
  • docs/superpowers/plans/2026-07-04-net-mock-extract.md
  • docs/superpowers/specs/2026-07-04-net-ws-resilience-design.md
💤 Files with no reviewable changes (1)
  • crates/adapter/net/http/mock/Cargo.toml

Comment thread docs/superpowers/plans/2026-07-04-net-mock-extract.md
NotAProfDev and others added 2 commits July 4, 2026 11:03
Addresses CodeRabbit review on PR #74: Task 1 removes the orphaned
oath-adapter-net-api dependency from oath-adapter-net-http-mock (only
timer.rs used it), so the manifest is a modified file, not unchanged —
the machete/reachability rationale now matches the diff.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@NotAProfDev NotAProfDev merged commit 1d5e26c into main Jul 4, 2026
5 checks passed
@NotAProfDev NotAProfDev deleted the refactor/net-mock-extract branch July 4, 2026 11:09
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): extract MockTimer into shared oath-adapter-net-mock crate (WS resilience PR0)

1 participant