Debug platform image matching — log keys and item names for mismatch diagnosis

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-15 00:55:14 -07:00
parent 092d04291e
commit f10ebb8ba6

View file

@ -1726,9 +1726,12 @@
body: JSON.stringify({ mode: 'platform_images', url: platformUrl, items: allItems.map(i => i.name) }) body: JSON.stringify({ mode: 'platform_images', url: platformUrl, items: allItems.map(i => i.name) })
}); });
const imgResult = await imgResp.json(); const imgResult = await imgResp.json();
console.log('Platform images raw response:', imgResult);
if (imgResult.OK && imgResult.imageMap) { if (imgResult.OK && imgResult.imageMap) {
platformImageMap = imgResult.imageMap; platformImageMap = imgResult.imageMap;
const matchCount = Object.keys(platformImageMap).length; const matchCount = Object.keys(platformImageMap).length;
console.log('Image map keys (first 10):', Object.keys(platformImageMap).slice(0, 10));
console.log('Item names (first 10):', allItems.slice(0, 10).map(i => i.name));
// Match images to items by name // Match images to items by name
let matched = 0; let matched = 0;
allItems.forEach(item => { allItems.forEach(item => {
@ -1738,6 +1741,12 @@
} }
}); });
console.log(`Platform images: ${matchCount} found, ${matched} matched to items`); console.log(`Platform images: ${matchCount} found, ${matched} matched to items`);
if (matchCount > 0 && matched === 0) {
console.log('MISMATCH DEBUG — first imageMap key:', JSON.stringify(Object.keys(platformImageMap)[0]));
console.log('MISMATCH DEBUG — first item name:', JSON.stringify(allItems[0]?.name));
}
} else {
console.log('Platform images: no imageMap in response', imgResult);
} }
} catch (err) { } catch (err) {
console.error('Platform image fetch error:', err); console.error('Platform image fetch error:', err);