refactor(net): harden compose — lock-in tests, must_use, self-contained docs, neutral param#123
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughRenames the generic parameter of the Changesnet-api compose polish
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
What
Follow-up hardening of
oath-adapter-net-apiafter the #121 vocabulary rename — all in the kernel crate, no behaviour change:compose.rs: the ordering invariant (first.layer()is outermost),Identitypass-through,Default == new(), and the zero-cost / ZST property. The ordering invariant was previously only compile-checked by assert-nothing doctests; the new tests execute and assert it (verified test-first — reversing the slotting convention makes them fail, then restoring makes them pass).#[must_use]onLayerBuilder::wrap()— assembling a stack and discarding the composed value is a bug; matcheslayer()/new().ADR-0029 §Ncitations fromcompose.rs,lib.rs,timer.rs; the rustdoc now stands on its own.S→Tincompose.rs.Swas tower's "Service" vestige; the kernel is transport-neutral, so the parameter carries no Service connotation. The HTTP layer impls keepS— there it is genuinely boundedS: Service<…>.Verification
just cigreen (fmt, clippy-D warnings, tests, doctests,cargo doc -D warnings, deny, machete, gitleaks, actionlint, shellcheck)compose::tests(5) + doctests (2) pass; the ordering test was shown to fail under a reversed slotting convention before passing under the correct one (real red → green)Closes #122
🤖 Generated with Claude Code
Summary by CodeRabbit