feat(manual-batch): canonical plate + manual mode as default
ci / smoke (push) Canceled after 0s

- canonical_plate (uppercase alnum, strips space/dot/hyphen) at all plate
  write sites; pretty_plate for render (history, XLSX, operator tile) so
  B 1234 XYZ and B1234XYZ are one plate everywhere
- group_dos_by_plate compares canonical plates -> no false mixed_plates
- warn-only (never blocking) plate format hint in operator + monitoring modals
- batch.default_mode: manual (auto merged truck loads when a sack sat in the
  counting ROI); operator banner explains plate -> start -> stop
- docs + AGENTS known-limitation note; 85 tests pass
This commit is contained in:
andrew committed 2026-10-05 09:36:32 +07:00
1 parent 7ad995d8d1
commit 6c5b1c8b30
11 files changed
+128 -32

No files matched your search

+15 -2
View File
@@ -6,15 +6,28 @@ version tags are cut in this repo — POC stage, `main` is the release line).
## [Unreleased]
### Changed
- **Plate canonicalization** (`canonical_plate` in `src/do_batch.py`): plates are
stored uppercase alnum-only (`B 1234 XYZ` / `b-1234.xyz` → `B1234XYZ`), so
spacing/dot/hyphen variants are one plate everywhere — DB, history, XLSX, DO
grouping (no more false `mixed_plates`). Render pretty (`B 1234 XYZ`) via
`pretty_plate`. Applies to manual start, DO plate edit, DO OCR draft.
- `batch.default_mode` = **`manual`** (was `auto`) — auto mode merged many
truck loads into one batch when a sack sat in the counting ROI (2026-10-03:
2486 sacks / 7h14m in a single row). Operator page gets a manual-mode banner
(plate → start when truck ready → stop when truck leaves).
- Manual start plate field warns (never blocks) when the value doesn't look like
a plate.
### Added
- **Manual mode plate entry**: legacy `manual` batch start is now locked until a
plate number is entered — plate input in operator + monitoring start modals
(confirm button disabled while empty), `POST /api/batch/start` rejects
manual start with 400 `missing_plate` (strip + uppercase, no format regex);
manual start with 400 `missing_plate` (canonical + non-empty, no format regex);
plate flows through `current_batch.json` → `batches.plate` on stop, so
history/XLSX show it for manual batches. Operator plate tile now also shows
for manual batches (was `do_manual` only).
- **DO-gated manual batch mode** (`auto` default · `do_manual` · legacy `manual`):
- **DO-gated manual batch mode** (`manual` default · `do_manual` · `auto`):
smartphone photo capture → OCR draft → plate-grouped start gates → net
expected/counted on live panel → stop soft-warn + force → discard only when
**both** gross `count` and `box_loading` are 0.