fix: saturating prune-cutoff cast, drop stale dead_code allow#10
Merged
Conversation
- transport.rs: prune cutoff now uses i64::try_from(...).unwrap_or(i64::MAX) instead of a silent 'as i64' wrap — same discipline as the nats.rs max_age conversion. - nats.rs: NatsHandle.client carried a stale #[allow(dead_code)]; the field is read by store_with_config, so the suppression was vestigial. Removed it and pointed the comment at the real reader. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small hardening fixes out of a safety audit of
src/:src/transport.rs— the prune cutoff computedd.as_millis() as i64, a silent-wrap narrowing cast. Nowi64::try_from(...).unwrap_or(i64::MAX), matching the saturating discipline thenats.rsmax_ageconversion already documents. No behavior change on any reachable input (wrap required a >292-million-year wall clock); the point is consistency so the safe pattern is the only one in the codebase.src/nats.rs—NatsHandle.clientcarried a stale#[allow(dead_code)]claiming the field is never read after construction;store_with_configreads it. Removed the vestigial suppression and corrected the comment to point at the real reader.Audit context: the only other production-path finding (the cross-function invariant
expectinswap_pointer) is deliberately left as-is — the pointer-swap model proves the state unreachable, and a panic there is the desired loud witness if the kernel/plumbing agreement ever breaks.🤖 Generated with Claude Code