Notes/Bootstrapping

Bootstrapping Launches and Adds PostgreSQL Support

Bootstrapping, the studio’s twentieth project, deals with the rows an app needs before anyone can use it: roles, permissions, plan tiers, country lists. Loading them once is easy. Updating them on the next release is where customers’ edits get overwritten, or the new values never arrive. Bootstrapping keeps a small ledger in the same database, so every value can be compared three ways, and a value an admin changed stays changed. A value both sides changed differently stops the apply until someone picks.

Version 0.1.0 came out on 18 October for SQLite. A day later 0.2.0 added PostgreSQL, CSV files for long lists, and bst plan -markdown, which turns the plan into a pull request comment so reviewers see what a seed change will do. On PostgreSQL the server itself decides when two values are the same, so 7 and 7.00 in a numeric(10,2) column don’t show up as a change. It’s a Go library and a command, open source under Apache 2.0, with binaries for Linux, macOS and Windows.

The testing runs random histories of seed versions and admin edits: 492,228 values checked against the merge rules, with none overwritten without a conflict, and the same figures again on PostgreSQL. 400 applies were killed with SIGKILL halfway, and every database was found exactly as before or exactly as after. Before 0.2.0 shipped, an independent review of the PostgreSQL code found ten defects, among them strings quietly cut to a column’s length. All ten are fixed, each with its own test. LQO also works on PostgreSQL from the outside, on query plans; Bootstrapping looks after the data the app ships with.