[object Object]

← back to Wallco Ai

ghost-scan flagged.jsonl: gate on unanimous 3/3, not confidence>=0.5

e110dad9dd90e2102ba86c73fd46235e95e01b50 · 2026-05-24 01:25:44 -0700 · Steve Abrams

Sibling fix to 47f7a9c. That commit switched the detector call to the
stable 3-vote variant but left the flagged-write threshold at
`confidence >= 0.5`. After the schema flip, `confidence` is consensus
strength (1.0 unanimous, 0.67 split), so 2/1 splits still hit
flagged.jsonl — exactly the borderline cases that should NOT auto-flag.

New gate: write to flagged.jsonl only on (hasGhostLayer && unanimous).
This matches the verifyNoGhostLayer pre-publish gate in lib/ghost-detector.js
and keeps split-vote rows in results.jsonl for diagnostics + auto-label
follow-up review.

Header docstring updated to document the new field shape and gating rule.

Files touched

Diff

commit e110dad9dd90e2102ba86c73fd46235e95e01b50
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Sun May 24 01:25:44 2026 -0700

    ghost-scan flagged.jsonl: gate on unanimous 3/3, not confidence>=0.5
    
    Sibling fix to 47f7a9c. That commit switched the detector call to the
    stable 3-vote variant but left the flagged-write threshold at
    `confidence >= 0.5`. After the schema flip, `confidence` is consensus
    strength (1.0 unanimous, 0.67 split), so 2/1 splits still hit
    flagged.jsonl — exactly the borderline cases that should NOT auto-flag.
    
    New gate: write to flagged.jsonl only on (hasGhostLayer && unanimous).
    This matches the verifyNoGhostLayer pre-publish gate in lib/ghost-detector.js
    and keeps split-vote rows in results.jsonl for diagnostics + auto-label
    follow-up review.
    
    Header docstring updated to document the new field shape and gating rule.
---
 scripts/scan-ghost-layer.js | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/scan-ghost-layer.js b/scripts/scan-ghost-layer.js
index 042052a..74e9e7b 100644
--- a/scripts/scan-ghost-layer.js
+++ b/scripts/scan-ghost-layer.js
@@ -14,8 +14,11 @@
 //
 // Output:
 //   data/ghost-scan-results.jsonl — one line per design:
-//     { id, ts, hasGhostLayer, confidence, reason, image_url, category }
-//   data/ghost-scan-flagged.jsonl — append-only flagged subset (confidence ≥ 0.5)
+//     { id, ts, hasGhostLayer, confidence, unanimous, votes, reason, image_url, category }
+//     `confidence` is consensus strength (1.0 unanimous, 0.67 split), NOT single-call vision confidence.
+//   data/ghost-scan-flagged.jsonl — append-only flagged subset (UNANIMOUS 3/3 hasGhostLayer only).
+//     2/1 splits stay in results.jsonl for diagnostics but don't enter flagged.jsonl — they're
+//     borderline by definition and the auto-label / human-review passes handle them.
 
 const fs = require('fs');
 const path = require('path');
@@ -212,7 +215,9 @@ async function runPool(rows, workers, onResult) {
   const onResult = (out) => {
     n++;
     fs.appendFileSync(RESULTS, JSON.stringify(out) + '\n');
-    if (out.hasGhostLayer && (out.confidence || 0) >= 0.5) {
+    // Only flag on unanimous 3/3 — matches verifyNoGhostLayer gate logic.
+    // 2/1 splits stay in results.jsonl for diagnostics but don't enter flagged.jsonl.
+    if (out.hasGhostLayer && out.unanimous) {
       flagged++;
       fs.appendFileSync(FLAGGED, JSON.stringify(out) + '\n');
     }

← ea1d852 feat(design page): mural pan UI + on-screen arrow controls  ·  back to Wallco Ai  ·  triage: colorway-sibling fallback in resolveImagePath 3fc81bf →