[object Object]

← back to Ticket System

reopen-from-audit: never clobber the reopened record with an empty re-run; append per-day (TK-11903)

e95759aba0ae59976c4f53526af95539c6594bd8 · 2026-09-18 08:57:42 -0700 · Steve Abrams

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YT3be6iadPzjKJDiaTasEE

Files touched

Diff

commit e95759aba0ae59976c4f53526af95539c6594bd8
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Fri Sep 18 08:57:42 2026 -0700

    reopen-from-audit: never clobber the reopened record with an empty re-run; append per-day (TK-11903)
    
    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01YT3be6iadPzjKJDiaTasEE
---
 scripts/reopen-from-audit.mjs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/reopen-from-audit.mjs b/scripts/reopen-from-audit.mjs
index d7490e43..936042ad 100644
--- a/scripts/reopen-from-audit.mjs
+++ b/scripts/reopen-from-audit.mjs
@@ -104,4 +104,11 @@ for (const p of plan) {
   } catch (e) { fail++; console.log(`  FAIL ${p.id}: ${String(e.message || e).split('\n')[0]}`); }
 }
 console.log(`reopened=${ok} failed=${fail}`);
-fs.writeFileSync(path.join(ROOT, 'data', 'audit-overnight-reopened-2026-09-18.json'), JSON.stringify(plan, null, 2));
+// Never clobber a prior run's record with an empty plan (a re-run that reopens nothing
+// would otherwise erase the list of what WAS reopened — happened once on 2026-09-18).
+if (plan.length) {
+  const out = path.join(ROOT, 'data', `audit-overnight-reopened-${new Date().toISOString().slice(0, 10)}.json`);
+  const prev = fs.existsSync(out) ? JSON.parse(fs.readFileSync(out, 'utf8')) : [];
+  const seen = new Set(prev.map(p => p.id));
+  fs.writeFileSync(out, JSON.stringify([...prev, ...plan.filter(p => !seen.has(p.id))], null, 2));
+}

← e9464783 TK-11903: reopen 71 unverified overnight closes (Cody correc  ·  back to Ticket System  ·  auto-data-snapshot: 2026-09-18T09:26:51 (1 data files) — dat 427e7cc7 →