From d061642cfc0bda7b5903ae00af952c3feb70c76b Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Thu, 30 Apr 2026 16:39:45 -0700 Subject: [PATCH] test(inbox): bind side-effecting pop() before assert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CodeQL flagged the bare `assert state.pop(...) is None` — under `python -O` asserts are stripped, which would skip the call entirely and the test would silently pass without exercising the code. Bind the result first so the call always runs. Co-Authored-By: Claude Opus 4.7 (1M context) --- workspace/tests/test_inbox.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/workspace/tests/test_inbox.py b/workspace/tests/test_inbox.py index 18dbb798..03bcf8a4 100644 --- a/workspace/tests/test_inbox.py +++ b/workspace/tests/test_inbox.py @@ -182,7 +182,10 @@ def test_pop_removes_specific_message(state: inbox.InboxState): def test_pop_missing_id_returns_none(state: inbox.InboxState): state.record(_msg("a")) - assert state.pop("does-not-exist") is None + # Bind the result before asserting so the call still runs under + # ``python -O`` (which strips bare assert statements). + result = state.pop("does-not-exist") + assert result is None # Original message still present assert len(state.peek(10)) == 1