[object Object]

← back to Filemaker Mcp

auto-save: 2026-08-03T11:23:33 (1 files) — scripts/tk-10083-cleanup.mjs

9c6b4476ebdfb031a6738e3e8b95dc347f068390 · 2026-08-03 11:23:39 -0700 · Steve Abrams

Files touched

Diff

commit 9c6b4476ebdfb031a6738e3e8b95dc347f068390
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Aug 3 11:23:39 2026 -0700

    auto-save: 2026-08-03T11:23:33 (1 files) — scripts/tk-10083-cleanup.mjs
---
 scripts/tk-10083-cleanup.mjs | 52 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/scripts/tk-10083-cleanup.mjs b/scripts/tk-10083-cleanup.mjs
new file mode 100644
index 0000000..a5e226e
--- /dev/null
+++ b/scripts/tk-10083-cleanup.mjs
@@ -0,0 +1,52 @@
+// TK-10083 remediation: delete the TWO empty duplicate WALLPAPER masters minted
+// 7/31/2026 by the old buggy parser (Series=DWC, wrong split), preserving the
+// genuine 2019 master 240939. Steve-approved (2026-08-03).
+//
+// HARD INTERLOCK: re-reads each record live and DELETES ONLY IF it is still the
+// empty DWC mis-mint — Series must be exactly 'DWC', combo sku exactly
+// 'DWCOP-ART-DECO-WAVES', and every price/cost field blank. Any deviation (data
+// appeared, or it's the real master) ABORTS that record. This makes it
+// structurally impossible to delete 240939 (Series 'OP-ART') or a record that
+// gained content since the approval.
+import * as fm from '../src/fm-client.js';
+
+const DB = 'WALLPAPER';
+const LAYOUT = 'Basic List of Fields'; // read/guard layout
+// The read layout has related-table portals -> FM [110] on DELETE. Delete through a
+// leaner layout instead (the ones onboarding already writes through work).
+const DELETE_LAYOUTS = ['Add wallcovering', '*List Wallpapers - Full View', 'Basic List of Fields'];
+const TARGETS = ['538697', '538698'];
+const NEVER = new Set(['240939']); // the genuine master — explicit tripwire
+
+const PRICE_FIELDS = ['Retail Price', 'Cost', 'Net Price', 'Repeat', 'Width', 'Supplier', 'Internal Description', 'Client Notes'];
+
+function guardOk(fd) {
+  const reasons = [];
+  if (String(fd.Series || '') !== 'DWC') reasons.push(`Series is "${fd.Series}" (expected DWC)`);
+  if (String(fd['combo sku'] || '') !== 'DWCOP-ART-DECO-WAVES') reasons.push(`combo sku is "${fd['combo sku']}" (expected DWCOP-ART-DECO-WAVES)`);
+  for (const f of PRICE_FIELDS) if (String(fd[f] || '').trim()) reasons.push(`${f} is non-empty ("${fd[f]}")`);
+  return reasons;
+}
+
+const del = process.argv.includes('--commit');
+console.log(del ? '=== COMMIT MODE — will delete on guard pass ===' : '=== DRY RUN (add --commit to delete) ===');
+
+for (const id of TARGETS) {
+  if (NEVER.has(id)) { console.log(`ABORT ${id}: on the never-delete list`); continue; }
+  let rec;
+  try { rec = await fm.getRecord(DB, LAYOUT, id); }
+  catch (e) { console.log(`ABORT ${id}: could not re-read (${e.message})`); continue; }
+  if (!rec) { console.log(`SKIP ${id}: already gone (not found)`); continue; }
+  const fd = rec.fieldData || {};
+  const bad = guardOk(fd);
+  if (bad.length) { console.log(`ABORT ${id}: guard failed — ${bad.join('; ')}`); continue; }
+  console.log(`GUARD PASS ${id}: empty DWC mis-mint (Series=${fd.Series}, combo sku=${fd['combo sku']})`);
+  if (!del) { console.log(`  would delete ${id}`); continue; }
+  let done = false;
+  for (const lay of DELETE_LAYOUTS) {
+    try { const r = await fm.deleteRecord(DB, lay, id); console.log(`  DELETED ${id} via "${lay}": ${JSON.stringify(r)}`); done = true; break; }
+    catch (e) { console.log(`  delete via "${lay}" failed: ${e.message}`); }
+  }
+  if (!done) console.log(`  DELETE FAILED ${id}: all candidate layouts rejected`);
+}
+console.log('=== done ===');

← 64cf597 TK-10083: fail-closed combo-SKU parser — stop duplicate WALL  ·  back to Filemaker Mcp  ·  chore: bump v0.2.6 (session close — TK-10083 fail-closed par ccd79b3 →