Skip to content

fix: batch fix 3 bugs - exclude filter, progress feedback, KuzuDB cleanup#1

Closed
MorningStar0709 wants to merge 1 commit into
mainfrom
fix/dead-code-exclude-and-bugs
Closed

fix: batch fix 3 bugs - exclude filter, progress feedback, KuzuDB cleanup#1
MorningStar0709 wants to merge 1 commit into
mainfrom
fix/dead-code-exclude-and-bugs

Conversation

@MorningStar0709

Copy link
Copy Markdown
Owner

Summary

Batch fix of 3 known CGC bugs identified during tool evaluation.

1. --exclude flag not filtering decorations

Root cause: The Cypher query ALL(decorator_name IN $exclude WHERE NOT decorator_name IN func.decorators) performs exact matching. The database stores full decorator strings like @router.get("/path"), so passing router as filter never matches.

Fix: Replaced with NOT ANY(d IN func.decorators WHERE d CONTAINS 'router') substring matching. KuzuDB does not support Cypher parameters inside nested ANY(), so conditions are generated inline in Python with proper escaping.

Verification: Direct Cypher query confirmed 237 -> 226 results, correctly filtering the 11 functions with matching decorators.

2. Index progress hangs at perceived 100%

Root cause: After file parsing, the post-processing phase (inheritance resolution, function calls, Spring injection, ORM, MyBatis, etc.) runs with no progress updates. Users see 100% stuck and assume the tool is hung.

Fix: Each post-processing stage now calls job_manager.update_job(job_id, status_message=...). The progress bar display prioritizes current_file > status_message > empty string.

Verification: Indexed the CGC core module (30+ files) and observed all 8 status_message updates in the live output.

3. KuzuDB lock file not released

Root cause: close_driver() only drained the connection pool and set _db = None. Connections were never explicitly closed, and garbage collection was not forced, leaving lock files on disk.

Fix: Iterate the pool and call conn.close() on each connection, set _pool = None, trigger gc.collect(). Added with self._lock guard to prevent race conditions.

Verification: Code review confirmed thread safety. Unit tests pass (no regression).

Changed Files

File Change
code_finder.py Cypher filter rewrite 8+/4-
pipeline.py Status messages for 8 + 2 optional post-processing stages 20+
jobs.py Added status_message field to JobInfo 1+
cli_helpers.py Progress bar displays status_message 1+/1-
database_kuzu.py Proper resource cleanup in close_driver 19+/9-

Test Results

  • Unit tests: 474 passed, 14 skipped, 7 failed (all pre-existing Windows env constraints, unrelated to changes)
  • --exclude: Verified via direct Cypher query on KuzuDB
  • Progress feedback: Verified via live index of CGC core module
  • close_driver: Code review passed, lock guard added

- 修复 --exclude 参数无效: Cypher ALL 精确匹配改为 NOT ANY CONTAINS 包含匹配,兼容 KuzuDB

- 修复索引后进度无反馈: 后处理 8 个阶段前设置 status_message,进度栏优先显示阶段消息

- 修复 KuzuDB 锁未释放: close_driver 逐个关闭 Connection、销毁 pool 引用、触发 GC 回收
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

🔍 PR Code Graph Analysis

fix: batch fix 3 bugs - exclude filter, progress feedback, KuzuDB cleanup (#1)

📊 Interactive Visualization

View the blast radius graph: PR Reviewer Dashboard

📦 Artifacts

The graph JSON has been uploaded as a build artifact: pr-code-graph-1


Generated by CodeGraphContext using FalkorDB Lite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant