Phone numbers kept as files in git

The register of record for MSISDN stock is a directory of text files on the default branch, and an allocation is a commit.

Infra

The model

stock/ holds the ranges that were bought. used/ holds the allocations (one file per SIM batch, named after the batch). Allocating means running the calculator with a count and a batch name (-count, -sim-batch), which writes used/<batch>.txt, and then committing that file.

The README is blunt about the two ways it goes wrong. Pull first (git pull, step zero), because somebody may have pushed an allocation since your last commit. Push immediately afterwards, because an allocation that exists only on your laptop will be handed out to somebody else as well.

Why it holds

There is no lock. Two people running the tool in the same minute get overlapping numbers and nothing in the tool notices — the branch is the lock, and merging is how you take it. That sounds fragile, and mostly it is not, for reasons that have little to do with software. Allocations happen a few times a month, in batches, by the handful of people who know the procedure, and each one lands as a reviewed pull request with a ticket in the subject (ROAM-8, WRSV-11, WOPS-310).

What the model gives away free is the audit trail a database would need a table and a retention policy to provide. Every allocation is a diff carrying the four things an audit asks for (author, date, reviewer, ticket). git log on used/ is the allocation history; no part of it can be quietly edited.

What it costs

Churn, when a decision changes. A 100,000-number allocation to one batch went in on 27 July 2026 (one file, 100,000 added lines), was reverted in full the next day, and then re-landed at half the size (a third commit removing 50,001 lines). Three commits, one working day, and the inventory crossed through two states that were each briefly the truth.

In a database that is one transaction; here it is a revert of a revert in a file of plain integers, and the answer to "how many are left" depends on which merge you are standing on. The first attempt also went in with the count misspelled in the subject line, which is the kind of thing a review catches and a schema cannot.

My part in it

I did not build any of this. The calculator is a colleague's Go program, the provisioning scripts and the cross-system discrepancy checks belong to other people on the squad, and my single commit in the repository is the workflow that publishes the remaining count once a day (61 lines, one cron).

The inventory model is worth describing anyway, because it decided what the monitoring could be. A count that is true only for the default branch, published daily, with open pull requests invisible to it — that is not a compromise I chose. It is the shape of the register, showing through the shape of the metric.