feat: face fix deployment + trace_* regeneration + executor stderr filter fix
- 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
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
---
|
||||
title: Sync Status Completed Logic Fix
|
||||
version: 1.0
|
||||
date: 2026-07-28
|
||||
author: Core Team
|
||||
status: 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`:
|
||||
|
||||
```rust
|
||||
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 !consistent` block is never reached
|
||||
- `all_consistent` remains `true`
|
||||
- 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:
|
||||
|
||||
```rust
|
||||
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
|
||||
|
||||
1. File with all 7 JSONs → `completed` or `agent_ready`
|
||||
2. File with 6 JSONs (1 missing) → `scanning`
|
||||
3. File with no JSONs → `registered`
|
||||
4. Special case (no audio, no faces) → all JSONs exist with special status → `completed`
|
||||
Reference in New Issue
Block a user