Spot the bug in the supersession chain

from Architecture decision records
Node 24 intermediate 4 min 1 issue to find

Find the bug in this helper, which promises to return the current decision at the end of any supersession chain.

JavaScript
function currentDecision(records, id) {
  const record = records.get(id);
  if (record.status === 'Superseded') {
    return records.get(record.replacement);
  }
  return record;
}
Open in playground
Report an error