fix(reliability): clamp max_concurrent to Semaphore::MAX_PERMITS; add ReliabilityConfig::disabled() (LAB-729) - #50
Conversation
… ReliabilityConfig::disabled() (LAB-729) Expert-panel follow-up on the merged #49 (panel run 2026-07-28, Ray-requested): - MAJ (bug-hunter, verified live): tokio's Semaphore::new panics above MAX_PERMITS (usize::MAX >> 3), and usize::MAX is the natural 'effectively unbounded' sentinel a caller will pass — a public config value must never panic CacheKitBuilder::build(). Clamp to [1, MAX_PERMITS], document on the field, pin with a unit test. - MIN (craftsman): the builder's wrap-or-skip gate hand-enumerated every layer's is_some() and shipped a missed-layer bug once inside #49 already; the check now lives on ReliabilityConfig::is_disabled(), next to the fields, so a future layer can't silently miss the gate. - MIN (craftsman): the documented opt-out was a full struct literal that breaks downstream every time the stack gains a layer (twice now) — ReliabilityConfig::disabled() replaces it in README, rustdoc, and the preset docs.
…sabled() (LAB-729)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
WalkthroughThe reliability configuration now has explicit disabled-state helpers, CacheKit skips reliability wrapping for disabled configurations, and concurrency limits are clamped to Tokio semaphore bounds with test coverage. README and API documentation describe the updated behaviour. ChangesReliability configuration and concurrency safeguards
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
Applies the surviving findings from the formal expert-panel review of the merged #49 (LAB-729), run 2026-07-28 at high stakes on Ray's request (panel: bug-hunter-supreme, security-specialist, code-craftsman, catchphrase-agent).
Panel verdict on #49: FIX-FIRST → this PR
Semaphore::new(max_concurrent.max(1))panics whenmax_concurrent > tokio::sync::Semaphore::MAX_PERMITS(usize::MAX >> 3).usize::MAXis the natural "effectively unbounded" sentinel a user of this public config will reach for, and it crashed insideCacheKitBuilder::build()with tokio's internal panic. Now clamped to[1, MAX_PERMITS], documented on the field next to the existing "0 behaves as 1" note, pinned bylimiter_clamps_huge_max_concurrent_instead_of_panicking.is_some()— the exact shape that shipped a missed-layer bug once already inside feat(reliability): backpressure — bound backend-op concurrency (LAB-729) #49's own history. The check now lives onReliabilityConfig::is_disabled(), beside the fields, so a future fourth layer cannot silently miss the gate.ReliabilityConfig::disabled()replaces it in the README, builder rustdoc, and preset docs (doctest-covered).Rejected, with reason
macro_tests.rs/reliability_tests.rs. Rejected — the "fix" is a closure-parameterized generic helper intests/common, which costs more machinery than the eight duplicated test-scaffold lines it removes; the catchphrase reviewer's own pass reached the same conclusion for the sibling test fixtures. Revisit if a third copy appears.Clean passes
securepath still fails closed on a shed (empty fail-open arm at both macro splice sites), shed messages carry no secrets (CWE-532), and the in-process limiter crosses no trust boundary.Gates: fmt, clippy
-D warnings, 244 tests + 8 doc-tests, 0 failures.This PR contains only the panel's own prescriptions; the panel report on LAB-729 covers it.
Summary by CodeRabbit