Case Study Data Engineering CI as Infrastructure

The Ceiling Was Someone Else's

A production database kept as one SQLite blob on a Git branch, pushed twice a day. The pattern is cheap and it works, until the file approaches a limit you did not set. Six remedies, three of them wrong in ways you can measure, and a twelve-run outage whose real cause was the fix the project had already written once, for a different table.

Andrew Maury
Andrew Maury
• November 2026

AddressIntel, our predictive real-estate intelligence project, scraped municipal permit portals on a schedule and served what it found. It had no database server. The whole store was a single SQLite file, peninsula_intelligence.db, committed as a blob to a long-lived Git branch called data-store, checked out at the start of each run and pushed back at the end of it.

That branch carries 152 commits between 3 September and 4 November 2026, 62 days: 120 of them carrying the pipeline's automated-backup message, the other 32 hand-run data commits. The project was wound down in November 2026; the last pipeline run started on 4 November at 17:30 UTC and the last commit to the branch landed at 18:50. Everything here is measured against the store as it was finally left. The figures come from the canonical copy on data-store rather than from a development machine, and the piece says so again later, because that distinction turns out to be one of the pattern's running costs.

The pattern deserves part of its reputation. There is no instance to pay for, no connection string, no backup job, and the history of the data is the history of the branch. What the write-ups we read did not cover is that once the file gets large the constraint stops being yours. It becomes a number set by whoever hosts the remote, enforced at the least convenient point in the run, and the obvious ways around it are mostly wrong in ways you can measure.

It is worth saying the ending first, because the rest reads differently without it. Twelve consecutive runs failed, from 29 October to 3 November 2026, eleven of them on the project's own size gate with the store at 92.27 MiB and 7.73 MiB of headroom under the host's hard limit. Then a sixth remedy landed, the pipeline ran green three more times, and the project was wound down for unrelated reasons. The interesting part is not that the ceiling was hit. It is what actually caused the collision, which was not the thing the project had spent two months defending against.

What the pattern bought

The shape is simple enough to describe in a sentence. A scheduled GitHub Actions workflow checks out data-store into a db_storage directory, copies the SQLite file into the working tree, scrapes, enriches, derives, pushes the new rows to the serving layer, copies the file back and commits it. The workflow is 1,138 lines, and the scraping is a small share of them; most of the file is guards and ordering.

What it genuinely bought is that the store is its own backup, restored once per run, with two months of versions retained for nothing. The second property, the one that looks like free real estate, is that anything the pipeline wants to remember between runs can be written into the file and ride to the branch with everything else, with no second system to provision.

That second one is a trap, and the project walked into it. The section after next is about how.

The number that was not ours

GitHub rejects any blob of 100 MiB or more at the pre-receive hook. The project's record of 15 September 2026 at 17:30 UTC has the push finally failing:

remote: error: File peninsula_intelligence.db is 100.55 MB; this exceeds
GitHub's file size limit of 100.00 MB
 ! [remote rejected] data-store -> data-store (pre-receive hook declined)

The timing is the lesson rather than the limit. The save step is the last thing a sixty-minute run does, and the sync to the serving layer runs before it. So production kept receiving fresh rows while the canonical lineage stopped advancing, silently, and that run's scraped rows were lost. A failure at the end of the run is a failure that has already spent the run.

What pushed it over was not drift. By the project's account a change five days earlier had replaced a 25,000-row ceiling on the archive restore with a count-sized fetch, and the first run under it restored 40,322 archived permits the ceiling had been hiding, taking the store from 146,903 to 187,225 permits in one pass. The restore was working as designed. The consequence of it working was that the store began converging on an append-only archive, which is to say the file could only grow.

The first four remedies, three of them closed with a number

Each of the obvious answers is plausible, and three are worse than the problem once someone puts a number on them. The measurements in this section and the next are the project's own, recorded in the header of the compaction script and in the horizon config at the time each option was ruled out. I have reproduced the end state they produced, but not re-run the comparisons themselves.

