Understorycode archaeology

$ git blame -L 9,9 src/billing/charge.ts

92f6a3f (Priya Ramanwho 2023-03-15when 9) for (let attempt = 0; attempt < 3; attempt++) {

$ git blame -L 9,9 src/billing/charge.ts

for (let attempt = 0; attempt < 3; attempt++) {

why ∅ · not in blame

today
±0

Why is this line here?

92f6a3f Priya Ramanwho 2023-03-15when

Understory investigates why a line of code exists. It goes through commits, pull requests and issues to find the decisions that led to it.

asked about the number 3 · line 9

Why exactly 3 retries?

reasons found · 0 of 3

scroll to dig · depth = timescale break · 3y 6m, line 9 unchanged

02

Blame stops here.

git blame shows who changed the line and when. It doesn't say why.

  1. 15 Mar 2023 · −3.5y

    git blame · line 9

    92f6a3fCap charge retries at 3, add backoffPriya Raman

    “Bound retries to 3 attempts with 1s/2s/4s backoff. Fixes the double-charge path from #1187.”

    who when what why ∅

    reasons found · 1 of 3

    Capped at 3 attempts, with backoff

03

Thirteen days in March 2023.

From the commit, the investigation finds a pull request, two reviews and an issue.

  1. 14 Mar

    review·dmitri-kChanges requestedon PR #812

    “5 attempts with backoff blows past the 10 s webhook window. 3 gives a 7 s worst case.”

    reasons found · 2 of 3

    In review, the cap dropped from 5 to 3 because of a 10-second timeout

  2. 12 Mar

    review·ana-lApprovedon PR #812

    “LGTM once the cap comes down.”

  3. 9 Mar 2023 · −3.6y

    PR #812Bound retries in chargeCustomermerged as 92f6a3f

    “Unbounded retries double-charged customers during the Stripe incident (#1187). This caps attempts at 3 and adds exponential backoff.”

  4. Earlier version of the line

    for (let attempt = 0; attempt < 5; attempt++) {

    attempt < 5

04

Checked against the source.

Each conclusion points to the records behind it. Quotes are checked directly against their sources.

  1. 2 Mar 2023 · −3.6y

    issue #1187Customers double-billed during Stripe outage

    Stripe returned 504s and 212 customers were charged twice.

    Quote confirmed in issue #1187

    PR #9999 · discarded: not in the evidence

    reasons found · 3 of 3

    The change came after 212 customers were charged twice

    2 sources · 1 verified

05 · 1y 8m

The record is silent here.

The history reaches commit 7be210e, but no pull request, review or issue explains the decision. Without enough evidence, Understory leaves the question open.

∅ pull request∅ review∅ issueNo record found in the sources checked

Why retry at all? No explanation on record.

Without evidence, the answer leaves it open.

  1. 18 Jun 2021 · −5.3y

    7be210eAdd retry loop to charge∅ PRLeo Park

  2. Earlier version of the line

    while (true) {no bound

    while (true) { · no bound

origin · line 9 first written 5.3 years ago

06

Three reasons on record. One question left open.

Every answer comes with the evidence you need to check how it was built.

reconstructed

Why exactly 3 retries?

  • Capped at 3 attempts, with backoff
  • The change came after 212 customers were charged twice
  • In review, the cap dropped from 5 to 3 because of a 10-second timeout

verified

3 quotes confirmed

  • “3 attempts with 1s/2s/4s backoff”
  • “212 customers were charged twice”
  • “3 gives a 7 s worst case”

not recorded

Why retry at all?

The first version stood for 1 year 8 months with no record explaining where it came from. Understory keeps that question open.

Interrogate your own code.

Pick a repository and a line of code. Find out what its history says about it.

Explain a line