refactor(manifest): raise ManifestError instead of die()
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:
@@ -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()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user