← back to Reid Witlin Onboarding
rename.py: also strip 'Reid Witlin' PL-leak tag (5 products) during unification
b05424c8af8b3571f7950aae9855b6475dbeaaeb · 2026-07-30 15:27:37 -0700 · Steve
Files touched
M rename-results.jsonM rename.py
Diff
commit b05424c8af8b3571f7950aae9855b6475dbeaaeb
Author: Steve <steve@designerwallcoverings.com>
Date: Thu Jul 30 15:27:37 2026 -0700
rename.py: also strip 'Reid Witlin' PL-leak tag (5 products) during unification
---
rename-results.json | 1 +
rename.py | 30 +++++++++++++++++++++++-------
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/rename-results.json b/rename-results.json
index 0388a0a..35a605a 100644
--- a/rename-results.json
+++ b/rename-results.json
@@ -2,6 +2,7 @@
"products": 312,
"variants": 312,
"renamed": 312,
+ "reid_witlin_tag_stripped": 0,
"errors": [],
"remap_sample": [
{
diff --git a/rename.py b/rename.py
index 23bd13d..22bfa0e 100644
--- a/rename.py
+++ b/rename.py
@@ -47,12 +47,20 @@ FIND = """
query($q:String!,$c:String){
products(first:50, query:$q, after:$c){
pageInfo{hasNextPage endCursor}
- edges{node{ id title status
+ edges{node{ id title status tags
variants(first:20){edges{node{ id sku }}}
}}
}
}"""
+# PL-name-leaking tags to strip during the rename (Steve: yes, strip it)
+LEAK_TAGS = ["Reid Witlin"]
+
+TAGS_REMOVE = """
+mutation($id:ID!,$tags:[String!]!){
+ tagsRemove(id:$id, tags:$tags){ userErrors{ message } }
+}"""
+
UPDATE = """
mutation($pid:ID!,$variants:[ProductVariantsBulkInput!]!){
productVariantsBulkUpdate(productId:$pid, variants:$variants){
@@ -84,7 +92,9 @@ def main():
if (v["node"]["sku"] or "").startswith("DWRW-210")]
if vs:
seen.add(n["id"])
- targets.append({"pid": n["id"], "title": n["title"], "status": n["status"], "variants": vs})
+ leaks = [t for t in (n.get("tags") or []) if t in LEAK_TAGS]
+ targets.append({"pid": n["id"], "title": n["title"], "status": n["status"],
+ "variants": vs, "leak_tags": leaks})
if p["pageInfo"]["hasNextPage"]:
cur = p["pageInfo"]["endCursor"]
else:
@@ -92,18 +102,20 @@ def main():
if LIMIT:
targets = targets[:LIMIT]
n_var = sum(len(t["variants"]) for t in targets)
+ n_leak = sum(1 for t in targets if t["leak_tags"])
print(f"{'DRY-RUN' if DRY_RUN else 'LIVE'}: {len(targets)} products / {n_var} variants "
- f"DWRW-210xxx -> DWDQ-210xxx")
+ f"DWRW-210xxx -> DWDQ-210xxx | strip 'Reid Witlin' tag on {n_leak}")
- done, errs, remap = 0, [], []
+ done, errs, remap, stripped = 0, [], [], 0
for i, t in enumerate(targets):
updates = [{"id": vid, "inventoryItem": {"sku": new_sku(old)}} for vid, old in t["variants"]]
for vid, old in t["variants"]:
remap.append({"old": old, "new": new_sku(old)})
if DRY_RUN:
- if i < 4:
+ if i < 4 or t["leak_tags"]:
+ extra = f" [+strip {t['leak_tags']}]" if t["leak_tags"] else ""
print(f" would rename [{t['status']}] {t['title'][:30]!r}: "
- + ", ".join(f"{o}->{new_sku(o)}" for _, o in t["variants"]))
+ + ", ".join(f"{o}->{new_sku(o)}" for _, o in t["variants"]) + extra)
done += 1
continue
d = gql(UPDATE, {"pid": t["pid"], "variants": updates})
@@ -113,6 +125,10 @@ def main():
errs.append({"title": t["title"], "errors": ue[:2]})
else:
done += 1
+ # strip PL-name-leaking tag(s) where present (idempotent)
+ if t["leak_tags"]:
+ gql(TAGS_REMOVE, {"id": t["pid"], "tags": t["leak_tags"]})
+ stripped += 1
if i % 25 == 0:
print(f" ...{i}/{len(targets)} done={done} errs={len(errs)}")
time.sleep(0.3)
@@ -125,7 +141,7 @@ def main():
f"WHERE {col} LIKE 'DWRW-210%';"], capture_output=True, text=True)
out = {"products": len(targets), "variants": n_var, "renamed": done,
- "errors": errs[:20], "remap_sample": remap[:6]}
+ "reid_witlin_tag_stripped": stripped, "errors": errs[:20], "remap_sample": remap[:6]}
json.dump(out, open(os.path.join(HERE, "rename-results.json"), "w"), indent=2)
print(f"\nDONE. products={done} userErrors={len(errs)} "
f"({'DRY-RUN — nothing written' if DRY_RUN else 'live SKUs renamed + mirror synced'})")
← 3736261 Add gated rename.py: unify existing 312 live Reid Witlin DWR
·
back to Reid Witlin Onboarding
·
recover_held.py: vendor-JS image recovery — 167 held -> 19 ( 888650d →