The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(compression): recurse into control-flow stmts in AST walker
dsadad6df5eb95b1
diff --git a/tests/gateway/test_compression_session_id_persistence.py b/tests/gateway/test_compression_session_id_persistence.pyindex 2d5bb941320..f3468cadff3 100644--- a/tests/gateway/test_compression_session_id_persistence.py+++ b/tests/gateway/test_compression_session_id_persistence.py@@ -67,6 +67,13 @@ def _session_id_assignments_followed_by_save(source: str) -> list[tuple[int, boofor i, stmt in enumerate(body):if self._is_session_id_assign(stmt):results.append((stmt.lineno, self._block_has_save_after(body, i)))+ # Recurse into the stmt itself when it is a control-flow node+ # whose body/orelse/finalbody may carry assignments that are+ # not also reachable as iter_child_nodes children of the stmt+ # (e.g. an ``else`` block whose statements are all assigns).+ if isinstance(stmt, (ast.If, ast.For, ast.While, ast.With,+ ast.Try, ast.AsyncWith, ast.AsyncFor)):+ self._walk_node(stmt)for child in ast.iter_child_nodes(stmt):if isinstance(child, (ast.If, ast.For, ast.While, ast.With,ast.Try, ast.AsyncWith, ast.AsyncFor)):