Skip to content

Directory deletion not cascading to child file records in index #1285

Description

@huicheng-sys

Summary

When a subdirectory containing source files is deleted from the project, CodeGraph fails to detect the change and does not update the SQLite index. The deleted files remain in the database, and index counts (files, nodes, edges) stay unchanged.

This appears to be a cascade deletion bug: removing a parent directory does not trigger removal of its child file records from the index.

Reproduction Steps

  1. codegraph init — initialize index
  2. Create nested source file: docs/1/2/新建文件夹/_0204_.py
  3. Wait for CodeGraph to sync (check Last Sync timestamp)
  4. Delete the subdirectory docs/1 (which contains _0204_.py)
  5. Observe: index counts unchanged, deleted file still appears in queries

Attachment: Diagnostic Tool

I built a lightweight real-time monitor (codegraph_state.js) to visualize this bug. It displays live index counts alongside filesystem events, making the mismatch immediately obvious.

Author: feel free to use or adapt this tool for debugging.

codegraph_state.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions