Skip to content

harden ember-cluster — saturating arithmetic in migration progress - #105

Merged
kacy merged 1 commit into
mainfrom
harden/ember-cluster
Feb 12, 2026
Merged

harden ember-cluster — saturating arithmetic in migration progress#105
kacy merged 1 commit into
mainfrom
harden/ember-cluster

Conversation

@kacy

@kacy kacy commented Feb 12, 2026

Copy link
Copy Markdown
Owner

summary

uses saturating_mul in the migration progress percentage calculation to prevent a theoretical u64 overflow when keys_migrated * 100 exceeds u64::MAX.

while triggering this requires >1.8e17 keys (far beyond any practical scenario), saturating_mul is zero-cost and makes the arithmetic unconditionally correct.

what was tested

  • all 59 ember-cluster unit tests pass
  • migration_progress test specifically verifies correct percentage calculation
  • cargo clippy -p ember-cluster clean

prevents theoretical u64 overflow when computing
keys_migrated * 100 for progress percentage. while the overflow
requires >1.8e17 keys to trigger, saturating_mul is zero-cost
and eliminates the edge case entirely.
@kacy
kacy merged commit 4228d2a into main Feb 12, 2026
7 checks passed
@kacy
kacy deleted the harden/ember-cluster branch February 12, 2026 16:38
kacy added a commit that referenced this pull request Feb 19, 2026
prevents theoretical u64 overflow when computing
keys_migrated * 100 for progress percentage. while the overflow
requires >1.8e17 keys to trigger, saturating_mul is zero-cost
and eliminates the edge case entirely.
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