[object Object]

← back to Ticket System

Enforce terminal ticket blocker precedence

c351d5ce9cebd1b78b849c5c26e11013264c11ac · 2026-09-02 17:46:40 -0700 · Steve Abrams

Files touched

Diff

commit c351d5ce9cebd1b78b849c5c26e11013264c11ac
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Sep 2 17:46:40 2026 -0700

    Enforce terminal ticket blocker precedence
---
 lib.js      | 3 +++
 lib.test.js | 9 +++++++++
 2 files changed, 12 insertions(+)

diff --git a/lib.js b/lib.js
index 9f80763e..2f27c22b 100644
--- a/lib.js
+++ b/lib.js
@@ -95,6 +95,9 @@ function tickets() {
       }
     }
   }
+  // Terminal state wins regardless of event arrival order. Keep every blocker
+  // event in the ledger, but never expose an active blocker on a done ticket.
+  for (const t of map.values()) if (t.status === 'done') delete t.blocker;
   return map;
 }
 
diff --git a/lib.test.js b/lib.test.js
index bb7ff817..5c15ffaf 100644
--- a/lib.test.js
+++ b/lib.test.js
@@ -107,6 +107,15 @@ test('done status clears the materialized blocker without rewriting history', ()
   assert.ok(readEventLines().map(JSON.parse).some(ev => ev.type === 'blocker' && ev.id === id));
 });
 
+test('done status keeps terminal precedence when a blocker event arrives later', () => {
+  const id = 'TK-10034-late-blocker';
+  append({ ts: iso(), type: 'create', id, title: 'Late blocker', agent: 'a' });
+  append({ ts: iso(), type: 'status', id, status: 'done', agent: 'a' });
+  ticketBlocker(id, { type:'technical_dependency', condition:'late event', next_action:'none', owner:'a', evidence_at:iso() });
+  assert.equal(tickets().get(id).status, 'done');
+  assert.equal(tickets().get(id).blocker, undefined);
+});
+
 // ── 3. comment vs action vs assign fold correctly; create body seeds a comment ─
 test('comment, action, and assign events fold into the right places', () => {
   const id = 'TK-10004-fold';

← 180ff40f Clear blockers when tickets complete  ·  back to Ticket System  ·  auto-data-snapshot: 2026-09-02T18:02:03 (1 data files) — dat 5164b250 →