3d13a06bd9
- swift_face.swift: frame rounding (.rounded()), conf 0.75, min_size 64 - trace_* directories regenerated for KOBA (37 traces, start_frame 5307) - executor.rs: stderr filter now logs all non-empty stderr (was discarding) - VAD not skippable in ASRX (main_fixed.py Step 2 always runs) - Step 2.5 sentence boundary refinement added - Cluster agent async endpoints + similarity transparency - Keyword search: relationship text extraction, priority ordering - Face fix handoff doc for Studio team
2.9 KiB
2.9 KiB
title, version, date, author, status
| title | version | date | author | status |
|---|---|---|---|---|
| Sync Status Completed Logic Fix | 1.0 | 2026-07-28 | Core Team | draft |
Sync Status "Completed" Logic Fix
Problem
The sync_file_status endpoint (POST /api/v1/file/:file_uuid/sync-status) incorrectly returns "completed" status when some processor JSON files are missing.
Root Cause
In src/api/files.rs:1673-1753, the all_consistent flag is only updated when json_exists = true:
if json_exists {
any_json_exists = true;
// ... check consistency, set consistent ...
if !consistent {
all_consistent = false; // Only executed when JSON exists!
}
}
// When json_exists = false: consistent = false, but all_consistent stays true
This means if asr.json doesn't exist:
consistent = false(initialized at line 1676)- But the
if !consistentblock is never reached all_consistentremainstrue- Status becomes
"completed"instead of"scanning"
Design
Processor JSON Files (7 required)
| Processor | Filename | Special Cases |
|---|---|---|
| ASR | {uuid}.asr.json |
"status": "no_audio_track" or "silent_audio" |
| ASRX | {uuid}.asrx.json |
"status": "no_audio_track" |
| OCR | {uuid}.ocr.json |
Always exists if processor ran |
| Pose | {uuid}.pose.json |
Always exists if processor ran |
| CUT | {uuid}.cut.json |
Always exists if processor ran |
| Face | {uuid}.face.json |
"status": "no_faces" |
| Face Cluster | {uuid}.face_cluster.json |
"status": "no_faces" or "no_embeddings" |
Key principle: ALL processors produce their JSON files, even for special cases. The JSON file exists but may contain empty arrays or special status fields.
Status Determination Logic
| Condition | Status |
|---|---|
| All 7 JSONs exist AND all consistent AND has TKG edges | agent_ready |
| All 7 JSONs exist AND all consistent AND no TKG edges | completed |
| Any JSON exists (but not all, or not consistent) | scanning |
| No JSON exists | registered |
Fix
Move the all_consistent update outside the json_exists block:
for (name, filename) in &processors {
let path = ...;
let json_exists = path.exists();
let mut consistent = false;
if json_exists {
any_json_exists = true;
// ... check consistency, set consistent ...
}
// MOVED HERE: JSON not existing = not consistent
if !consistent {
all_consistent = false;
}
processor_status.insert(...);
}
Impact
- API: No change to response format
- Behavior: Files missing any JSON will show
"scanning"instead of"completed" - Backward compat: No breaking changes
Testing
- File with all 7 JSONs →
completedoragent_ready - File with 6 JSONs (1 missing) →
scanning - File with no JSONs →
registered - Special case (no audio, no faces) → all JSONs exist with special status →
completed