Review of the compression branch (ce93c68..d7c1415): one Important and the
cheap real Minors, each with a RED test first.
- app.py: drop the manual Content-Length override - it broke ranged
requests (206 announcing the full length while sending a slice).
send_file sets it and the 206/Content-Range itself.
- app.py: the download route serves video extensions only, never the temp
of an encode in flight.
- src/compress.py: the encode temp is unique per attempt (mkstemp), is
validated (playable video) and fsynced before it replaces the original;
a failing os.replace keeps the original and cleans the temp up instead
of raising into the route. The compressed video keeps the source mode.
- src/compress.py: a stale temp of a killed encode is swept after 2 h
instead of the 5-day video expiry.
- src/job.py: cancelled and failed jobs are not re-encoded; the job shows
"Compressing..." while the encode runs.
- ERD.md: the $OUTPUT_DIR/*_compressed.mp4 row is gone.
328 tests pass (was 319).
CHANGELOG: a finished job leaves one compressed video (compressed in place
under the plain name) and the job videos expire after 5 days.
README: the output lifecycle - one video per job, 5-day retention.
Plan: the implementation plan this branch followed.
The whole-branch review found three ways a broken zones.json could reach a
published count:
- build_static_roi indexed the truck_area points directly, so a 1-element
point (IndexError) or an infinite coordinate (OverflowError) escaped the
app's guard and became a 500. It now reuses _scaled_points and raises
ValueError, which the guard already handles.
- A missing or short truck_area fell back to an invented heuristic box that
was still published as a calibrated "fixed" zone. It now degrades to
dynamic mode instead.
- A degenerate (zero-area) counting polygon was built successfully and
filtered out every detection, silently publishing zero counts. It is
now rejected like any other malformed calibration.
Also: the app guard catches IndexError/KeyError/OverflowError, the zone
preset comment no longer claims 1920x1080 coordinates are authored for
1280x720, and two FCP citations are corrected.
- SyntheticIdAssigner: track_id=None dets get stable negative IDs so the
stabilizer hold bridges sup_det_interval gaps -> no flicker, boxes count
- apply primary model class filter in merged path (UI checkboxes work)
- _suppress_sacks_under_boxes: sack dets overlapping box dets dropped
(models without box class label boxes as sack; stops double counting)
- default web port 9000 -> 9050 (WEB_PORT env still overrides)
- README: port refs, counting zone modes section, project tree
- 140 tests pass (+13)
- Added live preview (MJPEG), auto truck detection, video reuse/delete
- Added abort button, model groups with format dropdown
- Updated API endpoints table with all current routes
- Added configuration section with env variables
- Added model formats and truck detection sections
- Updated project structure with preview.py