From 9004f3eb28a83ddbb158d686b563de9924ca3431 Mon Sep 17 00:00:00 2001 From: claude Date: Sat, 18 Jul 2026 20:59:06 +0000 Subject: [PATCH] fix: correct host_db_path import and stale-check test expectations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - config_store.py imported host_db_path from supervise_types (wrong); it lives in paths.py, matching all other stores (audit, queue, etc.) - test_stale_checks: two tests expected check_stale called twice (agent + sidecar) — consolidated arch has no sidecar, so once is correct; update assertions and remove unused Path import Co-Authored-By: Claude Sonnet 4.6 --- bot_bottle/config_store.py | 4 ++-- tests/unit/test_stale_checks.py | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/bot_bottle/config_store.py b/bot_bottle/config_store.py index 400f1da..bc2f607 100644 --- a/bot_bottle/config_store.py +++ b/bot_bottle/config_store.py @@ -7,11 +7,11 @@ from pathlib import Path try: from .db_store import DbStore from .migrations import TableMigrations - from .supervise_types import host_db_path + from .paths import host_db_path except ImportError: from db_store import DbStore # type: ignore[import-not-found] # pylint: disable=import-error,no-name-in-module from migrations import TableMigrations # type: ignore[import-not-found] # pylint: disable=import-error,no-name-in-module - from supervise_types import host_db_path # type: ignore[import-not-found] # pylint: disable=import-error,no-name-in-module + from paths import host_db_path # type: ignore[import-not-found] # pylint: disable=import-error,no-name-in-module DEFAULT_CACHED_IMAGE_STALE_WARNING_DAYS = 1 diff --git a/tests/unit/test_stale_checks.py b/tests/unit/test_stale_checks.py index 06860d6..d1efcf1 100644 --- a/tests/unit/test_stale_checks.py +++ b/tests/unit/test_stale_checks.py @@ -7,7 +7,6 @@ calls are mocked at the module boundary.""" from __future__ import annotations import unittest -from pathlib import Path from types import SimpleNamespace from typing import Any, cast from unittest.mock import MagicMock, patch @@ -94,17 +93,18 @@ class TestDockerStaleChecks(unittest.TestCase): cs.assert_called_once() self.assertIn("committed:latest", cs.call_args.args[0]) - def test_no_committed_image_checks_agent_and_sidecar(self) -> None: + def test_no_committed_image_checks_agent(self) -> None: from bot_bottle.backend.docker import launch as mod from datetime import datetime, timezone ts = datetime(2025, 1, 1, tzinfo=timezone.utc) + plan = self._plan() with patch.object(mod, "read_committed_image", return_value=""), \ patch.object(mod.docker_mod, "image_exists", return_value=True), \ patch.object(mod.docker_mod, "image_created_at", return_value=ts), \ patch.object(mod, "check_stale") as cs: - mod.stale_checks(self._plan()) - # Should have been called for both agent and sidecar images. - self.assertEqual(2, cs.call_count) + mod.stale_checks(plan) + cs.assert_called_once() + self.assertIn(plan.image, cs.call_args.args[0]) def test_image_not_present_skips_check(self) -> None: from bot_bottle.backend.docker import launch as mod @@ -173,16 +173,18 @@ class TestMacosContainerStaleChecks(unittest.TestCase): cs.assert_called_once() self.assertIn("committed:latest", cs.call_args.args[0]) - def test_no_committed_image_checks_agent_and_sidecar(self) -> None: + def test_no_committed_image_checks_agent(self) -> None: from bot_bottle.backend.macos_container import launch as mod from datetime import datetime, timezone ts = datetime(2025, 1, 1, tzinfo=timezone.utc) + plan = self._plan() with patch.object(mod, "read_committed_image", return_value=""), \ patch.object(mod.container_mod, "image_exists", return_value=True), \ patch.object(mod.container_mod, "image_created_at", return_value=ts), \ patch.object(mod, "check_stale") as cs: - mod.stale_checks(self._plan()) - self.assertEqual(2, cs.call_count) + mod.stale_checks(plan) + cs.assert_called_once() + self.assertIn(plan.image, cs.call_args.args[0]) def test_image_not_present_skips_check(self) -> None: from bot_bottle.backend.macos_container import launch as mod