Skip to content

Notifying GraphArrayView of the graph change#263

Draft
yfukai wants to merge 1 commit intoroyerlab:mainfrom
yfukai:gav_notified
Draft

Notifying GraphArrayView of the graph change#263
yfukai wants to merge 1 commit intoroyerlab:mainfrom
yfukai:gav_notified

Conversation

@yfukai
Copy link
Contributor

@yfukai yfukai commented Feb 17, 2026

This is an attempt to solve #202.

@yfukai
Copy link
Contributor Author

yfukai commented Feb 17, 2026

I just started with Codex. I'll check the update and later.

Implemented. GraphArrayView now listens to graph mutations and invalidates cache entries instead of serving stale chunks.

What changed

  • Added cache invalidation API to chunk cache:
    • NDChunkCache.clear() and NDChunkCache.invalidate(...) in src/tracksdata/array/_nd_chunk_cache.py:164.
  • Wired GraphArrayView to graph signals and region invalidation:
    • signal hookups in src/tracksdata/array/_graph_array.py:203
    • mutation handlers + bbox/time-based invalidation in src/tracksdata/array/_graph_array.py:358
  • Added node-attribute update signal to base graph:
    • node_attrs_updated = Signal(object, object) in src/tracksdata/graph/_base_graph.py:52
  • Emitted node_attrs_updated from all relevant backends (ID-space correct):
    • RustWorkXGraph in src/tracksdata/graph/_rustworkx_graph.py:1236
    • IndexedRXGraph mapping-safe emit in src/tracksdata/graph/_rustworkx_graph.py:1945
    • SQLGraph in src/tracksdata/graph/_sql_graph.py:1758
    • GraphView in src/tracksdata/graph/_graph_view.py:658
  • Updated bbox spatial filter to react to attribute updates affecting spatial indexing:
    • rebuild wiring in src/tracksdata/graph/filters/_spatial_filter.py:232
    • update handler in src/tracksdata/graph/filters/_spatial_filter.py:342

Tests added

  • GraphArrayView mutation-refresh coverage in src/tracksdata/array/_test/test_graph_array.py:383
  • NDChunkCache invalidate/clear coverage in src/tracksdata/array/_test/test_nd_chunk_cache.py:121

Validation run

  • uv run ruff check ... (all modified files) passed
  • uv run pytest src/tracksdata/array/_test/test_nd_chunk_cache.py -q → 16 passed
  • uv run pytest src/tracksdata/array/_test/test_graph_array.py -q → 100 passed
  • uv run pytest src/tracksdata/graph/filters/_test/test_spatial_filter.py -q → 19 passed

@yfukai yfukai mentioned this pull request Feb 17, 2026
6 tasks
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 71.42857% with 46 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.50%. Comparing base (e10d8c3) to head (e0502a6).

Files with missing lines Patch % Lines
src/tracksdata/array/_graph_array.py 56.00% 24 Missing and 9 partials ⚠️
src/tracksdata/array/_nd_chunk_cache.py 78.57% 3 Missing and 3 partials ⚠️
src/tracksdata/graph/_graph_view.py 44.44% 3 Missing and 2 partials ⚠️
src/tracksdata/graph/_sql_graph.py 71.42% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #263      +/-   ##
==========================================
- Coverage   88.18%   87.50%   -0.68%     
==========================================
  Files          56       56              
  Lines        4308     4442     +134     
  Branches      749      776      +27     
==========================================
+ Hits         3799     3887      +88     
- Misses        319      350      +31     
- Partials      190      205      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants