Skip to content

Commit e3bcb56

Browse files
committed
fix: address code review issues #9#19
- Fix _lock_fd type annotation (int -> IO[str]) and lock file open mode (w -> a) - SQLite thread-safety: per-thread connections via threading.local() - BFS frontier chunking to respect SQLite variable limit (999) - Atomic build/sync with SAVEPOINT per-file error isolation - Upgrade _release_file_lock failure log from debug to warning - Document fast_walk DFS order (not BFS) in docstring
1 parent 4f72c4f commit e3bcb56

2 files changed

Lines changed: 203 additions & 93 deletions

File tree

src/impactguard/_ast_cache.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ def fast_walk(tree: ast.Module) -> list[ast.AST]:
6868
When the optional ``fast-walk`` Rust extension is installed, delegates
6969
to its CPython-inline traversal (~30x faster). Otherwise falls back
7070
to a pure-Python implementation (~1.5x faster than stdlib).
71+
72+
.. note::
73+
74+
**Order is DFS, not BFS** — do not depend on parent-before-child
75+
ordering. ``ast.walk()`` is BFS; this function is stack-based DFS
76+
(reversed). The set of visited nodes is identical, but the
77+
iteration order differs. Current consumers (``extract_signatures``,
78+
``class_hierarchy``, ``call_graph``) are order-independent.
7179
"""
7280
if _WALK_BACKEND == "rust":
7381
return _fast_walk_impl(tree)

0 commit comments

Comments
 (0)