Together, 21.6% with nothing lost. Both changes are verifiable on the final store, which reports a page size of 16,384, carries both tables as WITHOUT ROWID, and has a freelist of zero pages. A 32 KiB page was measured too, at 77.59 MiB against 16 KiB's 77.61, so the larger page bought 0.02 MiB and cost read amplification. That result is worth recording precisely because it is boring: it closes the question instead of leaving it to be re-proposed.

One paragraph of that script's own header has gone stale, and it is worth flagging because it is the sentence a reader would otherwise inherit. The header says the compaction is idempotent, a no-op once the layout is right. The function has a third rewrite trigger: it also rebuilds when at least 3% of pages are unused and that slack is at least 2 MiB, which is what a bulk insert does to a b-tree. The behaviour is documented twice lower down, beside the constants and again inside the function, where the comment says plainly that this is the case the first release missed. Only the summary at the top never caught up. On 3 November it fired on a store whose layout was already correct, logging 3.1% of pages unused (2.89 MiB); reclaiming and then 92.27 to 92.27 MiB (0.00 MiB reclaimed): a full rewrite that returned nothing. A docstring is the part of the code that ages without anything failing.

The remedy the guard forbids

Compaction buys a fixed percentage once. It does not change the slope, and against an append-only archive a fixed percentage is a delay. The real remedy was to decide what the working store is for and stop keeping rows outside that window.

An earlier note had ruled pruning out, and its reasoning was correct when written: a prune is self-defeating while the restore is additive, because the archive re-inserts what you removed on the next run. What made pruning viable was bounding the restore at a configured horizon date, 1 January 2023, on 15 September. What the objection could not foresee is that bounding the restore bounded one writer out of eleven. Three ingest loaders then put 78,803 pre-2023 rows into the store by hand, which is what tripped the size gate on 6 October before that run had scraped anything.

So the horizon stopped being one writer's rule and became the store's invariant: a filter applied to every loader at write time, and a sweep over the table on every run. There is a test that enforces this by discovering the writers rather than listing them, so a new loader fails it by existing. Measured through the compaction script on one commit, the sweep took 93.53 MiB to 75.61 MiB, and the permit table from 47.28 MiB to 29.36 MiB.

Which the regression gate is built to reject. A prune makes a total fall, and a falling total is the exact condition that fails a run. The two guards are in tension by construction, and the resolution is not clever: the one-time cleanup carries an explicit acceptance flag that records the reduction as deliberate and rebaselines. The drop is still legible in the stored metric history. The highest permit total it ever recorded is 198,608 on 5 October at 19:04 UTC; the lowest is 120,039 the following evening at 18:47. The store ended at 127,947.

The guard whose memory the branch erased

The regression gate exists because of a defect two snapshot guards could not see. Rows kept landing and per-city counts held while a placeholder overwrote a real valuation on every sync, and by the project's reckoning $794,618,780 of valuation obtained through public-records requests was erased over months with every run staying green. Nothing had recorded what the numbers were last run, so nothing could notice them shrinking.

The fix was a metric_history table written into the database itself, so it would ride to the branch for free. This is the obvious move under this pattern and it is where the pattern bites hardest, because for its first weeks the gate never compared anything at all. Every run printed that it had no prior record and that the gate would be live from the next run, and it never was.

Both persistence paths had failed, and they failed for opposite reasons. The sidecar JSON file was covered twice by .gitignore, and the checkout action cleans ignored files at the start of every run, so it was deleted before the run that would have read it. The in-database table failed because of the branch: the gate ran last, after the save step had already copied and pushed the file, and the next run's restore overwrote the working copy wholesale with the pushed copy that had no such table. The guard against an eight-figure silent loss was itself silently doing nothing, which is the precise failure mode it was built to catch.

