ankitects / ankitects/anki

Browser average interval/ease columns can overflow

Open Beginner friendly
#5,207 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
30.5k
Forks
3.2k
Avg merge
2d 8h
Merged PRs (30d)
72

Description

### Problem

The Browser table calculates average interval by summing day intervals as `u32` and then multiplying by 86,400 in `u32`. A single interval above about 49,710 days, or multiple large intervals in notes mode, can overflow. The average-ease calculation similarly sums values as `u16`, which can overflow with roughly 27 cards at ease 2500 in notes mode.

In debug builds this can panic; in release builds it can display an incorrect value.

### Steps to reproduce

1. Give a card a very large interval, for example with Set Due Date, a high maximum interval, or an add-on.
2. Show Average Interval in the Browser.
3. Alternatively, select about 30 cards in notes mode with Average Ease shown.

### Expected behavior

The Browser computes and displays the averages without integer overflow.

### Additional context

I have a small fix with regression tests ready and will link it here.

Contributor guide

Open the contributing guide

Research direction

Start with the Browser's Average Interval and Average Ease calculations, reproducing the issue with a very large interval or about 30 cards in notes mode. Review the regression tests mentioned in the issue and confirm that the Browser displays correct averages without debug-build panics or release-build overflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.