You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deferred, non-blocking items from the review of #82 (IrrevocableContext deadline/timeout support). Points 1, 4, 6, 7 were addressed in that PR; the following were intentionally left as follow-ups.
2. Centralize the deadline/cancelled error strings (DRY)
run() and err() each construct "context deadline exceeded" / "context cancelled" ad hoc, and the tests assert on .contains("deadline exceeded") / .contains("context cancelled"). The strings currently match, but nothing prevents drift.
Suggestion: small private helpers (e.g. deadline_err() / cancelled_err()) so the messages have a single source of truth.
Priority: low (pure maintainability).
3. Allow a child to have a shorter deadline than its parent
child() inherits the parent's deadline verbatim; there is no way to give a child a tighter deadline. Go's context.WithTimeout on a child intersects deadlines (child gets min(parent, new)).
Suggestion: a with_timeout-style constructor on an existing context that sets deadline = min(self.deadline, now + timeout); or at minimum document the current "inherit-only" behavior so callers don't assume Go-style intersection.
test_run_respects_deadline, test_is_deadline_exceeded, and test_run_cancellation_beats_deadline rely on wall-clock timing (real sleeps with generous margins). These can flake under CI load.
Suggestion: convert to #[tokio::test(start_paused = true)] + tokio::time::advance(..) for deterministic virtual time.
Priority: low (margins are generous today), but paused-time is the robust pattern.
Source: static review by Claude (@claude) on #82. Points renumbered per that review.
Deferred, non-blocking items from the review of #82 (
IrrevocableContextdeadline/timeout support). Points 1, 4, 6, 7 were addressed in that PR; the following were intentionally left as follow-ups.2. Centralize the deadline/cancelled error strings (DRY)
run()anderr()each construct"context deadline exceeded"/"context cancelled"ad hoc, and the tests assert on.contains("deadline exceeded")/.contains("context cancelled"). The strings currently match, but nothing prevents drift.deadline_err()/cancelled_err()) so the messages have a single source of truth.3. Allow a child to have a shorter deadline than its parent
child()inherits the parent's deadline verbatim; there is no way to give a child a tighter deadline. Go'scontext.WithTimeouton a child intersects deadlines (child getsmin(parent, new)).with_timeout-style constructor on an existing context that setsdeadline = min(self.deadline, now + timeout); or at minimum document the current "inherit-only" behavior so callers don't assume Go-style intersection.5. Make the timer-based tests deterministic
test_run_respects_deadline,test_is_deadline_exceeded, andtest_run_cancellation_beats_deadlinerely on wall-clock timing (realsleeps with generous margins). These can flake under CI load.#[tokio::test(start_paused = true)]+tokio::time::advance(..)for deterministic virtual time.Source: static review by Claude (@claude) on #82. Points renumbered per that review.