One Sensor, No Second Opinion

Medium

· Backend

Incident

SEV-1

BUG-MCAS

Priority: Critical (safety) · reported by flight controls

Time to fix: 20 min

Failing checks on the shipped build

  • a single stuck sensor disengages the system

    disagreeing sensors must disengage, not trim: expected 0 but got -1

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 request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
  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

Boeing 737 MAX · MCAS

Modelled on the Boeing 737 MAX MCAS design: the system trimmed the aircraft nose-down based on a single angle-of-attack sensor, even though two were fitted. A single failed vane commanded repeated nose-down trim, and two crashes followed.

mcas.js reads one sensor and acts on it.

Fix computeTrim so it cross-checks both sensors and disengages when they disagree.

Code map

// Decides whether to command nose-down trim.
exports.computeTrim = function (left, right, threshold, disagreeLimit) {
  if (left > threshold) return -1;
  return 0;
};

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.

One Sensor, No Second Opinion — JavaScript Bug Hunt

Modelled on the Boeing 737 MAX MCAS design: the system trimmed the aircraft nose-down based on a single angle-of-attack sensor, even though two were fitted.

  • Language: JavaScript
  • Layer: Backend
  • Difficulty: Medium
  • Concepts: Redundancy, Sensor Fusion
  • Modelled on: Boeing 737 MAX · MCAS
  • Visible tests: agreeing sensors below the threshold command no trim; a single stuck sensor disengages the system; agreeing sensors above the threshold do trim
  • Reward: 50 XP for a complete fix

Incident

  • Severity: SEV-1 (priority: Critical (safety))
  • Ticket: BUG-MCAS
  • Reported by: flight controls
  • Time to fix: 20 minutes, the target for a medium incident

Failing checks on the shipped build

  • a single stuck sensor disengages the system — disagreeing sensors must disengage, not trim: expected 0 but got -1

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 request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
  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

Modelled on the Boeing 737 MAX MCAS design: the system trimmed the aircraft nose-down based on a single angle-of-attack sensor, even though two were fitted. A single failed vane commanded repeated nose-down trim, and two crashes followed.

mcas.js reads one sensor and acts on it.

Fix computeTrim so it cross-checks both sensors and disengages when they disagree.

Bug report

BUG-MCAS · Priority: Critical (safety) · Reported by: flight controls

computeTrim(left, right, threshold, disagreeLimit) must:

  • disengage (return 0) when |left - right| exceeds disagreeLimit — the sensors disagree and neither can be trusted
  • otherwise use the AVERAGE of the two; trim nose-down by -1 when the average exceeds threshold, and 0 otherwise

Observed: only the left sensor is read. A stuck vane at 74.5 degrees commands continuous nose-down trim while the right sensor reads a healthy 5 degrees.

Logs

[mcas] trim=-1 aoaLeft=74.5 aoaRight=5.0
[mcas] trim command repeated 21 times

The code as shipped

src/flight/mcas.js (editable)

// Decides whether to command nose-down trim.
exports.computeTrim = function (left, right, threshold, disagreeLimit) {
  if (left > threshold) return -1;
  return 0;
};

Read-only context: src/flight/DESIGN.js.

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.