fix(dashboard): tolerate missing manifest
test / unit (pull_request) Successful in 25s
test / integration (pull_request) Successful in 44s

This commit is contained in:
2026-05-28 18:44:42 -04:00
parent 7f3998e79e
commit c4449001d1
4 changed files with 36 additions and 5 deletions
@@ -5,6 +5,7 @@ from __future__ import annotations
import tempfile
import unittest
from pathlib import Path
from unittest import mock
from bot_bottle import supervise
from bot_bottle.cli import dashboard
@@ -144,6 +145,18 @@ class TestFilterAgents(unittest.TestCase):
self.assertEqual(["beta", "echo"], out)
class TestDashboardManifestLoading(unittest.TestCase):
def test_new_agent_flow_empty_manifest_has_no_picker_entries(self):
manifest = dashboard.Manifest.from_json_obj({"bottles": {}, "agents": {}})
with mock.patch("bot_bottle.cli.dashboard._picker_modal", return_value=None) as picker:
status = dashboard._new_agent_flow(
None, manifest, {}, [], tmux_state=None, # type: ignore[arg-type]
)
picker.assert_called_once()
self.assertEqual([], picker.call_args.args[1])
self.assertIn("no agents configured", status)
class TestRunningCounts(unittest.TestCase):
"""Per-agent running-count surfaced in the picker so the
operator sees `(N running)` before picking. Counts come from
+5
View File
@@ -280,6 +280,11 @@ class TestNoManifestDies(_ResolveCase):
with self.assertRaises(Die):
self.resolve()
def test_missing_ok_returns_empty_manifest(self):
m = Manifest.resolve(str(self.cwd_root), missing_ok=True)
self.assertEqual({}, dict(m.bottles))
self.assertEqual({}, dict(m.agents))
class TestUnknownBottleReferenceDies(_ResolveCase):
"""An agent file naming a bottle that doesn't exist on disk