The 130% Progress Bar

Easy

· Frontend

Incident

SEV-3

Time to fix: 10 min

Failing checks on the shipped build

  • over-completion clamps to 100

    expected 100 but got 130

  • zero totals never NaN

    expected 0 but got null

How to work this incident

  1. Read the report: write down the expected behaviour and the actual one in a sentence each.
  2. Reproduce it: run the visible tests and find the failing check that matches the report.
  3. Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
  4. Follow the value the screen shows back through the state and the pure helpers that compute it; the view is usually only the messenger.
  5. Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.

Inspired by

Upload dialogs

Inspired by every upload dialog that has proudly announced "130%" or "NaN%". Retried chunks push the done-count past the total, and empty uploads divide by zero.

progress.js renders the percentage. Clamp it into reality.

Code map

// Renders upload progress as a whole percentage.
exports.percent = function (done, total) {
  return Math.floor((done / total) * 100);
};

Sign in to edit the file, run the tests and submit a fix

A free account — no card, no trial clock. You come straight back here.

The 130% Progress Bar — JavaScript Bug Hunt

Inspired by every upload dialog that has proudly announced "130%" or "NaN%".

  • Language: JavaScript
  • Layer: Frontend
  • Difficulty: Easy
  • Concepts: Math, Clamping
  • Modelled on: Upload dialogs
  • Visible tests: normal progress computes; over-completion clamps to 100; zero totals never NaN
  • Reward: 50 XP for a complete fix

Incident

  • Severity: SEV-3
  • Time to fix: 10 minutes, the target for an easy incident

Failing checks on the shipped build

  • over-completion clamps to 100 — expected 100 but got 130
  • zero totals never NaN — expected 0 but got null

How to work this incident

  1. Read the report: write down the expected behaviour and the actual one in a sentence each.
  2. Reproduce it: run the visible tests and find the failing check that matches the report.
  3. Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
  4. Follow the value the screen shows back through the state and the pure helpers that compute it; the view is usually only the messenger.
  5. Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.

Briefing

Inspired by every upload dialog that has proudly announced "130%" or "NaN%". Retried chunks push the done-count past the total, and empty uploads divide by zero.

progress.js renders the percentage. Clamp it into reality.

Bug report

BUG-130PCT · Reported by: design QA

percent(done, total):

  • an integer 0..100 (floor)
  • total 0 -> 0, never NaN
  • done beyond total -> 100, negatives -> 0

Observed: retries show 130%, empty folders show NaN%.

Logs

[upload] 13/10 chunks -> "130%"
[upload] 0/0 chunks -> "NaN%"

The code as shipped

src/ui/progress.js (editable)

// Renders upload progress as a whole percentage.
exports.percent = function (done, total) {
  return Math.floor((done / total) * 100);
};

Open the hunt to start the incident clock, edit the files, run the visible tests and submit against the hidden ones, then write the root cause down. More JavaScript bug hunts.