Replace silent BaseException swallowing in Docker teardown with structured warning #165

Merged
didericis merged 1 commits from fix/issue-156-teardown-warning into main 2026-06-03 00:29:21 -04:00
Collaborator

Closes #156.

Summary

  • bot_bottle/backend/docker/launch.py: replace except BaseException: pass in the teardown closure with a warn() call (imported from bot_bottle.log) that surfaces the container name and operation type ("compose-down") at WARNING level — non-blocking, exception is consumed so the caller's error-propagation contract is unchanged.
  • tests/unit/test_docker_launch_teardown.py: new test that mocks the full launch stack, injects a RuntimeError via compose_down, and asserts the emitted warning contains both the container name and operation label.

Changes (1 commit)

  • 9282bce fix: emit WARNING when Docker teardown ExitStack raises (issue #156)
Closes #156. ## Summary - `bot_bottle/backend/docker/launch.py`: replace `except BaseException: pass` in the `teardown` closure with a `warn()` call (imported from `bot_bottle.log`) that surfaces the container name and operation type ("compose-down") at WARNING level — non-blocking, exception is consumed so the caller's error-propagation contract is unchanged. - `tests/unit/test_docker_launch_teardown.py`: new test that mocks the full launch stack, injects a `RuntimeError` via `compose_down`, and asserts the emitted warning contains both the container name and operation label. ## Changes (1 commit) - [`9282bce`](https://gitea.dideric.is/didericis/bot-bottle/src/commit/9282bceaf886efbb5052275822ade4c954a85f1e/bot_bottle/backend/docker/launch.py) fix: emit WARNING when Docker teardown ExitStack raises (issue #156)
didericis-claude added 1 commit 2026-06-03 00:20:11 -04:00
fix: emit WARNING when Docker teardown ExitStack raises (issue #156)
test / unit (pull_request) Successful in 37s
test / integration (pull_request) Successful in 40s
test / unit (push) Successful in 32s
test / integration (push) Successful in 43s
9282bceaf8
Replace the bare `except BaseException: pass` in the `teardown` closure
with a `warn()` call that includes the container name and operation type
("compose-down"), so cleanup failures are visible in the log rather than
silently discarded.  Non-blocking: the exception is consumed and teardown
continues, preserving the original error-propagation contract.

Add test_docker_launch_teardown.py to lock the new behaviour: it injects
a RuntimeError via a mocked `compose_down` callback and asserts the
WARNING message contains the container name and operation label.
didericis approved these changes 2026-06-03 00:29:15 -04:00
didericis merged commit 9282bceaf8 into main 2026-06-03 00:29:21 -04:00
didericis deleted branch fix/issue-156-teardown-warning 2026-06-03 00:29:22 -04:00
Sign in to join this conversation.