zapier-decisions/plans/qa/2026-10-03-libsql-dryrun.md

3.9 KiB
Raw Permalink Blame History

libSQL migrator dry-run (WP-K) — PASS

Date: 2026-10-03T06:24–06:26Z
Host: NS1 70.88.205.138 (NS1.GEORGELAMBERT.ORG)
Role: Engineer (safe dry-run only)
Result: PASS

Constraints honored

  • Did not modify /var/lib/timestamping-svc/data/blockchain.db or any Go timestamping DB (stat-only; mtime 2026-09-25).
  • Did not set BUSINESS_STORE=libsql (or any LIBSQL_*) on zappier-edge.service.
  • Did not delete/truncate live /opt/verae/zappier-edge/billing.db.
  • All migrator I/O under /tmp/libsql-dryrun-20261003T062452Z/ copies only.

Workspace

Item Path
Dry-run dir /tmp/libsql-dryrun-20261003T062452Z/
Source copy …/source-billing.db (90112 bytes)
Dest libSQL file …/dest.db (file:/tmp/libsql-dryrun-20261003T062452Z/dest.db, 94208 bytes)
Migrator /opt/verae/zappier-edge/dist/db/migrate-to-libsql.js (same content/mtime as /tmp/zappier-edge-work)
Runner …/run-migrate.mjs (uses opt node_modules; chdir to /opt/verae/zappier-edge)
JSON report …/migrate-report.json

/tmp/zappier-edge-work had no node_modules; used live opt install for @libsql/client + better-sqlite3. Migrator source identical in both trees.

Commands

# 1) Checkpoint + consistent copy (as verae-zapier → /tmp dry-run dir)
sudo -u verae-zapier sqlite3 /opt/verae/zappier-edge/billing.db "PRAGMA wal_checkpoint(TRUNCATE);"
# → 0|0|0
sudo chmod 777 /tmp/libsql-dryrun-20261003T062452Z
sudo -u verae-zapier python3 -c "import sqlite3; s=sqlite3.connect(\"/opt/verae/zappier-edge/billing.db\"); d=sqlite3.connect(\"/tmp/libsql-dryrun-20261003T062452Z/source-billing.db\"); s.backup(d); d.close(); s.close()"
sudo chown marchon:marchon /tmp/libsql-dryrun-20261003T062452Z/source-billing.db

# 2) Run migrator (node ESM runner → migrateBillingDbToLibsql)
cd /opt/verae/zappier-edge
node /tmp/libsql-dryrun-20261003T062452Z/run-migrate.mjs

Row counts

Table Live billing.db Source copy Dest libSQL Match
customers 4 4 4 yes
usage_entries 6 6 6 yes
channel_rates 108 108 108 yes
channel_rate_meta 1 1 1 yes
tiers 3 3 3 yes
price_endpoints 11 11 11 yes
invoices 0 0 0 yes
invoice_lines 0 0 0 yes

Customers on dest: cust-platform, cust_1, cust_2, cust_3.

Chain / tip hashes

Phase ok length tipHash
before (source copy via verifyUsageLedgerChain) true 6 8d58a2986f46a9775712354234d44075eea1257226f93f9fb33a19b444ddebd5
after (dest via LibsqlBusinessStore.verifyUsageChain) true 6 8d58a2986f46a9775712354234d44075eea1257226f93f9fb33a19b444ddebd5
live billing.db (post-run read) — 6 8d58a2986f46a9775712354234d44075eea1257226f93f9fb33a19b444ddebd5

Genesis prev_hash = 64 zeros; tip id = 6. Before tip === after tip; lengths match.

Dual-run / safety post-checks

Check Result
sourcePreserved: true (migrator report) PASS
Source copy still 90112 bytes after migrate PASS
Live billing.db still 90112 bytes; counts 4/6; same tip PASS
BUSINESS_STORE / LIBSQL_* absent from unit + not applied PASS
zappier-edge /health still 200 PASS
blockchain.db untouched (mtime 2026-09-25, ~31MB) PASS
booksJson absent (path not provided; stub skip)

Pass/fail

PASS — WP-K migrator dry-run on a WAL-checkpointed copy of live billing.db → file:…/dest.db succeeded with matching row counts and identical usage ledger tip hash. Live service remains on sqlite-file BusinessStore; no cutover.

Non-goals (explicitly not done)

  • No BUSINESS_STORE=libsql flip
  • No rsync/deploy of edge
  • No books.json prepaid import (schema stub)
  • No JetStream / multi-host work