[object Object]

← back to Costa Rica

costa-rica: move root migration files into scripts/ so the manual go-live pass can't skip them — TK-10346

3f07d61614f575eabcbb800bf176d02d8147dcbe · 2026-08-08 07:00:14 -0700 · Steve

migrate_007_double_book_exclude.sql + migrate_008_integrity_guards.sql were committed at
repo root (007 collided with the parallel-authored scripts/migrate_007_messages.sql). A
go-live migration pass globbing scripts/migrate_*.sql would have skipped them, leaving prod
without the race-proof no-double-book EXCLUDE + money-invariant CHECK guards. git mv into
scripts/, renumbered 008/009 to preserve ascending apply order. Content unchanged (provenance
header comment only). Suite 101/101 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 3f07d61614f575eabcbb800bf176d02d8147dcbe
Author: Steve <steve@designerwallcoverings.com>
Date:   Sat Aug 8 07:00:14 2026 -0700

    costa-rica: move root migration files into scripts/ so the manual go-live pass can't skip them — TK-10346
    
    migrate_007_double_book_exclude.sql + migrate_008_integrity_guards.sql were committed at
    repo root (007 collided with the parallel-authored scripts/migrate_007_messages.sql). A
    go-live migration pass globbing scripts/migrate_*.sql would have skipped them, leaving prod
    without the race-proof no-double-book EXCLUDE + money-invariant CHECK guards. git mv into
    scripts/, renumbered 008/009 to preserve ascending apply order. Content unchanged (provenance
    header comment only). Suite 101/101 green.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 YOLO_NOTES.md                                                | 12 ++++++++++++
 .../migrate_008_double_book_exclude.sql                      |  2 ++
 .../migrate_009_integrity_guards.sql                         |  2 ++
 3 files changed, 16 insertions(+)

diff --git a/YOLO_NOTES.md b/YOLO_NOTES.md
index af1d775..ac2fc17 100644
--- a/YOLO_NOTES.md
+++ b/YOLO_NOTES.md
@@ -79,3 +79,15 @@ Tilopay merchant affiliation REQUIRES, before any account/keys exist:
 **GO-LIVE PRE-FLIGHT (added C3, live-only — verify against real account):**
 4. **payouts.js catch path untested.** `UPDATE payouts SET status='failed'` (lines 46-49) only fires when `provider.payout()` rejects — never in sandbox. Cover with a `provider.payout` mock before go-live; a typo there would strand a failed payout as 'processing'.
 5. **Live payout/charge fetch has no timeout.** `tilopay.js` payout/charge `fetch` has no AbortController — a hung TCP leaves the payouts row 'processing' forever (host never paid). Add a timeout+abort to all live provider fetches during the go-live hardening pass.
+
+## Session 2026-08-08 (cra-app) — migration path fix + state verify
+
+**Verified state:** backend HEAD current, suite **101/101** green (`DATABASE_URL=postgresql:///costa_rica_directory?host=/tmp`), prod `costarica.agentabrams.com` 200 (authed). iOS app on TestFlight (build #13, ASC 6799240433).
+
+**Fix (local, reversible):** `migrate_007_double_book_exclude.sql` + `migrate_008_integrity_guards.sql` were committed at repo **ROOT** (name-collided with the parallel-authored `scripts/migrate_007_messages.sql`). A manual go-live migration pass globbing `scripts/migrate_*.sql` would have **skipped** them → prod missing the race-proof no-double-book EXCLUDE + money-invariant CHECKs. Moved via `git mv` into `scripts/` and renumbered to keep ascending apply order:
+- `migrate_007_double_book_exclude.sql` → `scripts/migrate_008_double_book_exclude.sql`
+- `migrate_008_integrity_guards.sql` → `scripts/migrate_009_integrity_guards.sql`
+
+Canonical apply order now: `004_marketplace → 005_apple → 006_contacts → 007_messages → 008_double_book_exclude → 009_integrity_guards`. Content byte-identical apart from a provenance header comment. Suite still 101/101.
+
+**Everything else remains Steve-credential-gated** (Tilopay CR-KYC strategic decision, Meta/Plaid keys, ASC-console Submit-for-Review, prod DB migration application). See `~/.claude/yolo-queue/pending-approval/costa-rica-golive.md` (refreshed).
diff --git a/migrate_007_double_book_exclude.sql b/scripts/migrate_008_double_book_exclude.sql
similarity index 84%
rename from migrate_007_double_book_exclude.sql
rename to scripts/migrate_008_double_book_exclude.sql
index fce1e56..39df80c 100644
--- a/migrate_007_double_book_exclude.sql
+++ b/scripts/migrate_008_double_book_exclude.sql
@@ -1,5 +1,7 @@
 -- TK-10346: race-proof no-double-book at the DB level (backstop to the app-level overlap guard).
 -- Two PARTIAL exclusion constraints so stay-bookings and slot-bookings each guard their own mode.
+-- (Originally committed as root-level "migration 007 double_book_exclude"; renumbered to 008 and
+--  moved into scripts/ so the manual go-live migration pass does not skip it. 007 is now messages.)
 BEGIN;
 CREATE EXTENSION IF NOT EXISTS btree_gist;
 
diff --git a/migrate_008_integrity_guards.sql b/scripts/migrate_009_integrity_guards.sql
similarity index 92%
rename from migrate_008_integrity_guards.sql
rename to scripts/migrate_009_integrity_guards.sql
index 471e340..7f879d0 100644
--- a/migrate_008_integrity_guards.sql
+++ b/scripts/migrate_009_integrity_guards.sql
@@ -1,5 +1,7 @@
 -- TK-10346: DB integrity guards (all pre-checked 0 violators, reversible). Money in minor units.
 -- Reconciliation model is total = platform_fee + host_payout (NOT subtotal+fees; fees is display-only).
+-- (Originally committed as root-level "migration 008 integrity_guards"; renumbered to 009 and moved
+--  into scripts/ so the manual go-live migration pass applies it in order after 008 double_book.)
 BEGIN;
 
 -- RANK 1 — bookings money invariants

← b0d524e TK-10346: hacienda-enricher opt-in HACIENDA_JURIDICA_ONLY fi  ·  back to Costa Rica  ·  costa-rica: add idempotent ordered migration runner scripts/ c25de8a →