[object Object]

← back to Pj Image Repair

TK-10467: writer gains PJ_MAP env override + --offset for bounded tranches (no behavior change to apply path)

5cd75f3966fd12ca22f300f3c303a5726a354bff · 2026-09-23 12:26:48 -0700 · Steve Abrams

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kz1ChQnvt8yT49gFsBYHVZ

Files touched

Diff

commit 5cd75f3966fd12ca22f300f3c303a5726a354bff
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Sep 23 12:26:48 2026 -0700

    TK-10467: writer gains PJ_MAP env override + --offset for bounded tranches (no behavior change to apply path)
    
    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01Kz1ChQnvt8yT49gFsBYHVZ
---
 write_shopify_images.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/write_shopify_images.py b/write_shopify_images.py
index c88144f..b6c0b9f 100644
--- a/write_shopify_images.py
+++ b/write_shopify_images.py
@@ -19,15 +19,17 @@ Writes rollback journal: data/pj_write_journal.jsonl (old image ids + featured i
 import csv, os, sys, json, time, re, urllib.request, urllib.error
 
 HERE = os.path.dirname(os.path.abspath(__file__))
-MAP  = os.path.join(HERE, "data", "pj_writable.tsv")
+MAP  = os.environ.get("PJ_MAP") or os.path.join(HERE, "data", "pj_writable.tsv")
 JRN  = os.path.join(HERE, "data", "pj_write_journal.jsonl")
 SHOP = "designer-laboratory-sandbox.myshopify.com"
 API  = "2024-10"
 APPLY = "--apply" in sys.argv
 ALLOW_UNHIDDEN = "--allow-unhidden" in sys.argv
 LIMIT = None
+OFFSET = 0
 for a in sys.argv:
     if a.startswith("--limit="): LIMIT = int(a.split("=")[1])
+    if a.startswith("--offset="): OFFSET = int(a.split("=")[1])
 
 # Showroom-only guard (TK-11089 / TK-11193). PJ is showroom-only; the storefront hide asset
 # dw-pj-hide.js hides any PJ Boost product-item whose IMAGE SRC, HANDLE, or CARD TEXT matches
@@ -112,9 +114,10 @@ def main():
         print("REFUSING: --remove-logo is not authorized for this run. Aborting.")
         sys.exit(2)
     rows = list(csv.DictReader(open(MAP), delimiter="\t"))
+    rows = rows[OFFSET:]
     if LIMIT:
         rows = rows[:LIMIT]
-    print(f"mode={'APPLY' if APPLY else 'DRY-RUN'} rows={len(rows)} store={SHOP} api={API}")
+    print(f"mode={'APPLY' if APPLY else 'DRY-RUN'} map={os.path.basename(MAP)} offset={OFFSET} rows={len(rows)} store={SHOP} api={API}")
     jf = open(JRN, "a") if APPLY else None
     ok = err = skipped = 0
     for i, r in enumerate(rows, 1):

← 2f8529e TK-10467: resolve Tier-2 cohort (194 handle-marked logo-hero  ·  back to Pj Image Repair  ·  TK-10467: bounded tranche driver (<=460/tranche, public-samp e60cec4 →