[object Object]

← back to Gmc Titlefix

TK-10993: read-only US disapproval snapshot by issue code

9feab8116bca3d940d5e59471854f5324d521bb9 · 2026-09-04 09:18:54 -0700 · Steve

Measures Track F's effect. Full productstatuses sweep, counts US-servability
disapprovals per itemLevelIssue code, writes a timestamped JSON to the Track F
working dir. Read-only — GETs Merchant Center and writes nothing back.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DwqETbc3v7wsu6qNtfgkdx

Files touched

Diff

commit 9feab8116bca3d940d5e59471854f5324d521bb9
Author: Steve <steve@designerwallcoverings.com>
Date:   Fri Sep 4 09:18:54 2026 -0700

    TK-10993: read-only US disapproval snapshot by issue code
    
    Measures Track F's effect. Full productstatuses sweep, counts US-servability
    disapprovals per itemLevelIssue code, writes a timestamped JSON to the Track F
    working dir. Read-only — GETs Merchant Center and writes nothing back.
    
    Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01DwqETbc3v7wsu6qNtfgkdx
---
 tk10993-disapproval-snapshot.mjs | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/tk10993-disapproval-snapshot.mjs b/tk10993-disapproval-snapshot.mjs
new file mode 100644
index 0000000..01d7e0a
--- /dev/null
+++ b/tk10993-disapproval-snapshot.mjs
@@ -0,0 +1,30 @@
+// TK-10993 — READ-ONLY US disapproval snapshot by issue code, straight from productstatuses.
+// Used to measure Track F's effect. Writes nothing anywhere; only GETs Merchant Center.
+import { createRequire } from 'module'; import fs from 'fs';
+const require = createRequire('file:///Users/macstudio3/Projects/gmc-titlefix/');
+const { token, MERCHANT } = require('/Users/macstudio3/Projects/gmc-titlefix/_auth.js');
+const tok = await token(); const H = { Authorization: 'Bearer ' + tok };
+let page = '', scanned = 0, disapproved = 0;
+const byCode = new Map(), byCodeVendor = new Map();
+do {
+  const u = `https://shoppingcontent.googleapis.com/content/v2.1/${MERCHANT}/productstatuses?maxResults=250${page?`&pageToken=${page}`:''}`;
+  const r = await fetch(u, { headers: H, signal: AbortSignal.timeout(60000) });
+  const j = await r.json();
+  if (j.error) { console.error('ERR', j.error.code, j.error.message); break; }
+  for (const p of (j.resources || [])) {
+    scanned++;
+    const iss = (p.itemLevelIssues || []).filter(i => i.servability === 'disapproved' && (i.applicableCountries||[]).includes('US'));
+    if (!iss.length) continue;
+    disapproved++;
+    for (const i of new Map(iss.map(x=>[x.code,x])).values()) {
+      byCode.set(i.code, (byCode.get(i.code)||0)+1);
+    }
+  }
+  page = j.nextPageToken || '';
+  if (scanned % 15000 < 250) console.error(`  ...${scanned} scanned, ${disapproved} disapproved`);
+} while (page);
+const out = { snapshot_at:new Date().toISOString(), scanned, us_disapproved:disapproved,
+  us_disapproval_rate:+(100*disapproved/scanned).toFixed(2),
+  by_code: Object.fromEntries([...byCode.entries()].sort((a,b)=>b[1]-a[1])) };
+fs.writeFileSync(`/Users/macstudio3/.claude/yolo-queue/tk10993-trackF-exec/disapproval-snapshot-${Date.now()}.json`, JSON.stringify(out,null,1));
+console.log(JSON.stringify(out,null,2));

← a84ae54 TK-10993: gate the canary verdict on the config actually lan  ·  back to Gmc Titlefix  ·  TK-10993 Track G: read-only policy-disapproval enumerator 9b6af59 →