Skip to content

Commit 3473bb9

Browse files
committed
LCORE-1572: raise instead of assert on the drained compaction result
apply_compaction_blocking asserted that the generator yielded a result. Under python -O asserts are stripped, so the guard would vanish and a None result could propagate to callers. Replace it with an explicit None check that raises RuntimeError. Clears a GitHub code-scanning (CodeQL) "use of assert" finding. The repository's Bandit configuration skips B101, so this only surfaced via code scanning, not the Bandit CI job.
1 parent fae1076 commit 3473bb9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/utils/conversation_compaction.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,8 @@ async def apply_compaction_blocking(
375375
):
376376
if isinstance(item, CompactionResult):
377377
result = item
378-
assert result is not None # the generator always yields exactly one result
378+
if result is None: # pragma: no cover - the generator always yields one result
379+
raise RuntimeError("apply_compaction did not yield a CompactionResult")
379380
return result
380381

381382

0 commit comments

Comments
 (0)