-
Notifications
You must be signed in to change notification settings - Fork 9
feat(runner): Switch scheduler to new storage updates and reactive dependencies #1456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the reactive dependencies system to use a new storage notifications API instead of per-document update callbacks. The change improves efficiency by centralizing change handling and provides better path-based change detection.
- Replace document.updates() callbacks with centralized IStorageSubscription notifications
- Migrate from individual document subscriptions to unified change tracking via addresssesToPathByEntity()
- Update path comparison logic to use arraysOverlap() function for more accurate dependency matching
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/runner/test/schema.test.ts | Update import to use sortAndCompactPaths from reactive-dependencies |
| packages/runner/test/scheduler.test.ts | Remove compactifyPaths tests and update imports |
| packages/runner/test/reactive-dependencies.test.ts | Add comprehensive tests for new utility functions and edge cases |
| packages/runner/src/storage/interface.ts | Change MemoryAddressPathComponent from string | number to string only |
| packages/runner/src/scheduler.ts | Replace per-document callbacks with centralized storage subscription handling |
| packages/runner/src/reactive-dependencies.ts | Add new utility functions and improve path overlap detection |
| packages/runner/src/query-result-proxy.ts | Convert numeric indices to strings for path consistency |
Copilot
AI
Jul 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function name has a typo: 'addresssesToPathByEntity' should be 'addressesToPathByEntity' (extra 's')
| addresssesToPathByEntity, | |
| addressesToPathByEntity, |
…ress Update sortAndCompactPaths to accept IMemorySpaceAddress objects instead of raw path arrays, enabling proper handling of space, id, and type metadata. Changes: - Update sortAndCompactPaths to work with IMemorySpaceAddress[] - Sort by space, id, type, then path for consistent ordering - Only compact paths within the same space/id/type combination - Add pathsToMapByEntity function to group addresses by space/id - Filter non-JSON types in pathsToMapByEntity - Update all tests to use IMemorySpaceAddress with proper URI/MediaType formats - Add comprehensive tests for pathsToMapByEntity function - Update benchmarks to test new sorting dimensions This enables the scheduler to properly track dependencies across different spaces and entities while maintaining efficient path compaction. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…than some triggering paths
e44e206 to
8049aa9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cubic analysis
1 issue found across 7 files • Review in cubic
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.
Refactor the scheduler to use the new storage notifications API instead of per-document update callbacks. This provides a more efficient and unified approach to tracking changes across the memory space.
Summary by cubic
Refactored the scheduler to use the new storage notifications API and updated reactive dependency tracking for better efficiency and accuracy across memory spaces.