fix: correct host_db_path import and stale-check test expectations
test / integration (pull_request) Successful in 11s
test / unit (pull_request) Successful in 36s
lint / lint (push) Successful in 48s
tracker-policy-pr / check-pr (pull_request) Successful in 6s
test / coverage (pull_request) Successful in 36s

- 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 <noreply@anthropic.com>
This commit is contained in:
2026-07-18 20:59:06 +00:00
committed by didericis
parent 899193f91b
commit 9004f3eb28
2 changed files with 12 additions and 10 deletions
+2 -2
View File
@@ -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
+10 -8
View File
@@ -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