chore: the film-making shortcut leaves the server, and failures stop hiding

From the deep review's hygiene list:

- The demo replay (a still recognition replayed as if it were live tracking) moves
  out of app.py into demo_replay.py, and every payload it produces is marked
  `synthetic: true`. It had been committed inside an unrelated feature commit, which
  made a film-making device look like part of the server.
- `/v1/health` reports the OCR engine and whether it is available. Without it an
  operator could not tell a broken OCR from a shelf with no readable tags.
- A failed OCR pass is counted and logged instead of swallowed: `TagService.stats()`
  now carries `passes_failed` and `last_pass_error`.
- The live classification budget goes back to the measured production defaults
  (16 in flight, 2 attempts); a demo walk over a nearly static shelf asks for more
  through `--live-inflight` / `--live-attempts` rather than silently changing the
  default for everyone.

162 tests pass.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
kiyo9w 2026-09-25 01:30:16 +09:00
parent 99bce4d7bf
commit e67ab8bfb4
5 changed files with 287 additions and 149 deletions

View file

@ -17,10 +17,13 @@ import collections
import os
import statistics
import sys
import logging
import threading
import time
from concurrent.futures import Future, ThreadPoolExecutor
from dataclasses import dataclass, field
LOGGER = logging.getLogger("dorayaki.live")
from typing import Any, Dict, List, Optional, Sequence, Tuple
current_dir = os.path.dirname(os.path.abspath(__file__))
@ -908,10 +911,12 @@ class LiveSession:
def _on_tag_pass_done(self, future: Any) -> None:
try:
future.result()
except Exception:
# A failed OCR pass must not disturb the stream; the band simply stays
# unread until the next attempt.
pass
except Exception as error:
# A failed OCR pass must not disturb the stream, but it must not be
# invisible either: counted and reported through stats(), so an
# operator can tell a broken OCR from a shelf with no tags.
self._tags.note_pass_failure(error)
LOGGER.warning("tag pass failed: %s", error)
def _apply_tags(
self, seq: int, track_payloads: List[Dict[str, Any]], bands: Sequence[Any]