Works here, not there

Think of it when something works on your laptop and fails on the server, or works in testing and fails for real users.

In everyday life

A cake recipe works in your oven and burns in a friend’s: their oven runs hotter and their flour is different. The recipe was the same; the kitchen was not.

One case

A developer in Berlin builds a “today’s trips” report for a ride-sharing app. At 23:30 on 3 March, the laptop, set to Berlin time, counts 120 trips. The server runs on UTCThe world’s reference clock. Servers often run on it, so their “today” can start at a different hour from yours., one hour behind Berlin in March, and reports 117 trips: the 3 that started between 00:00 and 01:00 Berlin time count as 2 March.

Same code, same trips, a different clock
The case, cell by cell1 cell = 1 trip
Day of the trip, Berlin time
3 Mar3 Mar3 Mar3 Mar3 Mar3 Mar
Day the server counts it
2 Mar2 Mar2 Mar3 Mar3 Mar3 Mar
Trips on the wrong day
3
Lines of code that differ
0
Trip times are Berlin time. The server’s day starts at 01:00 Berlin time.

Every case

A program depends on far more than its own code: the language version, the installed packages, settings, secrets, the data, the clock, the operating system. A laptop collects years of small changes that nobody wrote down. Each difference is a place where “it works for me” stops being evidence. The closer the test machine is to the real one, the more a passing test means.

The word

Engineers call this

environment differenceThe same code behaves differently on two machines because the machines differ: a version, a setting, the data, the clock. The code is the same; its surroundings are not.

Write down everything the code depends on, and make the test machine match the real one. Trust a result only from a machine like the one your users reach.

Where this idea leads

Skills that encode it

  • create-verification-skill pstackA proof run in a stand-in must list “every setup step the stand-in did that the target will not”.
  • diagnosing-bugs Matt PocockThe “differential loop”: run the same input through two versions or configs and diff the outputs.
  • full-send tstackIts proof includes “Run the checks that the repo’s CI runs”, not only what passes on one machine.