Putting SIM OTA data under version control when the server is still writable
The data that reconfigures SIM cards over the air lived on one server and nowhere else; moving it into git took 114 files and created a two-writer problem that is still there.
SIM over-the-air provisioning is file-shaped (no API, no database). A campaign is a script sent to a card by SMS, the network lists it writes are binary files, and the server that sends them keeps all of it in a directory tree. Before this work, that tree was the only copy (no backup in git, none anywhere else).
CW-1648 imported it: 114 files, 1,275 insertions, one commit (November 2024), plus a Makefile and a workflow to push changes back. The tree in the repository mirrors the server's:
ota-data/simota/
fields.xml
db/ # 44 text files: field, provision, aid_map, fallback-switch, ...
bindata/ # 17 directories: config, dplmn, fplmn, mccmnclist, fallback, pnn, ...
smsscripts/ # 82 OTA scripts
The scripts are not text
Each .script is a fixed-size binary blob — 65,800 bytes, every one of them. Git stores a whole new object when a single byte
changes, and git diff on the result says one thing (Bin 65800 -> 65800) and nothing more. Version control gives this data two things (history, rollback). It does not give review,
and that limitation is structural, not something a hook can fix.
Deploy pushes two paths; pull reads four
The Makefile is asymmetric on purpose (two paths out, four back in):
DEPLOY_FILES = simota/fields.xml simota/db/
PULL_FILES = simota/fields.xml simota/db/ simota/bindata/ simota/smsscripts/
Scripts and binary data are authored on the server, through its web interface and by sftp, so
the repository can back them up and must never push them. Deploying smsscripts/ would overwrite work that exists
only there — hours of it, with no copy. The rsync filters say something similar about the
server's own scratch: db/*.bin is bytecode the server compiles, smsscripts/*-backup are
copies it writes itself, and both are excluded in each direction.
Two writers, one of them not git
This is the part that does not resolve (and has not, in two years). The server stays writable because operators need it to be — so a deploy from main can
overwrite a change nobody committed. The README states it
plainly: changes can be made in two places, and deployment overwrites server files with the
repository's.
The repository eventually grew a guard for it (a colleague's, December 2025). Before deploying, the workflow compares the server against the previous commit; if the server is ahead it triggers a pull workflow, opens a sync PR, and aborts the deployment with a non-zero exit. The deploy only proceeds once that PR is merged, or when the commit being deployed is itself an auto-sync commit, which it detects by matching the commit message.
My part was the import, the Makefile and the first deploy workflow (plus the fix that let it run on a merged PR and on manual dispatch). The sync-back detection is not mine, and it is the piece that made the arrangement safe.
What went wrong, visibly
The git history carries both failure modes as paired commits (break, then repair). One sync PR pulled the server's state and deleted a set of fields in the process; the next PR restores them, titled exactly that. And a script whose filename contained a period was renamed to remove it (the period broke the OTA load) — then the rename was reverted the same week, because the server expects the name it already had.
Neither is a bug in anything. Both are what it looks like when a repository and a live server disagree about which of them is authoritative, and both were cheap to fix only because the history existed to fix them from.