Skip to content

add symmetric delete helpers for incremental kuzu rebuild (PR-T2)#266

Merged
HumanBean17 merged 1 commit into
masterfrom
feat/tier2-pr2-symmetric-delete-helpers
Jun 6, 2026
Merged

add symmetric delete helpers for incremental kuzu rebuild (PR-T2)#266
HumanBean17 merged 1 commit into
masterfrom
feat/tier2-pr2-symmetric-delete-helpers

Conversation

@HumanBean17

Copy link
Copy Markdown
Owner

Summary

  • Add 12 delete_*_for_file helpers to build_ast_graph.py that delete nodes/edges keyed by source file path
  • Add delete_all_for_file composite that calls all helpers in correct dependency order, returns {helper_name: count} dict
  • Each helper takes (conn: kuzu.Connection, file_path: str) -> int and returns deleted row count
  • 20 tests in tests/test_symmetric_delete.py covering each helper, cascade semantics, idempotency, and unknown-file edge case

Design notes

The plan assumed "Kuzu does not cascade rel-table deletes". In practice, Kuzu raises RuntimeError when deleting a node that has connected edges. So delete_symbols_for_file must be comprehensive — it deletes ALL edge types connected to symbols in the file (both FROM and TO directions) before deleting Symbol nodes. Similarly, delete_routes_for_file, delete_clients_for_file, and delete_producers_for_file clean up their incoming edges first.

Individual edge helpers (extends, implements, injects, calls, overrides) are source-only — they delete edges where the source symbol is in the file. This matches the pass emission model (each pass associates edges with a source file). Cross-file target-side edges are handled by delete_symbols_for_file's comprehensive cleanup and by PR-T3's closure expansion.

Implements PR-T2 from plans/active/PLAN-TIER2-INCREMENTAL-REBUILD.md.

Test plan

  • All 20 symmetric delete tests pass
  • Full test suite passes (625 passed, 9 skipped)
  • ruff check . clean

🤖 Generated with Claude Code

12 delete_*_for_file helpers + delete_all_for_file composite that
delete nodes/edges keyed by source file. Each helper returns deleted
row count. Kuzu enforces that nodes with connected edges cannot be
deleted, so delete_symbols_for_file is comprehensive (cleans all
edge types in both directions before deleting Symbol nodes).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@HumanBean17 HumanBean17 merged commit 2339cc8 into master Jun 6, 2026
1 check passed
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