feat: DO-gated manual batch mode (auto default, office-only switches)
ci / smoke (push) Canceled after 0s

This commit is contained in:
andrew committed 2026-09-24 15:45:12 +07:00
1 parent 735e0c7594
commit 0efcfa45b8
20 files changed
+3128 -209

No files matched your search

+35
View File
@@ -39,6 +39,41 @@ def test_repo_config_loads_and_validates(repo_config_path):
assert dp.min_bbox_area >= 0
def test_do_block_and_batch_default_mode(repo_config_path):
cfg = load_config(repo_config_path)
assert cfg.batch.default_mode == "auto"
assert cfg.do.enabled is True
assert cfg.do.require_do is True
assert cfg.do.require_plate is False
assert cfg.do.retention_days == 7
assert cfg.do.photo_dir == "do_photos"
assert cfg.do.max_photos_per_batch == 8
assert cfg.do.zone_warn_seconds == 3
assert cfg.do.ocr.engine == "tesseract"
def test_do_block_missing_uses_defaults(tmp_path):
p = tmp_path / "config.yaml"
p.write_text("models:\n active_mode: C\n")
# minimal — will fail validate without modes; copy repo and strip do
import shutil
shutil.copy(repo_config_path_holder(), p)
raw = yaml.safe_load(p.read_text())
del raw["do"]
raw["batch"].pop("default_mode", None)
p.write_text(yaml.safe_dump(raw))
cfg = load_config(p)
assert cfg.batch.default_mode == "auto"
assert cfg.do.enabled is True
assert cfg.do.ocr.engine == "tesseract"
assert cfg.do.retention_days == 7
def repo_config_path_holder():
import os
return os.path.join(os.path.dirname(os.path.dirname(__file__)), "config.yaml")
def test_counting_knobs_match_production_defaults(repo_config_path):
"""All live counting knobs in predict.py must come from config.yaml."""
cfg = load_config(repo_config_path)