Menu
gitmoru
English

The zero was the scary part

Built while cleaning up a real incident from a terminal. One account was taken over, and within hours 222 branches had been overwritten.

It started as a script that checked a few branches with gh api. At 222, we stopped trusting what it printed.

When it printed zero, there was no way to tell a genuinely clean result from a lookup that had failed. One badly written command quietly returning zero was the scariest part.

Telling those two apart is the thing that turned a script into a tool.

What a script could not do

  1. 01

    The activity record doesn't say whether a push was forced

    It has before and head, and no forced flag. A normal push and an overwrite look identical. Write the obvious script and all 222 look normal.

  2. 02

    One error, two meanings

    A 404 on compare can mean the history was replaced, or that the commit was garbage collected. The first is a fact to report, the second is a failure to verify. A script logs both as an error and moves on.

  3. 03

    One wrong character in a timestamp scans the wrong window, silently

    Date.parse doesn't throw on input it can't read. It invents January 1st, 2000. You scan 26 years ago and get "nothing happened".

  4. 04

    Nobody can read 222 of anything

    A script just dumps everything into a terminal. What you actually need is "which of these first", and that needs a screen.

Where it stands now

The restore is done. The tool stayed for next time. If it happens again, this is what you open.

Thanks for reading.

Get started →