Production work · TypeScript · Firestore · BigQuery
Keeping campaign data complete
At True Native Media I build and run the integrations behind our podcast advertising workspace. In October a campaign wouldn’t confirm even though all of its records were in Airtable. This is what was going on and what I changed.
- Airtable
source records - Pub/Sub workers
paginated scans and repair - Firestore
operational mirror - BigQuery
exports and flat views
Edits made in the portal take a different route: they go to Firestore first, then an outbox patches only the Airtable fields it’s allowed to change.
What I built
I lead the integration work and run it in production. Scheduled publishers start workers that save their pagination offsets, so an interrupted scan picks up where it stopped. Rate limits and transient errors are retried with backoff, following the provider’s retry hints. Schema checks compare stable table and field IDs and record any field that was added, removed or changed type.
For scale: a diagnostic run on October 5, 2026 scanned 35 tables and 88,163 records, and the main mirror ran every 30 minutes. The mirror is TypeScript. Other parts of the campaign-planning platform are Python.
October 5: the parent was current, the children weren’t
A campaign’s confirmation failed even though its source records existed. The new child records were sitting in the sync queue, and because the parent record hadn’t changed, nothing went looking for them.
The fix checks for missing children whether or not the parent changed, and queues a repair when it finds a gap. Confirmation still refuses an incomplete campaign. I’d rather it fail loudly than confirm a campaign with records missing.
Why repairs get a quarter of the queue
Each normal batch of 32 reserves up to eight slots for urgent repairs, and urgent checks also run between webhook pages. A repair gets through quickly without starving the regular backlog.
Cursors only move forward after a batch is safely in the queue, so if a later batch fails, the source can be replayed. The worker also tracks whether a scan actually finished or only fetched part of a page. A recent timestamp on its own doesn’t prove nothing is missing.
How I confirmed the fix
The deploy record checks the source archive’s hash and that the worker configuration came through intact. After the deploy, three batches each completed 32 of 32 items, and all five affected records showed up in the mirror and in the campaign view.
That closed this incident. It doesn’t prove the whole base is in sync, and I haven’t load-tested the backlog.
Run the replay
Download the Python example (standard library only) or read its source, then run python3 campaign-freshness.py. It replays the incident: a missing child blocks confirmation even though the parent is unchanged, the repair is scheduled without crowding out ordinary work, and confirmation goes through once a fake provider response arrives.
It’s a short in-memory model written for this page, with made-up IDs. None of the production worker code or customer data is in it.
Code you can read
The production repositories are private, along with customer records and logs, so this page leaves out account and record IDs. For a write-up where all of the code is public, see shipping this site to two CDNs.
The production code is private and the replay uses made-up data. AI coding tools helped write this page and the example. How I work →
- Status
- In production; written from my October 2026 incident notes
- License
- Production code private; the replay is in the website repository
- Built with
- TypeScript / Node.js, Google Cloud Functions, Pub/Sub, Firestore, BigQuery