Add production diagnostics and planning features
This commit is contained in:
@@ -354,6 +354,51 @@ def test_feedback_adapts_sensor_weights_and_model_can_rollback(tmp_path: Path) -
|
||||
assert rollback.json()["behavior"]["active_model_version"] == version_id
|
||||
|
||||
|
||||
def test_feedback_never_automate_sets_manual_block(tmp_path: Path) -> None:
|
||||
with TestClient(app) as client:
|
||||
_install_service(tmp_path)
|
||||
client.post(
|
||||
"/v1/actuators",
|
||||
json={"actuator_entity_id": "light.abstellkammer"},
|
||||
)
|
||||
|
||||
feedback = client.post(
|
||||
"/v1/actuators/light.abstellkammer/feedback",
|
||||
json={"correct": False, "kind": "never_automate"},
|
||||
)
|
||||
|
||||
assert feedback.status_code == 200
|
||||
payload = feedback.json()
|
||||
assert payload["behavior"]["safety"]["manual_block"] is True
|
||||
assert payload["behavior"]["feedback_log"][-1] == "never_automate"
|
||||
|
||||
|
||||
def test_backup_export_restore_and_planning_refresh(tmp_path: Path) -> None:
|
||||
with TestClient(app) as client:
|
||||
_install_service(tmp_path)
|
||||
client.post("/v1/actuators", json={"actuator_entity_id": "light.abstellkammer"})
|
||||
|
||||
backup = client.get("/v1/actuators/backup/export")
|
||||
dry_run = client.post(
|
||||
"/v1/actuators/light.abstellkammer/dry-run",
|
||||
json={"enabled": True},
|
||||
)
|
||||
planning = client.post("/v1/actuators/planning/refresh")
|
||||
restore = client.post(
|
||||
"/v1/actuators/backup/restore",
|
||||
json={"backup": backup.json(), "replace_existing": True},
|
||||
)
|
||||
|
||||
assert backup.status_code == 200
|
||||
assert backup.json()["records"][0]["actuator_entity_id"] == "light.abstellkammer"
|
||||
assert dry_run.status_code == 200
|
||||
assert dry_run.json()["behavior"]["dry_run_enabled"] is True
|
||||
assert planning.status_code == 200
|
||||
assert "agent_insights" in planning.json()[0]["behavior"]
|
||||
assert restore.status_code == 200
|
||||
assert restore.json()["restored_records"] == 1
|
||||
|
||||
|
||||
def test_summary_is_lightweight_and_uses_cached_entity_metadata(tmp_path: Path) -> None:
|
||||
with TestClient(app) as client:
|
||||
_install_service(tmp_path)
|
||||
|
||||
Reference in New Issue
Block a user