The fix kept the property that made the gate safe and moved only the write: record the baseline before the save, save, then run the gate. The table's history starting on 16 September rather than at the branch's own beginning on 3 September is the fingerprint of that repair. It now holds 20,138 rows across 76 snapshots, per city and in total.

The transferable version is not about SQLite. If a guard's state lives inside the artifact your pipeline overwrites every run, the ordering of the write against the overwrite is the guard. Get it wrong and you have a gate that reports success and compares nothing.

Ordering, four more times

The same reasoning runs through the rest of the workflow once you look for it.

The horizon sweep was first placed in the derivation block at step 15, while the size gate is step 8, so on 6 October a run died at the gate on a 93.53 MiB store while holding the rows that the step seven places later existed to remove. To be exact about the blast radius, because the lesson is more quotable than the incident: the misordering was introduced at 09:15 and corrected at 10:13 the same morning, and cost exactly one run. The principle is still the one worth keeping. A remedy downstream of the check that demands it is not a remedy.

Compaction happens before the copy, so the blob that goes up is the small one, and the early gate cannot do that job because the run's own bulk inserts happen after it. The final size check is deliberately duplicated immediately before the push, because a single run can add rows and the number that matters is the one being pushed. Failing there with your own message beats failing on the remote's pre-receive hook: it names the file, the size and the remedy inside the step's own log rather than as a remote: error: line in a 1,300-line run log.

Four gates sit after the sync and after the save, with only log handling behind them: source health, permit coverage, metric regression and a narrow scoring check. They are last for the opposite reason to everything above. A run that goes red has already persisted every byte it collected, and a red run that kept its data is the goal. The source-health gate exists because a city sat at 2 permits for weeks on a rejected portal login while the scraper printed a warning, returned an empty list and let the run report success, and that absence then rendered as "0 demo permits" in copy sent to an audience who would know it was false. It checks only failures a scraper knows about and refuses to infer breakage from a low count, since a quiet city and a broken scraper both yield zero. It is also deliberately slow to escalate: a failure is annotated on the first run, and the job only goes red once a source has failed a threshold number of a recent window of runs, or two sources break at once. That rule was added after a single scraper crash red a run in which everything else had worked.

There is one more guard worth stealing outright. The data-store checkout is allowed to fail without failing the run, so the save step first asks whether the directory is missing while the branch exists on the remote. If both are true, this run started from an empty database and pushing it would replace the whole backup with one run's worth of data. It bails. The push is a force push, so nothing else would have stopped it.

Two copies, one filename

The cost the pattern never stops charging is that a database you can copy is a database that gets copied.

