The Resurfaced Memory

Easy

· Frontend

Incident

SEV-1

BUG-2014

Priority: Critical (trust) · reported by comms

Time to fix: 10 min

Failing checks on the shipped build

  • deleted posts never appear

    expected 1 but got 2

  • private posts never appear

    expected 1 but got 2

  • most liked comes first

    expected [2,3] but got [1,3]

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

Facebook · Year in Review

Inspired by Facebook's Year in Review resurfacing posts people had deleted or locked down. The highlight reel must only ever contain public, non-deleted posts — sorted by likes, best first.

The bug hides in one filter expression in yearReview.js.

Code map

// Builds the year-in-review highlight reel.
exports.buildReel = function (posts, topN) {
  var eligible = posts.filter(function (p) {
    return !p.deleted || p.visibility !== "private";
  });
  eligible.sort(function (a, b) {
    return a.likes - b.likes;
  });
  return eligible.slice(0, topN);
};

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 Resurfaced Memory — JavaScript Bug Hunt

Inspired by Facebook's Year in Review resurfacing posts people had deleted or locked down.

  • Language: JavaScript
  • Layer: Frontend
  • Difficulty: Easy
  • Concepts: Filtering, Privacy
  • Modelled on: Facebook · Year in Review
  • Visible tests: deleted posts never appear; private posts never appear; most liked comes first
  • Reward: 50 XP for a complete fix

Incident

  • Severity: SEV-1 (priority: Critical (trust))
  • Ticket: BUG-2014
  • Reported by: comms
  • Time to fix: 10 minutes, the target for an easy incident

Failing checks on the shipped build

  • deleted posts never appear — expected 1 but got 2
  • private posts never appear — expected 1 but got 2
  • most liked comes first — expected [2,3] but got [1,3]

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 Facebook's Year in Review resurfacing posts people had deleted or locked down. The highlight reel must only ever contain public, non-deleted posts — sorted by likes, best first.

The bug hides in one filter expression in yearReview.js.

Bug report

BUG-2014 · Priority: Critical (trust) · Reported by: comms

  • Deleted posts are appearing in Year in Review reels.
  • Private posts appear too.
  • The "top" post shown is actually the LEAST liked one.

Spec: exclude deleted posts, exclude visibility "private", return the top N by likes, most-liked first.

Logs

[review] included post id=77 deleted=true
[review] first slide likes=2, last slide likes=9540

The code as shipped

src/review/yearReview.js (editable)

// Builds the year-in-review highlight reel.
exports.buildReel = function (posts, topN) {
  var eligible = posts.filter(function (p) {
    return !p.deleted || p.visibility !== "private";
  });
  eligible.sort(function (a, b) {
    return a.likes - b.likes;
  });
  return eligible.slice(0, topN);
};

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.