Skip to content

Reconcile graph lifecycle changes safely - #735

Closed
marlon-costa-dc wants to merge 5 commits into
tirth8205:mainfrom
marlon-costa-dc:agent/code-review-graph-199f-lifecycle
Closed

Reconcile graph lifecycle changes safely#735
marlon-costa-dc wants to merge 5 commits into
tirth8205:mainfrom
marlon-costa-dc:agent/code-review-graph-199f-lifecycle

Conversation

@marlon-costa-dc

Copy link
Copy Markdown

Summary

  • distinguish file replacement from permanent deletion so incoming cross-file edges survive reparses while deleted-node references and only their embeddings are removed
  • centralize stale-file reconciliation for full builds, empty incremental updates, and watch startup
  • serialize/coalesce file and directory create/delete/move events with watchdog EventDebouncer, reject symlinks, and fail closed when updates or post-processing fail

Runtime motivation

Watch mode previously missed offline and directory lifecycle changes, used one Timer per event, and swallowed callback failures. That could leave stale graph data or keep a failed watcher alive under systemd.

Validation

  • RED on detached upstream 6ce25b4 with copied regression tests: collection failed because _create_watch_handler did not exist
  • UV_PROJECT_ENVIRONMENT=.venv-crg uv run pytest tests/test_graph.py tests/test_incremental.py tests/test_postprocessing.py --tb=short -q: 153 passed
  • full UV_PROJECT_ENVIRONMENT=.venv-crg uv run pytest tests/ --tb=short -q: 1972 passed, 3 unrelated pre-existing failures, 5 skipped, 2 xpassed
  • UV_PROJECT_ENVIRONMENT=.venv-crg uv run ruff check code_review_graph/graph.py code_review_graph/incremental.py tests/test_graph.py tests/test_incremental.py: passed
  • repository-wide Ruff reports 39 pre-existing findings in unrelated tests
  • repository-wide Mypy reports one pre-existing Google embeddings typing error in code_review_graph/embeddings.py
  • real CLI fixture: built, watched, created a directory descendant, moved the directory, deleted the original directory, verified status --json had one Python file, then Ctrl-C produced Watch stopped. and fixture teardown completed

Non-overlap

This PR does not overlap #686, #729, or #694: it is limited to graph-store permanent deletion semantics and watch lifecycle reconciliation/debounce/fail-closed behavior. It deliberately excludes fork hot-path optimizations and BLAS/OpenMP environment tuning.

tirth8205 added a commit that referenced this pull request Jul 27, 2026
fix(watch): reconcile graph lifecycle changes safely (#735)
@tirth8205

Copy link
Copy Markdown
Owner

Validated and incorporated through #758, merged as 38e2b31. All five Marlon Costa contributor commits are preserved in the integration history. The corrected version also preserves live untracked graph files and fails closed on incomplete updates and startup post-processing errors. Validation passed 399 focused tests, real process-pool parity, Ruff, diff checks, a full graph/post-process build, CodeQL, Python 3.10–3.13, and Windows. Closing this original PR because its corrected form is now on main.

@tirth8205 tirth8205 closed this Jul 27, 2026
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.

3 participants