Commit Graph

432 Commits

Author SHA1 Message Date
Accusys 9244dbc853 fix: rebuild key_face.jpg for KOBA file with VFR-correct frames
- Force rebuilt all 37 traces for file 5e207a246fd6a2a65ee0a267440465ee
- Used select=eq(n\,frame) for VFR compatibility
- Each trace now uses best face (highest confidence) frame
2026-08-07 16:46:22 +08:00
Accusys ca8b910d59 fix: schema.rs COALESCE加固 + rebuild_trace_thumbs tool
- schema.rs: ON CONFLICT 加入 COALESCE 避免 edge case 把回填值打回 NULL
- rebuild_trace_thumbs: 從 Qdrant _faces 找 best face 重建 key_face.jpg
- 已完成 61/10184 traces(工具運作中,大檔案需較長時間)
2026-08-07 15:55:30 +08:00
Accusys b52777ac03 feat: add backfill_trace_profiles tool + backfill 8250 traces avg_confidence
- Created src/bin/backfill_trace_profiles.rs
- Queries Qdrant _faces once per file (optimized)
- Calculates avg confidence per trace
- Updates trace_profiles.avg_confidence and tkg_nodes.properties
- Backfilled 8250/9877 NULL traces (remaining 102 are edge cases without Qdrant data)
2026-08-07 14:26:39 +08:00
Accusys cd8df324be fix: tkg.rs avg_confidence moved before props construction + schema.rs ON CONFLICT backfill derived fields
- tkg.rs: avg_confidence calculation moved to line 1207 (before props json)
- tkg.rs: Added 'avg_confidence' to props json (round4)
- schema.rs: ON CONFLICT DO UPDATE expanded to backfill start_frame, end_frame,
  frame_count, key_frame, key_face, avg_confidence from tkg_nodes.properties

This fixes trace_profiles.avg_confidence always being NULL, and enables
automatic self-healing when upsert_trace_profile is called from any caller.
2026-08-07 14:04:54 +08:00
Accusys 64f5e3f543 feat: add request logging middleware for all API calls
- Added request_logger middleware in middleware.rs
- Logs every API request with method, path, and query string
- Logs every API response with status code and duration
- Skips health checks and static files to reduce noise
- Error responses (4xx/5xx) logged at warn/error level
- Added to server router as global middleware
2026-08-06 09:50:20 +08:00
Accusys 23c6f63742 feat: add face search API at trace level for People page FS filtering
- GET /api/v1/file/:file_uuid/faces/search
- q parameter: trace_id substring, frame fall-through, range overlap, name substring
- binding filter: assigned/unassigned
- min_confidence filter
- Pagination with page/page_size
- Response includes trace_id, file_uuid, file_name, name, start_frame, end_frame, frame_count, thumbnail_url
- SQL-based filtering with indexes on name/file_uuid for performance
2026-08-05 21:40:07 +08:00
Accusys a6d705abf1 fix: VFR frame extraction - use select=eq(n) instead of -ss frame/fps
- tkg.rs key_frame: select=eq(n\,best_frame) instead of -ss frame/fps
- tkg.rs retry: same fix for need_retry block
- tools.rs agent frame: select=eq(n\,frame_number)
- media_api.rs segment video: select=between(n\,sf\,ef-1) for frame mode

VFR videos (r_frame_rate != actual fps) now get correct frames.
CFR videos unaffected: select=eq(n) produces same result as -ss frame/fps.

Fixes: face card / face-detail thumbnail mismatch for VFR files.
2026-08-05 12:36:25 +08:00
Accusys 2117ca60b8 fix: trace thumbnail now uses trace_profile key_face.jpg for consistency
- Thumbnail endpoint was using select_rep_face (blurdetect) which could pick
  a different frame than the trace_profile's key_frame/key_face
- This caused mismatch between Face Detail modal and thumbnail in trace list
- Fix: add Step 1.5 to check trace_profile's key_face.jpg before falling back
  to select_rep_face
- Ensures thumbnail always matches what Face Detail modal shows

