fix: gross-based batch discard, direction-correct event logs, wire CSV logger
ci / smoke (push) Canceled after 0s

This commit is contained in:
andrew committed 2026-09-28 12:08:37 +07:00
1 parent 508bee736d
commit d3357fccef
8 files changed
+200 -22

No files matched your search

+21 -2
View File
@@ -39,7 +39,8 @@ def test_net_counts_and_discard():
assert should_discard_batch(0, 0) is True
assert should_discard_batch(1, 0) is False
assert should_discard_batch(0, 1) is False
assert should_discard_batch(-1, 0) is False
assert should_discard_batch(0, 7) is False
assert should_discard_batch(5, 0) is False
def test_classify_unit_tokens():
@@ -265,7 +266,7 @@ def test_start_stop_auto_409(dash_client):
assert res.status_code == 409
def test_stop_discard_both_nets_zero(dash_client):
def test_stop_discard_gross_zero(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)
@@ -283,6 +284,24 @@ def test_stop_discard_both_nets_zero(dash_client):
assert not state_path.exists()
def test_stop_discards_zero_loading_with_unloading(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)
state_path.write_text(json.dumps({
"counting_date": "2026-09-24", "batch_number": 97,
"count": 0, "box_count": 0, "box_unloading": 0, "unloading": 7,
"start_time": "2026-09-24T00:00:00",
"model_mode": "C",
}))
res = client.post("/api/batch/stop", headers={"Host": "localhost:5000"})
body = res.get_json()
assert res.status_code == 200
assert body["discarded"] is True
assert body["net_sack"] == -7
assert not state_path.exists()
def test_stop_keeps_box_only_batch(dash_client):
client, mode_path, state_path, _ = dash_client
office = {"Host": f"localhost:{cd_office_port()}"}