refactor(manifest): raise ManifestError instead of die()
test / unit (pull_request) Successful in 36s
test / integration (pull_request) Successful in 59s

Review feedback on #102: a manifest that can't be read should raise an
exception, not call die() (a SystemExit). That SystemExit was the whole
reason the dashboard had to special-case Die.

manifest.py now raises ManifestError (a plain Exception) for every
validation failure. The CLI dispatcher catches it and prints+exits 1
(same UX as before); the dashboard catches it with a normal
`except ManifestError` and degrades to a status-line warning. Manifest
tests assert on ManifestError + its message.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-29 00:15:15 -04:00
parent 99ec267c74
commit 847baa84be
10 changed files with 188 additions and 202 deletions
+6 -7
View File
@@ -11,8 +11,7 @@ import textwrap
import unittest
from pathlib import Path
from bot_bottle.log import Die
from bot_bottle.manifest import Manifest
from bot_bottle.manifest import ManifestError, Manifest
def _write(p: Path, text: str) -> None:
@@ -238,7 +237,7 @@ class TestUnknownAgentKeyDies(_ResolveCase):
...
""",
)
with self.assertRaises(Die):
with self.assertRaises(ManifestError):
self.resolve()
@@ -257,7 +256,7 @@ class TestUnknownBottleKeyDies(_ResolveCase):
""",
)
_write(self.home_cb / "agents" / "implementer.md", _AGENT_IMPL)
with self.assertRaises(Die):
with self.assertRaises(ManifestError):
self.resolve()
@@ -268,7 +267,7 @@ class TestStaleJsonDies(_ResolveCase):
def test_dies(self):
(self.home_root / "bot-bottle.json").write_text('{"bottles": {}}')
with self.assertRaises(Die):
with self.assertRaises(ManifestError):
self.resolve()
@@ -277,7 +276,7 @@ class TestNoManifestDies(_ResolveCase):
pointer at the new layout."""
def test_dies(self):
with self.assertRaises(Die):
with self.assertRaises(ManifestError):
self.resolve()
def test_missing_ok_returns_empty_manifest(self):
@@ -300,7 +299,7 @@ class TestUnknownBottleReferenceDies(_ResolveCase):
---
""",
)
with self.assertRaises(Die):
with self.assertRaises(ManifestError):
self.resolve()