Verified: trace_21 thumbnail now matches key_face.jpg (same hash)
2026-08-05 02:42:38 +08:00
Accusys 15967929ef fix: ASR fails to find cut.json when executor uses .tmp output path
- ASR script used output_path.replace('.asr.json', '.cut.json') to find CUT file
- Executor passes output path with .tmp suffix (xxx.asr.json.tmp)
- This produced wrong path: xxx.cut.json.tmp (doesn't exist)
- Fix: use --uuid to construct CUT path from output_dir instead
- Also added executor Full command logging for debugging

Fixed IMG_9449 (1).MOV ASR failure: status changed from failed → completed
2026-08-05 01:45:59 +08:00
Accusys 3d13a06bd9 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
2026-08-05 00:13:50 +08:00
Accusys 36a704e3d3 fix: two issues - per-job concurrency budget + face_cluster race condition
1. Per-job concurrency budget: add can_start_for_job() to ProcessorPool
   so multiple files process in parallel instead of one job starving others.
   Uses active_job_count to compute fair slot budget per job.

2. FaceCluster race condition: add face_traced.json existence check before
   running face_cluster processor. face_traced.json is produced by P2
   store_traced_faces.py which runs AFTER process_job completes, so
   clustering was producing no_faces (0 clusters) despite having faces.
2026-08-03 12:18:22 +08:00
Accusys c5c1b08ffd feat: add trigger source and reason logging to unregister
Now all unregister operations log:
- source: who triggered it (api, studio, watcher, auto-cleanup, etc.)
- reason: why it was triggered (manual, failed-processing, duplicate, etc.)

Also adds proper ERROR logging for failures:
- Transaction commit failures
- Redis client creation failures
- Qdrant deletion failures

This allows tracking which operations caused file deletion and
identifying failures that were previously silent.
2026-08-03 08:55:44 +08:00
Accusys 4d0d2204fd fix: auto-update face track labels after clustering in worker pipeline
The P3 Face Dedup trigger previously only logged when cluster_count !=
face_track_count without actually syncing labels. Now it calls
update_face_track_labels to:
- UPDATE tkg_nodes SET label = cluster_id for each trace
- UPSERT trace_profiles SET name = cluster_id
- Reset unclustered traces to default Person_N name

This matches what the manual 'Face Deduplication' button in Studio
already does via the cluster-agent API endpoint, ensuring the automatic
pipeline produces the same result without requiring manual intervention.
2026-08-03 08:09:16 +08:00
Accusys 975c72eb49 fix: add trace_profiles deletion to unregister
trace_profiles was missing from the unregister cleanup, leaving orphaned
records when files were unregistered. This caused data inconsistency:
- trace_profiles remained while Qdrant _faces and TKG nodes were deleted
- Studio could show stale face groups pointing to non-existent data

Changes:
- Added trace_profiles_table to both unregister functions
- Added delete_safe! call to delete trace_profiles by file_uuid
- Updated log message to include trace_profiles count

Verified: Cleaned up 24 orphaned records for a4442006be2d401a7e22ed8ff29da772
2026-08-03 07:17:40 +08:00
Accusys 5244386892 fix: executor output_idx corrupting --file-uuid arg in store_traced_faces.py
The PythonExecutor.run() hardcoded output_idx=1, which treats args[1] as
an output file path and rewrites it to .json.tmp. For scripts like
store_traced_faces.py that use --file-uuid (not an output path) at
position 1, this corrupted the UUID into a file path, causing the script
to fail with exit status 1 within 90ms.

- run_with_output_idx: output_idx changed from usize to Option<usize>
- run_with_output_idx_and_frames: same change
- run(): doc comment added, passes Some(1) for backward compatibility
- job_worker.rs: store_traced_faces.py and release_pack.py calls now
  pass None for output_idx (no output path substitution)
- appearance.rs: passes Some(2) explicitly (output at index 2)

Verified: Gamma 8 file completed full pipeline with 24 face traces
and 185 TKG nodes.
2026-08-02 20:53:51 +08:00
Accusys e22393d577 feat: permanent trace delete (mode:delete) + best-face fields in /traces
- delete_trace: add mode:'delete' → permanent removal (Qdrant points,
  trace_profiles, tkg_nodes, on-disk files), no undo/history written
- list_unassigned_traces: exclude status=deleted (REQ-2), consistent
  with /traces endpoint
- /traces: return real best_face_id/frame/confidence/bbox (highest
  confidence face per trace) instead of start_frame/avg_confidence
- docs: Studio delete Core req + FS detail fix patch + handoff v2
2026-08-02 14:18:44 +08:00
Accusys 8eb130959c fix: keep user-named single-trace groups in face-groups
Single-trace groups with auto-generated names (Person_N) are filtered
to unassigned, but user-named groups are kept even with 1 trace.

This fixes the issue where moving traces one-by-one to a new group
caused them to disappear from the UI.

Before: trace → 'NewGroup' → filtered → unassigned (FS disappeared)
After:  trace → 'NewGroup' → shown as group (FS visible)
2026-08-01 06:24:00 +08:00
Accusys 57f542fdad perf: add /api/v1/trace-thumb/:uuid/:tid endpoint
Direct access to trace key_face.jpg — simpler URL, faster routing.
Response: ~8ms (read from disk, no ffmpeg).

Studio can use: /api/v1/trace-thumb/{file_uuid}/{trace_id}
Instead of: /api/v1/face-thumbnail?uuid={uuid}&trace_id={tid}&frame={frame}
2026-08-01 02:28:15 +08:00
Accusys 8a766799c7 perf: optimize face thumbnail loading + reduce face-groups payload
1. Thumbnail API now checks trace/{tid}/key_face.jpg before ffmpeg
   - First request: 8ms (read from disk) vs ~500ms (ffmpeg)
   - All 2,451 trace thumbnails now served from pre-cached key_face.jpg

2. Face-groups API accepts ?include_trace_ids=false
   - Default: includes trace_ids (32KB for Charade)
   - With flag: excludes trace_ids (17KB, 48% reduction)
   - Frontend can fetch full data only when user clicks into a group
2026-08-01 02:08:00 +08:00
Accusys d6653f8240 feat: async unregister mode for large files
Add async_mode option to POST /api/v1/unregister:
- async_mode=false (default): synchronous, waits for completion
- async_mode=true: spawns background task, returns immediately with job_id

Response now includes job_id field (None for sync mode).

Used by Studio when unregistering large files that take >30s
(e.g., 83K faces, 20K tkg_nodes).
2026-07-31 18:30:27 +08:00
Accusys 4c8041974a fix: executor .tmp output handling clobbered fresh script results
run_with_frames / run_with_output_idx / run_with_output_idx_and_frames
had an inverted .tmp-file flow:

1. Before spawning, if the final .json existed it was renamed to .json.tmp
   (the OLD output set aside as "tmp").
2. The script was passed the FINAL .json path, so it wrote fresh data there.
3. On success, .json.tmp (the OLD/empty file) was renamed back OVER the
   fresh .json, discarding the new result.

For face clustering this meant the freshly-clustered 2-person result was
always overwritten by the stale/empty previous face_cluster.json, so the
cluster agent reported "0 clusters" and Face Deduplication matched nothing.

Fix: remove the bogus pre-rename and instead pass the .tmp path to the
script as its output argument, then promote .tmp -> .json only on success.
This guarantees the fresh result is what lands in the final file. Applied
identically to all three run_* helpers.

Verified on 9cbeb112 (FilmRiot): cluster-agent now returns 2 clusters /
17 traces and face_cluster.json contains the real clustering (was 0).
2026-07-31 14:59:37 +08:00
Accusys d91ce0b4fc fix: cluster-results trace_id mapping (same bug as face-groups)
get_cluster_results_handler derived each group's trace_ids from
COALESCE(tp.properties, tn.properties)->>'trace_id'. Since
trace_profiles.properties is {} this was NULL -> fell back to 0 for
every row, so ALL groups reported trace_ids:[0] and collapsed to the
same representative trace.

Studio's People view renders groups from cluster-results, so every
group showed the same face (trace 0) and "Delete all" / "Merge" operated
on phantom data: batchDeleteGroups deleted trace 0 repeatedly and never
touched the real traces, which is why delete-all appeared to work but
left 16 groups behind and merge kept failing.

Now reads the real tp.trace_id (fallback tn.properties->>'trace_id'),
matching the face-groups fix in 4a480f46. Verified on 9cbeb112:
17 distinct traces now map correctly across 15 groups, no duplicate 0.
2026-07-31 14:45:09 +08:00
Accusys 4a480f46fd fix: face-groups trace_id mapping + robust group merge
Two bugs broke Studio "Merge groups" on files where
trace_profiles.properties is empty {}:

1. get_face_groups_handler derived each group's trace_ids from
   COALESCE(tp.properties, tn.properties)->>'trace_id'. Since
   trace_profiles.properties is {} the value was NULL -> fell back to 0
   for every row, so all groups reported trace_ids:[0] and group_uuid:None.
   This corrupted Studio's group selection and caused the merge to fail
   with "Target group cannot be in source_groups list" (the target name
   collided with a corrupted source entry). Now reads the real
   tp.trace_id (falling back to tn.properties->>'trace_id').

2. merge_groups_handler matched/updated tkg_nodes.label by the source
   group NAME, which silently no-ops when tkg_nodes.label has drifted
   out of sync with trace_profiles.name (e.g. after re-cluster), yielding
   traces_merged:0. Rewrote it to resolve source trace_ids from
   trace_profiles.name, then update both trace_profiles.name and
   tkg_nodes.label by external_id=trace_{tid}, keeping both tables in
   sync. Also defensively drops the target name from source_groups so a
   client echoing the target no longer hard-fails.

Verified on file 9cbeb112 (FilmRiot): 17 groups now map to distinct
trace_ids 0-16; merge Person_4+Person_5 -> Person_0 yields
traces_merged:2 and updates both tp.name and tn.label. Test mutations
were reverted so the file is back to its original 17-group state.
2026-07-31 14:04:16 +08:00
Accusys 40fc8c6a53 fix: group delete semantics - unassign instead of destroy, self-heal tkg_nodes
Studio's "delete group" was calling hard_delete which physically removed
_faces points, tkg_nodes and trace_profiles (and silently failed to back
up to a non-existent _faces_trash collection, making undo impossible).
This permanently lost face groups and broke face-groups/cluster-results
(which are based on tkg_nodes) for any trace without a node row.

Changes:
- delete_trace hard-delete now means "restore to unassigned": keep
  _faces/tkg_nodes/trace_profiles, only reset name to "Face Trace {id}".
  Data is never destroyed so groups can be rebuilt and undo works.
- schema::ensure_face_track_node: create the face_track tkg_nodes row on
  write so a trace that lost its node (old hard-delete) reappears in
  face-groups/cluster-results (self-healing). Called from
  update_trace_profile_handler, update_trace_profile_group_handler and
  merge_groups_handler; the group handler also syncs tkg_nodes.label.
- restore_trace / undo_hard_delete_trace: when _faces_trash is empty
  (new semantics), rebuild the named group from the operation snapshot
  (tkg_nodes ON CONFLICT UPDATE + trace_profiles UPSERT) instead of 404.

Verified live on port 3002 (file bfba056f...): delete -> unassigned with
_faces preserved (4 points), rebuild group -> self-healing creates node
and group shows up, restore -> name restored to original. Also fixed the
pre-existing missing tkg_nodes row for trace 4621 via the same path.
2026-07-31 13:14:23 +08:00
Accusys d36132d93a feat: add GET /api/v1/cluster-results endpoint for Studio face groups
- src/api/profile.rs: new get_cluster_results_handler
  - Query param file_hash (Studio passes ?file_hash=)
  - Builds face_groups from tkg_nodes + trace_profiles (same grouping as
    face-groups handler) with group_id/cluster_id/name/trace_ids/
    trace_count/representative_trace
  - Scrolls _faces for the file, groups faces by frame into frames[]
    - face_id = hex point id (matches identities.rs convention)
    - timestamp = frame / fps (from videos table)
    - cluster_id = group of the face's trace_id; unassigned faces skipped
  - Response: { success, file_uuid, face_groups, frames } matching Studio
    PeopleView.vue expected format
2026-07-31 11:58:36 +08:00
Accusys aab727b297 docs: trace_profile UPSERT fixes + Studio face group API gap analysis
- profile.rs: single/group/merge_groups/undo all use upsert_trace_profile
- trace_agent_api.rs: hard delete/merge snapshot + delete trace_profiles
- cluster_agent.rs, job_worker.rs: background name writes use UPSERT
- schema.rs: upsert_trace_profile helper (backfill from tkg_nodes)
- Studio 3 API gaps documented (cluster-results/identity-matches/similar)
2026-07-31 11:16:18 +08:00
Accusys 6081c552f6 fix: keyword/semantic search ignore limit parameter
keyword_search and semantic_search used page_size (default 5)
instead of req.limit, so clients sending limit=N got only 5 results.
Now both handlers respect the limit parameter.
2026-07-31 03:30:17 +08:00
Accusys 85d5e1fe51 feat: trace_id i64→i32 fix, OCR search filter, Rule1 OCR trigger
- Fix trace_id SQL type mismatch: i64 → i32 in profile.rs structs and queries
- Add /ocr /asr /asrx search filter suffix to keyword/semantic/smart search
- Fix fetch_ocr_texts to handle both OCR data formats (string array + object array)
- Add has_ocr trigger for Rule1 chunk ingestion in job_worker.rs
- Add search_bm25 chunk_type filter parameter
- Fix single-frame video clip duration (0-frame → 1-frame minimum)
- Re-run Rule1 for 14 files with stuck OCR in pre_chunks
2026-07-30 19:34:35 +08:00
Accusys 39a2cbc65b fix: face group name read consistency, sync_file_status fix, cleanup ghost records, identity_agent replaced with face_dedup
- get_face_groups_handler: COALESCE(tp.name, tn.label) for name consistency
- sync_file_status: compare JSON vs pre_chunks (not chunk table)
- face consistency: compare frames.len() not total_faces
- cleanup 2 ghost records with NULL file_name/file_path
- replace identity_agent with face_dedup in pipeline stages
- remove identity_agent_api.rs and all references
- update required_processors to match actual processors
- update AGENTS.md with team responsibilities
- add Studio pipeline changes documentation
2026-07-27 02:15:51 +08:00
Accusys fcdeab82e6 feat: save key_frame.jpg and key_face.jpg for each face trace during TKG build
- Extract full frame at best confidence frame using ffmpeg
- Crop face region using average bbox coordinates
- Save to .faces/{file_uuid}/{trace_id}/key_frame.jpg and key_face.jpg
- TKG node properties store full file paths for UI display
- Supports future extension for cut representative frames
2026-07-21 04:08:16 +08:00
Accusys 6f5d71763f feat: auto-populate key_frame and key_face in TKG face_track nodes
- FacePoint now includes confidence and point_id from Qdrant
- TKG build tracks best face (highest confidence) per trace
- key_frame = frame number of best face, key_face = Qdrant point ID
- Every face trace now has representative frame and face for UI display
2026-07-21 03:56:25 +08:00
Accusys 52bec30c90 feat: unify TKG face_track external_id to trace_N, add trace restore endpoint
- tkg.rs: use trace_N as primary external_id, delete duplicate face_track_N nodes
- trace_agent_api.rs: add POST /trace/:id/restore to undo soft delete
- ensure 1:1 mapping: each trace has exactly one TKG node with full profile
2026-07-21 03:19:17 +08:00
Accusys 0ad6927d25 feat: fix TKG external_id mismatch, add trace delete/merge endpoints, fix no-faces progress update
- identity_binding.rs: match both face_track_N and trace_N external_id formats in bind/unbind/create_pending_person
- profile.rs: fix external_id matching and parameter ordering in trace profile updates
- trace_agent_api.rs: add DELETE /trace/:id (soft/hard delete) and POST /trace/:src/merge/:target endpoints
- qdrant_db.rs: add delete_points_by_filter method
- tkg.rs: add debug logging for scroll and parse operations
- job_worker.rs: update progress for no-faces TKG path
2026-07-21 02:45:34 +08:00
Accusys d25b5921f7 fix: delete all progress keys on unregister
- Delete progress:{uuid}:pipeline, :agent, :tkg
- Prevents stale Redis data from blocking new registrations
2026-07-20 23:45:48 +08:00
Accusys 29d2cc7315 fix: wait for Qdrant face points before TKG build
- Add Qdrant count verification before TKG build
- Wait up to 30 seconds for Qdrant to have all face embeddings
- Prevents race condition where TKG reads incomplete data
- Add count_points method to QdrantDb
2026-07-20 23:26:42 +08:00
Accusys bc914ce3df fix: handle no_faces case - TKG proceeds without waiting for face_traced.json
- Check face.json status before waiting for face_traced.json
- If status='no_faces', spawn TKG immediately (no face_track nodes)
- If status='has_faces', wait for face_traced.json
- Prevents infinite wait when video has no faces
2026-07-20 22:34:09 +08:00
Accusys 5ec18ed520 fix: TKG build waits for face_traced.json to ensure face_track nodes are built
- Add check for face_traced.json existence before spawning TKG build
- Prevents race condition where TKG reads Qdrant before trace_id is written
- Logs clearly when waiting and when proceeding
2026-07-20 22:20:33 +08:00
Accusys 70e6915246 fix: remove error status handling that caused TKG to build without face_track nodes 2026-07-20 21:59:53 +08:00
Accusys 7dc910e2de feat: add cluster-agent endpoint, fix OCR labeling, fix ingestion blocking
- Add POST /api/v1/file/:file_uuid/cluster-agent endpoint for on-demand face clustering
- Fix OCR chunks being labeled as ASRX: use ChunkType.as_str() instead of {:?}
- Rule 1 now deletes old chunks before re-inserting to avoid stale data
- Add fallback face_traced.json when store_traced_faces.py fails
- ingestion_complete now handles status='error' to unblock jobs
- VLM describe tool now uses trace_id with pre-extracted face crops
2026-07-20 21:48:27 +08:00
Accusys 2ed56b7973 feat: add sync-status endpoint to update file status based on processor files 2026-07-19 21:58:03 +08:00
Accusys d0b7bfa56b feat: add pose and appearance endpoints for face detail display
- Add GET /api/v1/file/:file_uuid/pose endpoint
- Add GET /api/v1/file/:file_uuid/appearance endpoint
- Keypoint deduplication (highest confidence)
- Add face-groups endpoint for Studio integration
- Add profile routes (trace-profile, file-profile)
- Update API documentation
2026-07-19 20:43:35 +08:00
Accusys 455c6b81e6 fix: improve search ranking for semantic results
- Lower title match score: 0.9 → 0.75
- Boost keyword score: capped 0.1 → boosted 0.1-0.85
- Skip text_match filter for semantic-only results
- Semantic results now rank higher than title/keyword

Verification:
- 'unfamiliar technology': 5 semantic results (score 0.68-0.74)
- 'storage': 60 semantic + 45 keyword + 60 title merged
- 'AUDIO MONITORING': 2 keyword (0.94) + 3 semantic (0.66-0.69)
2026-07-19 14:40:58 +08:00
Accusys 3c924e1f83 fix: agent search uses smart_search for content queries
- Update system prompt to prioritize smart_search over find_file
- Add source prefix ([OCR], [ASRX], [ASRX+OCR]) to exec_smart_search results
- Users can now see chunk content with source indicators
2026-07-19 14:21:12 +08:00
Accusys 87aa7e0c40 feat: add source prefix to search results
- Add [OCR], [ASRX], [ASRX+OCR] prefix to text_content
- Add content field to SemanticSearchResult struct
- Update SQL queries to include content field
- Helps users distinguish the source of search results
2026-07-19 14:06:06 +08:00
Accusys 5e83ee7dac fix: keyword search for OCR text
- Fix OCR confidence threshold: 0.5 → 0.2
- Fix fetch_ocr_texts frame calculation (use start_frame from DB)
- Fix text_match filter to use text_content instead of summary
- Process all merged results (not just top 30) to include keyword results
- Add logging for keyword search debugging

Fixes issue where OCR text like 'AUDIO MONITORING' and 'thunderbolt'
could not be found via keyword search.
2026-07-19 13:33:31 +08:00
Accusys 0d9aa7b470 refactor: agent search defaults to all files, no longer asks which file
- Removed '先確認用戶在問哪部影片' — no longer asks users to identify file
- Removed all 反问/ask-back rules (specify-type, ask-type, suggestions)
- Rule 1 now: 所有查詢都預設搜尋全部影片
- Smart/universal search file_uuid parameter noted as optional
- Simplified system prompt by ~40% (19 lines vs 47 lines)
2026-07-11 09:26:55 +08:00
Accusys e4b8e9924c fix: agent_search tool descriptions + HAND_OBJECT casing + rule2 edge types
- agent_search.rs: text_region -> text_trace, removed skin_tone_trace
  (never built, misleading LLM agents)
- tkg.rs + scan.rs: hand_object -> HAND_OBJECT for consistency with
  all other edge types (CO_OCCURS_WITH, SPEAKS_AS, etc.)
- rule2_ingest.rs: added LIP_SYNC and HAND_OBJECT to edge_type
  priority list so these edges generate relationship chunks
2026-07-11 08:50:38 +08:00
Accusys 7635ad8d4d fix: correct TKG node_type/edge_type mismatches in scan.rs and tkg.rs
Mismatches fixed (builder vs query layer):
- 'text_region' -> 'text_trace' (3 locations: scan.rs count + tkg.rs LIP_SYNC
  query + tkg.rs LIP_SYNC node ID lookup)
- 'yolo_object' -> 'object' (2 queries in scan.rs)
- 'FACE_TO_FACE' -> CO_OCCURS_WITH + JOIN with tkg_nodes (2 queries in
  scan.rs, so face_face_edges correctly counts only face-track pairs)
- 'HAND_OBJECT' -> 'hand_object' (2 queries in scan.rs)

Impact: ingestion_status and file stats endpoints now return accurate
counts; LIP_SYNC edges now resolve their target text nodes.
2026-07-11 08:40:24 +08:00
Accusys b98a362de5 refactor: cargo fmt across 27 files + behavioral fixes
Behavioral changes:
- postgres_db: reorder default processors (cut first), prevent overwriting completed status
- qdrant_db: fix scroll pagination exit condition (next.is_none())
- job_worker: add idempotency guards for face trace / TKG build; better error logging
- main.rs: add LineWriter for stdout buffering

Remaining diff is cargo fmt reformatting (line wrapping, import ordering).
2026-07-11 02:03:28 +08:00
Accusys 701727fd08 test(tkg): add integration tests for TKG optimizations
- test_build_frame_index: verifies frame-to-point index creation
- test_build_frame_index_empty: edge case for empty input
- test_find_trace_in_frame_exact_match: exact bbox match
- test_find_trace_in_frame_closest_match: closest bbox match
- test_find_trace_in_frame_no_matching_frame: missing frame returns None
- test_find_trace_in_frame_empty_index: empty index returns None
- test_node_id_map_lookup: verifies HashMap-based node ID lookup

Note: Pre-existing test compilation errors (E0063 in asr/asrx/face) block test execution.
2026-07-10 07:44:37 +08:00