Skip to content

Probe timeout, retry jitter, safe user_message (v1.2.0) - #20

Merged
jamesgober merged 1 commit into
mainfrom
fix/review-1.2.0
Nov 12, 2026
Merged

jamesgober merged 1 commit into
mainfrom
fix/review-1.2.0

Conversation

@jamesgober

Copy link
Copy Markdown
Owner

Fixes from an independent review, released as 1.2.0 (error-forge and error-forge-derive, versioned together; the derive has no code changes). No public item removed or changed; MSRV stays 1.81; rand dropped, no new dependencies.

  • Circuit breaker: a half-open probe older than probe_timeout_ms (default: the reset timeout) counts as failed and its late result is ignored; is_probing() tells a running probe from a pending one. Failure times kept in a capped VecDeque; a closed-state panic counts as a failure.
  • Retry: RetryExecutor::with_backoff(impl Backoff), RetryExecutor::with_jitter, RetryPolicy::with_jitter; jitter on by default with the jitter feature. Jitter draws below the cap instead of clamping onto it, using an in-crate generator.
  • Messages: user_message() defaults to the caption (never the error's data); Redacted<T>; the log adapters escape control characters; #![forbid(unsafe_code)].
  • Docs: hook panics under panic = "abort", breaker counting semantics, STABILITY and Cargo.toml corrections.

Regression tests: tests/review_fixes_test.rs. CHANGELOG included.

- A half-open probe older than probe_timeout_ms (default: the reset
  timeout) counts as failed, so a hung probe no longer locks the
  breaker. Add CircuitBreaker::is_probing.
- RetryExecutor::with_backoff, RetryExecutor::with_jitter and
  RetryPolicy::with_jitter; jitter on by default with the jitter
  feature. Jitter is spread below the cap and uses an in-crate
  generator, so rand is no longer a dependency.
- Failure times in a VecDeque capped at the threshold; a panic in the
  closed state counts as a failure.
- ForgeError::user_message defaults to the caption; add Redacted<T>;
  the log adapters escape control characters; forbid unsafe code.
- Doc fixes: hook panics under panic = "abort", breaker counting,
  STABILITY panic note, stale Cargo.toml comment.
@jamesgober
jamesgober merged commit 4cbe771 into main Nov 12, 2026
33 checks passed
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.

1 participant