← back to Designer Wallcoverings
catalog-push: HARDEN sync bucket to missing/empty tables ONLY — never --clean an existing populated table (that doubled wolf_gordon 5469→10952 when a dependency blocked its DROP and mac3's rows appended). Existing-with-data divergence in either direction → REVIEW only.
3252281c1a558d400b44d485e4c278ddb58acb6e · 2026-07-09 23:24:58 -0700 · steve@designerwallcoverings.com
Files touched
M shopify/scripts/catalog-push-to-kamatera.sh
Diff
commit 3252281c1a558d400b44d485e4c278ddb58acb6e
Author: steve@designerwallcoverings.com <steve@designerwallcoverings.com>
Date: Thu Jul 9 23:24:58 2026 -0700
catalog-push: HARDEN sync bucket to missing/empty tables ONLY — never --clean an existing populated table (that doubled wolf_gordon 5469→10952 when a dependency blocked its DROP and mac3's rows appended). Existing-with-data divergence in either direction → REVIEW only.
---
shopify/scripts/catalog-push-to-kamatera.sh | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/shopify/scripts/catalog-push-to-kamatera.sh b/shopify/scripts/catalog-push-to-kamatera.sh
index b7406c50..94c2e184 100755
--- a/shopify/scripts/catalog-push-to-kamatera.sh
+++ b/shopify/scripts/catalog-push-to-kamatera.sh
@@ -64,23 +64,26 @@ psql "$MAC3" -f /tmp/catalog-counts.sql 2>&1 | grep -E 'NOTICE:.*\|' | sed -E 's
ssh my-server "psql '$KAM' -f -" < /tmp/catalog-counts.sql 2>&1 | grep -E 'NOTICE:.*\|' | sed -E 's/^.*NOTICE: //' | sort > /tmp/kam_counts.txt
log "mac3 catalog tables: $(grep -c '|' /tmp/mac3_counts.txt), Kamatera: $(grep -c '|' /tmp/kam_counts.txt)"
-# Classify divergent tables into two buckets (SAFETY: mac3 is NOT cleanly authoritative for
-# every table — e.g. Kamatera can hold a fuller kravet_catalog than mac3):
-# SYNC — missing on Kamatera, OR mac3 has MORE rows (mac3 fuller → propagate, gains rows)
-# REVIEW — Kamatera has MORE rows than mac3 (syncing would DELETE) → flag for Steve, NEVER auto-overwrite
+# Classify divergent tables into two buckets. SAFETY RULE (hardened 2026-07-09 after a
+# --clean on an EXISTING populated table doubled wolf_gordon_catalog): only ever CREATE a
+# missing table or FILL an empty one. NEVER --clean an existing populated table — its DROP
+# can be blocked by a dependency (leaving INSERTs to append/duplicate) and its source may be
+# dirty. Any existing-with-data divergence (either direction) → REVIEW for Steve, never auto-touched.
+# SYNC — table MISSING on Kamatera, OR present-but-EMPTY (kam count = 0)
+# REVIEW — table exists WITH DATA and counts differ (mac3-fuller OR Kamatera-fuller) → flag only
rm -f /tmp/catalog-sync.txt /tmp/catalog-review.txt
awk -F'|' -v S=/tmp/catalog-sync.txt -v R=/tmp/catalog-review.txt '
NR==FNR{k[$1]=$2; seen[$1]=1; next}
- { if(!($1 in seen)) { print $1 > S } # missing on Kamatera
- else if($2+0 > k[$1]+0) { print $1 > S } # mac3 fuller
- else if(k[$1]+0 > $2+0) { print $1" (mac3="$2" < kam="k[$1]")" > R } } # Kamatera fuller — review
+ { if(!($1 in seen)) { print $1 > S } # missing → create (safe)
+ else if(k[$1]+0 == 0) { print $1 > S } # exists but empty → fill (safe)
+ else if($2+0 != k[$1]+0) { print $1" (mac3="$2" vs kam="k[$1]")" > R } } # exists w/ data + differs → REVIEW
' /tmp/kam_counts.txt /tmp/mac3_counts.txt
touch /tmp/catalog-sync.txt /tmp/catalog-review.txt
NCOUNT=$(grep -c . /tmp/catalog-sync.txt || true)
RCOUNT=$(grep -c . /tmp/catalog-review.txt || true)
-log "tables to sync (mac3-fuller/missing): $NCOUNT | flagged for review (Kamatera-fuller): $RCOUNT"
+log "tables to sync (missing/empty on Kamatera): $NCOUNT | flagged for review (exists w/ data, differs): $RCOUNT"
[ "$NCOUNT" -gt 0 ] && sed 's/^/ → sync /' /tmp/catalog-sync.txt | tee -a "$LOG"
-[ "$RCOUNT" -gt 0 ] && { log " ⚠ REVIEW (NOT synced — Kamatera has more rows; Steve decides authority):"; sed 's/^/ ⚠ /' /tmp/catalog-review.txt | tee -a "$LOG"; }
+[ "$RCOUNT" -gt 0 ] && { log " ⚠ REVIEW (NOT synced — existing populated table; never auto-overwritten):"; sed 's/^/ ⚠ /' /tmp/catalog-review.txt | tee -a "$LOG"; }
cp /tmp/catalog-sync.txt /tmp/catalog-need.txt
if [ "$NCOUNT" -eq 0 ]; then log "nothing safe to sync"; log "==== $(date '+%F %T') DONE ===="; exit 0; fi
← 9aa0dfb9 auto-save: 2026-07-09T23:12:38 (10 files) — pending-approval
·
back to Designer Wallcoverings
·
WallQuest onboard: gated Phillipe Romano draft-push (per-yar d4b939ce →