[object Object]

← back to Sample Followup Sweep

sample-followup: fix tk12118 SKU guard to verify on REPORT ON SAMPLES ORDERED (TK-12118)

8c3b575d84856c22a1419f1428bb56840961fefa · 2026-09-24 08:29:04 -0700 · Steve Abrams

'combo sku' is findable but does not serialize into fieldData on the write layout
(Report for old memo samples), so the SKU-match guard always saw "" and skipped.
Verify the SKU on REPORT ON SAMPLES ORDERED (same base table, same recordId space,
field reads correctly); write vid on the write layout; verify the write via the
canary leaked-count (vid does not read back on either layout). Backfill landed:
canary leaked 4->1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 8c3b575d84856c22a1419f1428bb56840961fefa
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Sep 24 08:29:04 2026 -0700

    sample-followup: fix tk12118 SKU guard to verify on REPORT ON SAMPLES ORDERED (TK-12118)
    
    'combo sku' is findable but does not serialize into fieldData on the write layout
    (Report for old memo samples), so the SKU-match guard always saw "" and skipped.
    Verify the SKU on REPORT ON SAMPLES ORDERED (same base table, same recordId space,
    field reads correctly); write vid on the write layout; verify the write via the
    canary leaked-count (vid does not read back on either layout). Backfill landed:
    canary leaked 4->1.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 scripts/tk12118-vid-backfill.mjs | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/scripts/tk12118-vid-backfill.mjs b/scripts/tk12118-vid-backfill.mjs
index 1010631..6cacd4f 100644
--- a/scripts/tk12118-vid-backfill.mjs
+++ b/scripts/tk12118-vid-backfill.mjs
@@ -26,6 +26,10 @@ for (const k of ['FM_CLOUD_HOST', 'FM_CLARIS_EMAIL', 'FM_CLARIS_PASSWORD']) proc
 const fm = await import('/Users/macstudio3/Projects/filemaker-mcp/src/fm-client.js');
 
 const DB = 'WALLPAPER', LAYOUT = 'Report for old memo samples', FIELD = 'vid';
+// VERIFY layout: 'combo sku' does NOT serialize into fieldData on the write layout (findable but blank
+// on read), so the SKU-match guard is verified on 'REPORT ON SAMPLES ORDERED' where it reads correctly
+// (same base table WALLPAPER => same recordId space). The vid write still targets the write layout.
+const VERIFY_LAYOUT = 'REPORT ON SAMPLES ORDERED';
 const MAP = join(homedir(), 'Projects/sample-followup-sweep/data/tk12118-vid-backfill-restore-map.json');
 const TARGETS = [
   { sku: 'DWTT70793',  recordId: '538622', vid: 'Thib', entered: '07/30/2026' },
@@ -34,14 +38,10 @@ const TARGETS = [
 ];
 const ROLLBACK = process.argv.includes('--rollback');
 
+// Read a record by its FileMaker recordId on the VERIFY layout (where 'combo sku' serializes).
 async function readRec(recordId) {
-  const { records } = await fm.findRecords(DB, LAYOUT, { 'recordId': `==${recordId}` }, { limit: 1 })
-    .catch(async () => {
-      // some layouts don't expose recordId as a findable field — fall back to getRecord if available
-      if (fm.getRecord) { const r = await fm.getRecord(DB, LAYOUT, recordId); return { records: r ? [r] : [] }; }
-      return { records: [] };
-    });
-  return records[0] || null;
+  try { return await fm.getRecord(DB, VERIFY_LAYOUT, recordId); }
+  catch { return null; }
 }
 
 if (ROLLBACK) {
@@ -65,10 +65,9 @@ for (const t of TARGETS) {
   if (cur !== '') { console.log(`SKIP ${t.sku} rec ${t.recordId}: vid already "${cur}" (not empty) — not overwriting`); continue; }
   restore.push({ sku: t.sku, recordId: t.recordId, oldVid: '' });
   await fm.updateRecord(DB, LAYOUT, t.recordId, { [FIELD]: t.vid }, { dryRun: false });
-  // read-back verify
-  const after = await readRec(t.recordId);
-  const now = after ? (after.fieldData[FIELD] || '').trim() : '?';
-  console.log(`${now === t.vid ? 'OK  ' : 'WARN'} ${t.sku} rec ${t.recordId}: vid "" -> "${now}"${now === t.vid ? '' : ' (expected ' + t.vid + ')'}`);
+  // vid does not serialize into fieldData on either readable layout, so per-row read-back is impossible;
+  // authoritative verification is the canary (coverage-reconcile.mjs) — leaked must drop by the write count.
+  console.log(`OK   ${t.sku} rec ${t.recordId}: SKU verified on ${VERIFY_LAYOUT}, vid set -> "${t.vid}" (confirm via canary leaked-count)`);
 }
 writeFileSync(MAP, JSON.stringify(restore, null, 2));
 console.log(`\nrestore-map written: ${MAP} (${restore.length} rows). Rollback: node scripts/tk12118-vid-backfill.mjs --rollback`);

← d70e93d auto-data-snapshot: 2026-09-24T08:09:22 (3 data files) — dat  ·  back to Sample Followup Sweep  ·  auto-data-snapshot: 2026-09-24T08:40:54 (2 data files) — dat b9a4f66 →