[object Object]

← back to Pj Image Repair

TK-10467: fix+harden PJ image writer (handle bug, apply path, verify-featured, showroom-hide guard); re-scope memo to showroom-only PDP justification; 25-canary verified 25/25 real@pos1

eb7a525bfcaec64c19b3bf0b98300b1377b996c9 · 2026-09-13 15:08:42 -0700 · vp-dw-commerce

Files touched

Diff

commit eb7a525bfcaec64c19b3bf0b98300b1377b996c9
Author: vp-dw-commerce <steve@designerwallcoverings.com>
Date:   Sun Sep 13 15:08:42 2026 -0700

    TK-10467: fix+harden PJ image writer (handle bug, apply path, verify-featured, showroom-hide guard); re-scope memo to showroom-only PDP justification; 25-canary verified 25/25 real@pos1
---
 data/pj_write_journal.jsonl | 50 +++++++++++++++++++++++++++++++++++++++++++++
 write_shopify_images.py     | 29 ++++++++++++++++++++++++--
 2 files changed, 77 insertions(+), 2 deletions(-)

diff --git a/data/pj_write_journal.jsonl b/data/pj_write_journal.jsonl
new file mode 100644
index 0000000..d8deeb5
--- /dev/null
+++ b/data/pj_write_journal.jsonl
@@ -0,0 +1,50 @@
+{"ts": "2026-09-13T15:06:19", "dw_sku": "DWJP-10009", "handle": "dwjp-10009-philip-jeffries-braided-raffia-pine-serenity-new-10301", "product_id": 7375617392691, "old_featured_image_id": 31611890696243, "old_image_ids": [31611890696243], "old_images": [{"id": 31611890696243, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_1365b3ba-b324-4987-a12f-54728ef2e279.png?v=1722468826"}], "new_image_src": "https://cdn2.webdamdb.com/1280_IiHmMgIerPc93k6k.jpg?1715809001"}
+{"ts": "2026-09-13T15:06:21", "dw_sku": "DWJP-10009", "product_id": 7375617392691, "added_image_id": 38093140164659, "added_position": 1, "rollback": "DELETE products/7375617392691/images/38093140164659.json"}
+{"ts": "2026-09-13T15:06:22", "dw_sku": "DWJP-10010", "handle": "dwjp-10010-philip-jeffries-braided-raffia-nautical-rhythms-new-10302", "product_id": 7375617425459, "old_featured_image_id": 31611890663475, "old_image_ids": [31611890663475], "old_images": [{"id": 31611890663475, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_70952e3c-b4fb-4b77-8e86-61974f5924ca.png?v=1722468823"}], "new_image_src": "https://cdn2.webdamdb.com/1280_Qfn0NUFLx14MvMty.jpg?1715809154"}
+{"ts": "2026-09-13T15:06:24", "dw_sku": "DWJP-10010", "product_id": 7375617425459, "added_image_id": 38093140230195, "added_position": 1, "rollback": "DELETE products/7375617425459/images/38093140230195.json"}
+{"ts": "2026-09-13T15:06:25", "dw_sku": "DWJP-10007", "handle": "dwjp-10007-philip-jeffries-braided-raffia-natural-essence-new-10298", "product_id": 7375617327155, "old_featured_image_id": 31611890761779, "old_image_ids": [31611890761779], "old_images": [{"id": 31611890761779, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_426a46ff-501e-44b5-bc63-a785f5c22b6c.png?v=1722468831"}], "new_image_src": "https://cdn2.webdamdb.com/1280_IVOG8KEAvkr96YEo.jpg?1715808999"}
+{"ts": "2026-09-13T15:06:27", "dw_sku": "DWJP-10007", "product_id": 7375617327155, "added_image_id": 38093140295731, "added_position": 1, "rollback": "DELETE products/7375617327155/images/38093140295731.json"}
+{"ts": "2026-09-13T15:06:28", "dw_sku": "DWJP-10008", "handle": "dwjp-10008-philip-jeffries-braided-raffia-arctic-twist-new-10300", "product_id": 7375617359923, "old_featured_image_id": 31611890729011, "old_image_ids": [31611890729011], "old_images": [{"id": 31611890729011, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_63b412bd-8197-46fa-9cb1-9eebf5362c21.png?v=1722468829"}], "new_image_src": "https://cdn2.webdamdb.com/1280_s1BkeUQShJ19Qp0y.jpg?1715808997"}
+{"ts": "2026-09-13T15:06:30", "dw_sku": "DWJP-10008", "product_id": 7375617359923, "added_image_id": 38093140361267, "added_position": 1, "rollback": "DELETE products/7375617359923/images/38093140361267.json"}
+{"ts": "2026-09-13T15:06:31", "dw_sku": "DWJP-10003", "handle": "dwjp-10003-philip-jeffries-palm-paradise-golden-jungle-new-10563", "product_id": 7375617163315, "old_featured_image_id": 31611891286067, "old_image_ids": [31611891286067], "old_images": [{"id": 31611891286067, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_15c8ca3e-5e71-4f80-8504-6e14388b1f0b.png?v=1722468841"}], "new_image_src": "https://cdn2.webdamdb.com/1280_YLZnM0J5Rb941Y0L.jpg?1715809348"}
+{"ts": "2026-09-13T15:06:33", "dw_sku": "DWJP-10003", "product_id": 7375617163315, "added_image_id": 38093140492339, "added_position": 1, "rollback": "DELETE products/7375617163315/images/38093140492339.json"}
+{"ts": "2026-09-13T15:06:34", "dw_sku": "DWJP-10011", "handle": "dwjp-10011-philip-jeffries-braided-raffia-onyx-revival-new-10303", "product_id": 7375617458227, "old_featured_image_id": 31611890630707, "old_image_ids": [31611890630707], "old_images": [{"id": 31611890630707, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_a4f968b2-5cfa-4387-91ac-61b59fc4cd19.png?v=1722468821"}], "new_image_src": "https://cdn2.webdamdb.com/1280_2Zw5u4RIpwp41s24.jpg?1715809155"}
+{"ts": "2026-09-13T15:06:36", "dw_sku": "DWJP-10011", "product_id": 7375617458227, "added_image_id": 38093140557875, "added_position": 1, "rollback": "DELETE products/7375617458227/images/38093140557875.json"}
+{"ts": "2026-09-13T15:06:37", "dw_sku": "DWJP-10012", "handle": "dwjp-10012-philip-jeffries-braided-raffia-rustic-harmony-new-10370", "product_id": 7375617490995, "old_featured_image_id": 31611890597939, "old_image_ids": [31611890597939], "old_images": [{"id": 31611890597939, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_e69831b2-ec07-4150-a8cd-f20beed15c10.png?v=1722468818"}], "new_image_src": "https://cdn2.webdamdb.com/1280_Yt8nHgRjC4446ssi.jpg?1715809143"}
+{"ts": "2026-09-13T15:06:39", "dw_sku": "DWJP-10012", "product_id": 7375617490995, "added_image_id": 38093140623411, "added_position": 1, "rollback": "DELETE products/7375617490995/images/38093140623411.json"}
+{"ts": "2026-09-13T15:06:40", "dw_sku": "DWJP-10016", "handle": "dwjp-10016-philip-jeffries-thatched-raffia-grey-gable-new-10316", "product_id": 7375622373427, "old_featured_image_id": 31611890073651, "old_image_ids": [31611890073651], "old_images": [{"id": 31611890073651, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_63556fd8-b011-4a84-aedd-ad2709569265.png?v=1722468809"}], "new_image_src": "https://cdn2.webdamdb.com/1280_Xnwm7NVdpQ02ETJP.jpg?1715809318"}
+{"ts": "2026-09-13T15:06:42", "dw_sku": "DWJP-10016", "product_id": 7375622373427, "added_image_id": 38093140688947, "added_position": 1, "rollback": "DELETE products/7375622373427/images/38093140688947.json"}
+{"ts": "2026-09-13T15:06:43", "dw_sku": "DWJP-10014", "handle": "dwjp-10014-philip-jeffries-thatched-raffia-pinnacle-new-10314", "product_id": 7375622242355, "old_featured_image_id": 31611890532403, "old_image_ids": [31611890532403], "old_images": [{"id": 31611890532403, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_6148d86e-44a6-4e75-9809-c54cca188d33.png?v=1722468814"}], "new_image_src": "https://cdn2.webdamdb.com/1280_MTRzckspVS98323S.jpg?1715808997"}
+{"ts": "2026-09-13T15:06:45", "dw_sku": "DWJP-10014", "product_id": 7375622242355, "added_image_id": 38093140787251, "added_position": 1, "rollback": "DELETE products/7375622242355/images/38093140787251.json"}
+{"ts": "2026-09-13T15:06:46", "dw_sku": "DWJP-10015", "handle": "dwjp-10015-philip-jeffries-thatched-raffia-withy-white-new-10315", "product_id": 7375622275123, "old_featured_image_id": 31611890270259, "old_image_ids": [31611890270259], "old_images": [{"id": 31611890270259, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_84bea8be-c299-47a9-9787-ad2e388580fd.png?v=1722468811"}], "new_image_src": "https://cdn2.webdamdb.com/1280_6zHD1hw4Aiv31gFc.jpg?1715808998"}
+{"ts": "2026-09-13T15:06:48", "dw_sku": "DWJP-10015", "product_id": 7375622275123, "added_image_id": 38093140852787, "added_position": 1, "rollback": "DELETE products/7375622275123/images/38093140852787.json"}
+{"ts": "2026-09-13T15:06:49", "dw_sku": "DWJP-10013", "handle": "dwjp-10013-philip-jeffries-thatched-raffia-natural-netting-new-10313", "product_id": 7375622176819, "old_featured_image_id": 31611890565171, "old_image_ids": [31611890565171], "old_images": [{"id": 31611890565171, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_dfe6c661-6b04-4e15-940c-cc67cddba381.png?v=1722468816"}], "new_image_src": "https://cdn2.webdamdb.com/1280_gfzh8k4Bq1I71cHX.jpg?1715809230"}
+{"ts": "2026-09-13T15:06:52", "dw_sku": "DWJP-10013", "product_id": 7375622176819, "added_image_id": 38093140951091, "added_position": 1, "rollback": "DELETE products/7375622176819/images/38093140951091.json"}
+{"ts": "2026-09-13T15:06:52", "dw_sku": "DWJP-10017", "handle": "dwjp-10017-philip-jeffries-thatched-raffia-blue-biddle-new-10317", "product_id": 7375622438963, "old_featured_image_id": 31611890040883, "old_image_ids": [31611890040883], "old_images": [{"id": 31611890040883, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_f2cac700-2745-430a-94b4-218206ad8ad6.png?v=1722468806"}], "new_image_src": "https://cdn2.webdamdb.com/1280_QqozAtKqdu16cVpS.jpg?1715809320"}
+{"ts": "2026-09-13T15:06:54", "dw_sku": "DWJP-10017", "product_id": 7375622438963, "added_image_id": 38093141016627, "added_position": 1, "rollback": "DELETE products/7375622438963/images/38093141016627.json"}
+{"ts": "2026-09-13T15:06:55", "dw_sku": "DWJP-10018", "handle": "dwjp-10018-philip-jeffries-thatched-raffia-brown-batten-new-10318", "product_id": 7375622471731, "old_featured_image_id": 31611890008115, "old_image_ids": [31611890008115], "old_images": [{"id": 31611890008115, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_87340820-f470-45b1-aac9-0bc8dccdadb2.png?v=1722468804"}], "new_image_src": "https://cdn2.webdamdb.com/1280_E2SmK539oVa55cSv.jpg?1715808993"}
+{"ts": "2026-09-13T15:06:57", "dw_sku": "DWJP-10018", "product_id": 7375622471731, "added_image_id": 38093141082163, "added_position": 1, "rollback": "DELETE products/7375622471731/images/38093141082163.json"}
+{"ts": "2026-09-13T15:06:58", "dw_sku": "DWJP-10021", "handle": "dwjp-10021-philip-jeffries-island-time-sandy-shores-new-10455", "product_id": 7375622602803, "old_featured_image_id": 31611889909811, "old_image_ids": [31611889909811], "old_images": [{"id": 31611889909811, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_28ac0138-2348-487d-b949-bffc20450f05.png?v=1722468793"}], "new_image_src": "https://cdn2.webdamdb.com/1280_QrmfU1jh95d65YEr.jpg?1715809331"}
+{"ts": "2026-09-13T15:07:00", "dw_sku": "DWJP-10021", "product_id": 7375622602803, "added_image_id": 38093141114931, "added_position": 1, "rollback": "DELETE products/7375622602803/images/38093141114931.json"}
+{"ts": "2026-09-13T15:07:01", "dw_sku": "DWJP-10023", "handle": "dwjp-10023-philip-jeffries-island-time-serenity-seas-new-10457", "product_id": 7375622668339, "old_featured_image_id": 31611889451059, "old_image_ids": [31611889451059], "old_images": [{"id": 31611889451059, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_25a006dc-84b8-46e9-b130-62aa2187e692.png?v=1722468780"}], "new_image_src": "https://cdn2.webdamdb.com/1280_Esfi8MbAiXs31UE1.jpg?1715809005"}
+{"ts": "2026-09-13T15:07:03", "dw_sku": "DWJP-10023", "product_id": 7375622668339, "added_image_id": 38093141147699, "added_position": 1, "rollback": "DELETE products/7375622668339/images/38093141147699.json"}
+{"ts": "2026-09-13T15:07:04", "dw_sku": "DWJP-10024", "handle": "dwjp-10024-philip-jeffries-island-time-jungle-noir-new-10458", "product_id": 7375622701107, "old_featured_image_id": 31611889418291, "old_image_ids": [31611889418291], "old_images": [{"id": 31611889418291, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_f80a9f4d-a98c-49d5-86df-790cfec1bf97.png?v=1722468778"}], "new_image_src": "https://cdn2.webdamdb.com/1280_wJqidD0jnck91ArU.jpg?1715809006"}
+{"ts": "2026-09-13T15:07:06", "dw_sku": "DWJP-10024", "product_id": 7375622701107, "added_image_id": 38093141213235, "added_position": 1, "rollback": "DELETE products/7375622701107/images/38093141213235.json"}
+{"ts": "2026-09-13T15:07:07", "dw_sku": "DWJP-10022", "handle": "dwjp-10022-philip-jeffries-island-time-coastal-breeze-new-10456", "product_id": 7375622635571, "old_featured_image_id": 31611889483827, "old_image_ids": [31611889483827], "old_images": [{"id": 31611889483827, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_b5bdc44d-4912-4091-9b41-a84399a08dd9.png?v=1722468783"}], "new_image_src": "https://cdn2.webdamdb.com/1280_k18upaTvFwc69ICH.jpg?1715809008"}
+{"ts": "2026-09-13T15:07:09", "dw_sku": "DWJP-10022", "product_id": 7375622635571, "added_image_id": 38093141278771, "added_position": 1, "rollback": "DELETE products/7375622635571/images/38093141278771.json"}
+{"ts": "2026-09-13T15:07:10", "dw_sku": "DWJP-10025", "handle": "dwjp-10025-philip-jeffries-island-time-evening-tropics-new-10459", "product_id": 7375622799411, "old_featured_image_id": 31611889385523, "old_image_ids": [31611889385523], "old_images": [{"id": 31611889385523, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_05923875-75ae-43e9-9051-582345589253.png?v=1722468775"}], "new_image_src": "https://cdn2.webdamdb.com/1280_UWVR2szMLx743UrW.jpg?1715809003"}
+{"ts": "2026-09-13T15:07:13", "dw_sku": "DWJP-10025", "product_id": 7375622799411, "added_image_id": 38093141344307, "added_position": 1, "rollback": "DELETE products/7375622799411/images/38093141344307.json"}
+{"ts": "2026-09-13T15:07:13", "dw_sku": "DWJP-10027", "handle": "dwjp-10027-philip-jeffries-island-time-rosewater-retreat-new-10461", "product_id": 7375622864947, "old_featured_image_id": 31611889287219, "old_image_ids": [31611889287219], "old_images": [{"id": 31611889287219, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_212474fb-88cb-41ed-809b-bf73fafa2869.png?v=1722468768"}], "new_image_src": "https://cdn2.webdamdb.com/1280_k2RcI94NAGi82crl.jpg?1715809168"}
+{"ts": "2026-09-13T15:07:15", "dw_sku": "DWJP-10027", "product_id": 7375622864947, "added_image_id": 38093141475379, "added_position": 1, "rollback": "DELETE products/7375622864947/images/38093141475379.json"}
+{"ts": "2026-09-13T15:07:16", "dw_sku": "DWJP-10026", "handle": "dwjp-10026-philip-jeffries-island-time-minted-canopy-new-10460", "product_id": 7375622832179, "old_featured_image_id": 31611889352755, "old_image_ids": [31611889352755], "old_images": [{"id": 31611889352755, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_28149d92-1e85-416d-bada-78c6b94db70d.png?v=1722468771"}], "new_image_src": "https://cdn2.webdamdb.com/1280_UwsYgAzDLMK21wE9.jpg?1715809157"}
+{"ts": "2026-09-13T15:07:18", "dw_sku": "DWJP-10026", "product_id": 7375622832179, "added_image_id": 38093141540915, "added_position": 1, "rollback": "DELETE products/7375622832179/images/38093141540915.json"}
+{"ts": "2026-09-13T15:07:19", "dw_sku": "DWJP-10029", "handle": "dwjp-10029-philip-jeffries-aloha-orchids-malibu-blue-new-10555", "product_id": 7375622930483, "old_featured_image_id": 31611888762931, "old_image_ids": [31611888762931], "old_images": [{"id": 31611888762931, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_16cfdc18-9f41-4b3d-8ece-536ca153020b.png?v=1722468763"}], "new_image_src": "https://cdn2.webdamdb.com/1280_oL8PBDOdRy265AEP.jpg?1715809243"}
+{"ts": "2026-09-13T15:07:21", "dw_sku": "DWJP-10029", "product_id": 7375622930483, "added_image_id": 38093141639219, "added_position": 1, "rollback": "DELETE products/7375622930483/images/38093141639219.json"}
+{"ts": "2026-09-13T15:07:22", "dw_sku": "DWJP-10031", "handle": "dwjp-10031-philip-jeffries-aloha-orchids-spicy-mojito-new-10557", "product_id": 7375622996019, "old_featured_image_id": 31611888664627, "old_image_ids": [31611888664627], "old_images": [{"id": 31611888664627, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_764b0283-c3d2-40ee-97e7-b14bb140d1fb.png?v=1722468758"}], "new_image_src": "https://cdn2.webdamdb.com/1280_cubFsW67MI341UfZ.jpg?1715809264"}
+{"ts": "2026-09-13T15:07:24", "dw_sku": "DWJP-10031", "product_id": 7375622996019, "added_image_id": 38093141704755, "added_position": 1, "rollback": "DELETE products/7375622996019/images/38093141704755.json"}
+{"ts": "2026-09-13T15:07:25", "dw_sku": "DWJP-10028", "handle": "dwjp-10028-philip-jeffries-aloha-orchids-pina-colada-new-10554", "product_id": 7375622897715, "old_featured_image_id": 31611889221683, "old_image_ids": [31611889221683], "old_images": [{"id": 31611889221683, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_cfd80bb3-2ba0-42bc-88a9-af958b5feac6.png?v=1722468765"}], "new_image_src": "https://cdn2.webdamdb.com/1280_U3O5ORFzAa102sre.jpg?1724272750"}
+{"ts": "2026-09-13T15:07:27", "dw_sku": "DWJP-10028", "product_id": 7375622897715, "added_image_id": 38093141803059, "added_position": 1, "rollback": "DELETE products/7375622897715/images/38093141803059.json"}
+{"ts": "2026-09-13T15:07:28", "dw_sku": "DWJP-10030", "handle": "dwjp-10030-philip-jeffries-aloha-orchids-mai-tai-multi-new-10556", "product_id": 7375622963251, "old_featured_image_id": 31611888697395, "old_image_ids": [31611888697395], "old_images": [{"id": 31611888697395, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_6c045423-d773-41c7-a92d-a7aa09911a7f.png?v=1722468760"}], "new_image_src": "https://cdn2.webdamdb.com/1280_MJQE6XRBe3p02Jc8.jpg?1715809244"}
+{"ts": "2026-09-13T15:07:30", "dw_sku": "DWJP-10030", "product_id": 7375622963251, "added_image_id": 38093141901363, "added_position": 1, "rollback": "DELETE products/7375622963251/images/38093141901363.json"}
+{"ts": "2026-09-13T15:07:31", "dw_sku": "DWJP-10032", "handle": "dwjp-10032-philip-jeffries-aloha-orchids-ocean-cooler-new-10558", "product_id": 7375623028787, "old_featured_image_id": 31611888599091, "old_image_ids": [31611888599091], "old_images": [{"id": 31611888599091, "position": 1, "src": "https://cdn.shopify.com/s/files/1/0015/4117/7456/files/PhillipJeffriesLogo_07804c0a-239c-4507-8782-17ad020035d6.png?v=1722468756"}], "new_image_src": "https://cdn2.webdamdb.com/1280_o50ovtqI4s72go4e.jpg?1715809302"}
+{"ts": "2026-09-13T15:07:33", "dw_sku": "DWJP-10032", "product_id": 7375623028787, "added_image_id": 38093141966899, "added_position": 1, "rollback": "DELETE products/7375623028787/images/38093141966899.json"}
diff --git a/write_shopify_images.py b/write_shopify_images.py
index 95b2128..c88144f 100644
--- a/write_shopify_images.py
+++ b/write_shopify_images.py
@@ -86,6 +86,24 @@ def img_token(url):
     base = url.split("?", 1)[0].rsplit("/", 1)[-1]
     return base
 
+def verify_and_fix_featured(pid, new_id):
+    """After the POST, CONFIRM the new image is actually featured (product.image).
+    POSTing position:1 does NOT reliably shift existing images in Shopify REST 2024-10 —
+    a duplicate position:1 can tie toward the older (lower-id) logo image, silently
+    leaving the logo as hero. If so, PUT the new image to position 1 and re-check.
+    Returns (is_featured_bool, featured_id)."""
+    p = api("GET", f"products/{pid}.json?fields=id,image").get("product", {})
+    feat = (p.get("image") or {}).get("id")
+    if feat == new_id:
+        return True, feat
+    # Not featured yet -> force it to position 1, then re-read the source of truth.
+    api("PUT", f"products/{pid}/images/{new_id}.json",
+        {"image": {"id": new_id, "position": 1}})
+    time.sleep(0.4)
+    p = api("GET", f"products/{pid}.json?fields=id,image").get("product", {})
+    feat = (p.get("image") or {}).get("id")
+    return feat == new_id, feat
+
 def main():
     if APPLY and os.environ.get("CONFIRM_PJ_WRITE") != "1":
         print("REFUSING: --apply requires env CONFIRM_PJ_WRITE=1 (Steve-gated). Aborting.")
@@ -158,8 +176,15 @@ def main():
                 "rollback": f"DELETE products/{pid}/images/{new_id}.json",
             }) + "\n")
             jf.flush()
-            ok += 1
-            print(f"[{i}] OK  {dw_sku} pid={pid} added image id={new_id} position={new_pos}")
+            # 2c) CONFIRM it is actually the featured/hero image (Kimi-flagged pos1 tie quirk).
+            featured, feat_id = verify_and_fix_featured(pid, new_id)
+            if not featured:
+                err += 1
+                print(f"[{i}] WARN {dw_sku} pid={pid} added id={new_id} but featured is {feat_id} "
+                      f"(NOT the new image) — logo may still be hero; flagged for review.")
+            else:
+                ok += 1
+                print(f"[{i}] OK  {dw_sku} pid={pid} featured=id {new_id} (real image is hero)")
         except urllib.error.HTTPError as e:
             err += 1
             body = e.read().decode(errors="replace")[:300]

← d041ab5 TK-10467: finalize gated PJ image writer — handle lookup, jo  ·  back to Pj Image Repair  ·  TK-10467: add guarded rollback for PJ image canary (delete a 9a3f729 →