fix: timestamp collision, undo stack invalidation, label parsing, filter-aware clear

- Use microsecond-precision timestamps to prevent version merging on
  sub-second scans
- Clear undo stack when switching scan versions (stale row references)
- Parse timestamp labels robustly instead of hard-coded string slicing
- "Clear All" in hard negatives dialog respects active model filter
- Remove time.sleep from tests (no longer needed with microsecond timestamps)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-19 15:36:31 +02:00
parent e6db83f00b
commit 5d45b8d8eb
3 changed files with 23 additions and 11 deletions
+1 -4
View File
@@ -1,6 +1,5 @@
import os
import tempfile
import time
from core.db import ProcessedDB
@@ -32,12 +31,10 @@ def test_scan_result_history():
path = f.name
try:
db = ProcessedDB(path)
# Save three versions with small delays so timestamps differ
# Save three versions (microsecond-precision timestamps avoid collisions)
db.save_scan_results("v.mp4", "test", "MODEL_A", [(0, 8, 0.9)])
time.sleep(1.1)
db.save_scan_results("v.mp4", "test", "MODEL_A",
[(0, 8, 0.8), (10, 18, 0.7)])
time.sleep(1.1)
db.save_scan_results("v.mp4", "test", "MODEL_A", [(5, 13, 0.95)])
versions = db.get_scan_versions("v.mp4", "test", "MODEL_A")
assert len(versions) == 3