feat(manual-batch): require plate number at manual mode start
ci / smoke (push) Canceled after 0s

Legacy manual batch start locked until plate entered:
- POST /api/batch/start manual branch returns 400 missing_plate when
  plate empty (strip + uppercase, no format regex)
- operator + monitoring start modals gain required plate input,
  confirm button disabled until filled
- operator plate tile also shows for manual batches (was do_manual only)
- do_manual unchanged (plate from DOs)
This commit is contained in:
andrew committed 2026-10-02 15:10:13 +07:00
1 parent f621ae86fb
commit 7ad995d8d1
6 files changed
+118 -6

No files matched your search

+35
View File
@@ -266,6 +266,41 @@ def test_start_stop_auto_409(dash_client):
assert res.status_code == 409
def test_manual_start_missing_plate_400(dash_client):
client, mode_path, state_path, _ = dash_client
office = {"Host": f"localhost:{cd_office_port()}"}
client.post("/api/batch/mode", json={"mode": "manual"}, headers=office)
res = client.post("/api/batch/start", headers={"Host": "localhost:5000"})
assert res.status_code == 400
body = res.get_json()
assert body["success"] is False
assert body["reason"] == "missing_plate"
assert not state_path.exists()
res = client.post("/api/batch/start", json={"plate": " "},
headers={"Host": "localhost:5000"})
assert res.status_code == 400
assert res.get_json()["reason"] == "missing_plate"
assert not state_path.exists()
def test_manual_start_with_plate_normalizes_and_persists(dash_client):
client, mode_path, state_path, _ = dash_client
office = {"Host": f"localhost:{cd_office_port()}"}
client.post("/api/batch/mode", json={"mode": "manual"}, headers=office)
res = client.post("/api/batch/start", json={"plate": " b 1234 xyz "},
headers={"Host": "localhost:5000"})
assert res.status_code == 200
body = res.get_json()
assert body["success"] is True
assert body["plate"] == "B 1234 XYZ"
assert state_path.exists()
state = json.loads(state_path.read_text())
assert state["plate"] == "B 1234 XYZ"
assert state["batch_mode"] == "manual"
assert state["manual_control"] is True
def test_stop_discard_gross_zero(dash_client):
client, mode_path, state_path, _ = dash_client
office = {"Host": f"localhost:{cd_office_port()}"}