On 15 September 2026 four separate published figures were wrong from a single cause: they were measured against the file on the development Mac rather than the canonical copy on data-store. Both files are called peninsula_intelligence.db and nothing on either said which was which. A classifier change was published as moving 37 rows in one city; measured against canonical it moved 280, and the gap was a second city whose permits the development copy did not hold at the time, so the published claim could not have named it. (The canonical re-measure was not the end of it either: that city's rescue was later partly reverted, because 108 of the 274 rescued rows were detached ADUs mislabelled under single-family.) A join rate of "3,417 of 3,447 APNs, 99.1%" was measured against a table that exists only on the dev machine, where the canonical figure is 0 of 3,447, and it reached a commit message and a public-facing log. An ingest's before-count was read as 57 when canonical already held 96. A committed test fixture was generated from the local copy and so covered 40,514 pairs of a 95,354-pair corpus, blind to the vocabularies it was missing.

The response was a provenance test rather than a naming convention, and it is two-sided on purpose so it cannot pass on a truncated or unreadable file. A database is canonical only when it carries a marker table that data-store has and the dev copy does not, and carries none of the seven tables only a development machine builds. Run against the two copies as they now stand it classifies both correctly: canonical holds 20 tables and the marker and none of the seven, the development copy holds 25 tables and all seven and no marker.

The divergence is not a rounding error. The canonical store is 92,487,680 bytes, 88.20 MiB, holding 127,947 permits. The development copy is 769,474,560 bytes, about 733.8 MiB, holding 228,011. Eight times the file for 1.8 times the rows, because only one of the two is under any pressure to stay small. Neither is a superset of the other, and the gap is wide in both directions: comparing them on the composite key, 121,776 permits are in both, 6,171 exist only on canonical and 106,235 only on the development copy. The canonical copy holds permits issued as recently as 4 November; the development copy stops at 13 October.

That is the honest accounting. The branch gives you a canonical copy for free, and then the ordinary act of working on the data produces a second one that is larger, fresher in some respects, staler in others, and indistinguishable by name.

How it actually ended

Twelve consecutive runs failed, from 29 October 05:30 to 3 November 17:30. Eleven died at the size gate within a minute of starting, before scraping anything; the twelfth was the only one in the streak to reach the metric regression gate and fail there.

The gate's error text on 3 November is the fairest summary of the pattern anyone wrote (punctuation normalised, tail elided):

The data-store SQLite file is 92.27 MiB, over the 92 MiB gate and only
7.73 MiB under GitHub's 100 MiB blob limit. The save step at the END of
this run would be rejected by the pre-receive hook, after the Data Connect
sync had already published this run's rows, so the run is stopped HERE
instead, with nothing published and nothing lost. Compaction has already
been applied and was not enough: the store needs a real remedy (bound the
working store against the archive, or split it). [...]

The guard did its job. It converted a push rejection at the end of the run into a cheap refusal at the start of it, which is the whole difference between losing an hour's scraping and not. The store sat over the project's own gate for twelve consecutive runs, five and a half days.

And then the obvious conclusion turned out to be wrong, which is the most useful thing in this piece.

The tidy reading is that an append-only permit archive had outgrown a fixed-percentage fix and the pattern was finished. The commit that ended the outage says otherwise. It names the cause as a single dispatched run: a ten-year sold-sales pull on 13 October wrote 17,054 pre-2023 sales, taking the sales table from 19,629 to 45,766 rows and 4.69 to 10.98 MiB. The permit horizon had no part in it. Permits were bounded; sales were not. The backfill did not trip the gate on the day either: it landed on 13 October and the first red run was the 29th, so it was the thing that removed the headroom rather than the thing that consumed the last of it.

That is this piece's own best insight happening a second time. Bounding the restore bounded one writer of eleven, and the answer was to make the horizon the store's invariant. The horizon was then made an invariant of the permits table, and a different table walked through the same door one week later. The fix of 3 November extended the sweep to sales on sale_date at the same 1 January 2023 horizon, and rebuilt three more tables WITHOUT ROWID: the sixth remedy, and more of the third, fourth and fifth. It took the store from 92.27 to 85.61 MiB on a copy, and it worked. The next run pruned 200 sales, compacted 87.38 to 87.33 MiB, and went green. Two more green runs followed on 4 November, and the store was finally left at 88.20 MiB with no pre-2023 permits under the horizon's own predicate, which deliberately keeps the 7,716 rows carrying no issued date, and 201 pre-2023 sales, 0.7% of that table, arriving after the last sweep.

So the pipeline did not die against the ceiling. It was wound down, three green runs later, for reasons unrelated to the ceiling. What the episode actually demonstrates is narrower and more useful than exhaustion: an invariant enforced per table is not an invariant, and the table that breaks it next is the one nobody re-checks, because by then the rule reads as settled.

What to take from it

A Git branch was a defensible place to keep this database, and it held one for two months without an instance to pay for. What it charged was not storage. It was the work of discovering, one red run at a time, where somebody else's limit sat, which of your own guards would fight you on the way to it, that the file you were protecting had quietly become two, and that the rule you wrote to protect it covered one table out of several.

Running a pipeline that has outgrown its storage?

Rantum is a senior data science & ML studio. We turn messy, fragmented, and adversarial data into models, APIs, and products that ship, and into numbers a board can rely on.

Work with us