From 98fb33cd76ec7a3a5b63d603d5d693d309327b95 Mon Sep 17 00:00:00 2001 From: Dmitry Teryaev Date: Mon, 8 Jun 2026 16:41:46 +0300 Subject: [PATCH] fix: create .graph_hashes.json after init/reprocess so first increment is fast Move _init_hash_tracker() call into write_kuzu() so that init and reprocess commands persist file hashes alongside the graph. Previously the first increment after init/reprocess treated all files as new, causing an unnecessary full rebuild. Closes #297 Co-Authored-By: Claude Opus 4.7 --- build_ast_graph.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/build_ast_graph.py b/build_ast_graph.py index f83787f6..50b87cf6 100644 --- a/build_ast_graph.py +++ b/build_ast_graph.py @@ -3422,12 +3422,10 @@ def incremental_rebuild( pass6_match_edges(tables, verbose=verbose) write_kuzu(kuzu_path, tables, source_root=source_root, verbose=verbose) - n_files = _init_hash_tracker(source_root, kuzu_path) - return IncrementalResult( mode="full_fallback", files_changed=0, - files_added=n_files, + files_added=0, files_removed=0, dependents_reprocessed=0, elapsed_sec=time.time() - t_start, @@ -3648,12 +3646,10 @@ def _fallback_to_full(source_root: Path, kuzu_path: Path, verbose: bool, t_start pass6_match_edges(tables, verbose=verbose) write_kuzu(kuzu_path, tables, source_root=source_root, verbose=verbose) - n_files = _init_hash_tracker(source_root, kuzu_path) - return IncrementalResult( mode="full_fallback", files_changed=0, - files_added=n_files, + files_added=0, files_removed=0, dependents_reprocessed=0, elapsed_sec=time.time() - t_start, @@ -3785,6 +3781,7 @@ def write_kuzu( _verbose_stderr_line(f"[graph] writing ยท routes/exposes written in {time.time() - t2:.2f}s") _write_meta(conn, tables, source_root) conn.close() + _init_hash_tracker(source_root, db_path) # ---------- CLI ----------