fix(diagnostics): make optional failures observable and safe
test / integration-macos (pull_request) Has been skipped
test / integration-docker (pull_request) Successful in 17s
tracker-policy-pr / check-pr (pull_request) Successful in 7s
test / unit (pull_request) Successful in 54s
lint / lint (push) Failing after 1m5s
test / integration-firecracker (pull_request) Successful in 3m46s
test / coverage (pull_request) Successful in 19s
test / publish-infra (pull_request) Has been skipped

This commit is contained in:
2026-07-26 06:31:38 +00:00
parent cc166f4b67
commit 17052cbf88
12 changed files with 180 additions and 46 deletions
+11
View File
@@ -12,7 +12,9 @@ from bot_bottle.orchestrator.client import (
OrchestratorClient,
OrchestratorClientError,
RegisteredBottle,
BackendProbeFailure,
_host_auth_token,
_probe_failure,
)
_URLOPEN = "bot_bottle.orchestrator.client.urllib.request.urlopen"
@@ -33,6 +35,15 @@ class TestHostAuthToken(unittest.TestCase):
self.assertEqual("", _host_auth_token())
class TestBackendProbeFailure(unittest.TestCase):
def test_records_safe_typed_diagnostic(self) -> None:
with patch("bot_bottle.orchestrator.client.debug") as debug:
result = _probe_failure("firecracker", RuntimeError("secret detail"))
self.assertEqual(BackendProbeFailure("firecracker", "RuntimeError"), result)
rendered = repr(debug.call_args)
self.assertNotIn("secret detail", rendered)
def _resp(status: int, payload: object) -> MagicMock:
m = MagicMock()
inner = m.__enter__.return_value