(tmp_path)
| 27 | |
| 28 | |
| 29 | def test_on_shutdown_persists_state(tmp_path): |
| 30 | _reset_lifecycle() |
| 31 | lc.on_startup(tmp_path) |
| 32 | # Record some activity |
| 33 | lc.on_route_complete( |
| 34 | request_id="test_1", tier_id=0, model="deepseek", |
| 35 | method="direct", confidence=0.8, |
| 36 | signal_a_tier=0, signal_a_conf=0.8, |
| 37 | signal_b_tier=1, signal_b_conf=0.7, |
| 38 | signal_c_tier=0, signal_c_conf=0.8, |
| 39 | ) |
| 40 | lc.on_shutdown() |
| 41 | # Verify state file exists and is valid |
| 42 | state_file = tmp_path / "learned_state.json" |
| 43 | assert state_file.exists() |
| 44 | data = json.loads(state_file.read_text()) |
| 45 | assert "signal_weights" in data |
| 46 | assert data["schema_version"] == 1 |
| 47 | _reset_lifecycle() |
| 48 | |
| 49 | |
| 50 | def test_on_route_complete_records_metrics(tmp_path): |
nothing calls this directly
no test coverage detected