You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support inclusive/exclusive temporal graph sampling - #400
Add GraphSample(..., cutoff="exclusive") and the matching build.Hop option. The default remains inclusive. Each traversal filters candidates before fanout using the unchanged request timestamp.
DiskGraph reuses its existing binary search and sampling loop through temporal_most_recent_exclusive; no Python filtering or timestamp adjustment is added. Existing native modes and their serialized variant numbers remain unchanged.
Rebuilt the native extension and ingest binary from this branch (Apple M5 Pro, macOS arm64, Rust 1.99.1, Python 3.12, PyArrow 24).
173 graph tests passed, including 49 new cases covering both engines, default/inclusive/exclusive and mixed policies, fanout 1/10, two hops, multiple requests, unchanged cutoffs and native s/ms/us/ns precision.
75 existing contract, authoring, temporal and API-reference tests passed.
Ruff and repository documentation checks passed.
Regenerated the H&M saved contract (two inclusive defaults); its notebook drift test passed (pytest tests/test_notebooks.py -m notebook -k hm-recommendation).
Four native Rust temporal tests passed (cargo test --release -p diskgraph-engine --lib temporal).
CPU, warm index: 1,082,368 synthetic tree nodes (degree 32), 1,024 requests, nanosecond clocks, and equal sampled-node counts for both policies. Compared main cce65cec with PR 35c1bbf8 using separately built native binaries and the same index. Five fresh processes per variant/thread count, rotating variant order; each process uses two warmups, 20 native calls and five full model-batch iterations. Values are medians of process medians in milliseconds per 1,024 requests. Each cell is native sampling / full model batches (batch size 256, one raw numeric node feature). Preparation, ingestion and validation are excluded. Apple M5 Pro, macOS arm64, Rust 1.99.1, Python 3.12, PyArrow 24; PyTorch uses one thread.
Native threads
Hops
Fanout
Main inclusive
PR inclusive
PR exclusive
1
1
1
0.268 / 5.060
0.261 / 4.882
0.266 / 4.913
1
1
10
0.649 / 6.998
0.634 / 6.754
0.652 / 7.343
1
2
1
0.437 / 5.459
0.448 / 5.394
0.446 / 5.437
1
2
10
6.476 / 40.546
6.416 / 41.095
6.490 / 41.361
4
1
1
0.227 / 5.139
0.214 / 4.973
0.216 / 5.325
4
1
10
0.552 / 7.159
0.549 / 6.815
0.553 / 7.189
4
2
1
0.354 / 5.359
0.360 / 5.543
0.346 / 5.633
4
2
10
4.588 / 33.562
4.465 / 34.636
4.716 / 34.066
Inclusive graph outputs match main exactly in every trial. Exclusive outputs pass boundary, fanout, edge-count and unchanged-timestamp checks. These are sampling/batch-generation measurements, not training or cold-storage benchmarks.
For two hops/fanout 10 with four threads, process-median model-batch ranges were main-inclusive: 32.11–33.83 ms; pr-inclusive: 30.66–36.16 ms; pr-exclusive: 33.09–35.53 ms. The small median differences overlap these run-to-run ranges.
Issue #335 requests strictly earlier graph history; existing sampling includes events exactly at the request timestamp. This adds one traversal option and reuses DiskGraph's range seek before fanout. Scope stops at graph sampling; request timestamps, row windows and workloads are unchanged. Validation: 249 Python tests (including the H&M notebook) and four Rust temporal tests passed. Inclusive/exclusive benchmark results are in the PR description.
No actionable comments were generated in the recent review.
Walkthrough
Temporal graph sampling now supports inclusive and exclusive cutoffs. Inclusive remains the default; exclusive admits only events earlier than the request timestamp. Both engines apply the cutoff before fanout and retain the request timestamp across hops. The GraphSample contract rejects unsupported cutoff values. Tests cover both engines and cutoff boundaries.
Sequence Diagram(s)
sequenceDiagram
participant GraphSample
participant DiskGraphSource
participant DiskGraphEngine
participant InMemoryGraphSampler
GraphSample->>DiskGraphSource: provide cutoff
DiskGraphSource->>DiskGraphEngine: select temporal sampling mode
DiskGraphEngine->>DiskGraphEngine: filter eligible edges before fanout
GraphSample->>InMemoryGraphSampler: provide cutoff
InMemoryGraphSampler->>InMemoryGraphSampler: filter eligible neighbors before fanout
Loading
Merge Risk: Low · up to c1f9b
Exclusive cutoffs need the updated DiskGraph native code. The version declaration does not require it, so a stale external install could fail only when exclusive sampling is used. Default inclusive behavior is unchanged. Bump the DiskGraph version and raise the floor before releasing.
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — packages/experimental (library) was modified; 10 changed files map to changed impact.
observed — packages/diskgraph (library) was modified; 4 changed files map to changed impact.
Before / after behavior
observed — Modified behavior in packages/diskgraph/diskgraph-core/src/sampling.rs: TemporalMostRecent is now specified as inclusive of the seed timestamp, and TemporalMostRecentExclusive is added for strictly earlier edges, filtered before fanout.
observed — Modified behavior in packages/diskgraph/diskgraph-engine/src/engine.rs: The zero-fanout early return now also covers TemporalMostRecentExclusive. The temporal sampling branch handles both most-recent modes and treats an edge as too new when its timestamp is greater than the anchor, or equal when the mode is exclusive.
observed — Modified behavior in packages/diskgraph/diskgraph-engine/src/engine.rs: The sorted-edge prefix advance now skips timestamps equal to the anchor in exclusive mode; inclusive mode continues to skip only timestamps greater than the anchor.
observed — Modified behavior in packages/diskgraph/diskgraph-engine/src/engine.rs: The per-edge temporal check now uses the shared mode-dependent boundary rule, excluding anchor-equal edges only for TemporalMostRecentExclusive.
Pre-merge checks: 2 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Change Map Design Review
The check assesses the PR conversation comment that starts with <!-- kumo-pr-change-map -->. That comment was not supplied to this run. The review-thread context states that no CodeRabbit review thr…
Provide the body of the PR conversation comment that starts with <!-- kumo-pr-change-map --> (the comment linked as "File-by-file rationale", issuecomment-6993239949). Then rerun this check. The review must test that comment's Change ma…
Passed checks: 2 passed
Check name
Status
Explanation
Pr Size
The PR size check counts changed files and fails only above 40. I ran git diff --name-status over the review-scoped range (base cce65cec, head c1f9b5d3). It lists 14 changed files: 13 modified (…
Public Resource Access
The check covers only external resource references (URLs, repository locations, package source locations) that this PR adds or modifies. Evidence: - The PR range (refs/coderabbit/pre-merge-check/base.…
Full details: Pr Size
Explanation
The PR size check counts changed files and fails only above 40. I ran git diff --name-status over the review-scoped range (base cce65cec, head c1f9b5d3). It lists 14 changed files: 13 modified (M) and 1 added (A, packages/experimental/kumo-pytorch/tests/test_graph_cutoff.py). No renames or deletions appear. 14 is at or below the threshold of 40, so the check passes. Line counts were ignored, as the check requires.
Full details: Public Resource Access
Explanation
The check covers only external resource references (URLs, repository locations, package source locations) that this PR adds or modifies. Evidence: - The PR range (refs/coderabbit/pre-merge-check/base..head) changes 14 files: 13 modified and 1 added (packages/experimental/kumo-pytorch/tests/test_graph_cutoff.py). The diff is 264 lines. - I searched every added line in that diff for URL schemes (http/https), www., Markdown link syntax, HTML href, domain-style hosts, git+/git@ sources, package-index options (pip install, cargo, index-url), and absolute or home-relative local paths. No match was found. - The README and docs additions contain only prose and code examples (mode="temporal_most_recent_exclusive", cutoff="exclusive", signature snippets). They add no links. - The added test file and contract.json contain no external references. - The PR description's links and the Fixes #335 reference are outside the repository diff. They are not changed reference text in the PR's files, so they fall outside the check's scope. Because the PR adds or changes no external resource reference, the check passes. No public-access verification was needed.
Full details: Change Map Design Review
Explanation
The check assesses the PR conversation comment that starts with <!-- kumo-pr-change-map -->. That comment was not supplied to this run. The review-thread context states that no CodeRabbit review threads were returned. The PR description links to a rationale comment (#issuecomment-6993239949), but its body is not in the prepared context. A search of the checkout and review-scoped refs found the marker only in docs/development/review.md, which describes the required comment. The search found no copy of the comment itself. The git diff shows the expected 15 changed files. This confirms file coverage only, and the check rules say file coverage does not establish necessity or correctness. I did not assess the change map's necessity, abstraction layer, stopping condition, or verification claims, because its text is unavailable. I made no finding of a design defect. Code evidence from the PR description and objectives is context only. The author reports that inclusive outputs match main and that exclusive mode filters before fanout. I did not verify those claims in this run.
Resolution
Provide the body of the PR conversation comment that starts with <!-- kumo-pr-change-map --> (the comment linked as "File-by-file rationale", issuecomment-6993239949). Then rerun this check. The review must test that comment's Change map against: - the observed failure or requested release requirement (linked issue #335); - the existing behavior in engine.rs, sampling.rs, in_memory/graph.py, and engines/diskgraph.py; - the smallest sufficient change, including whether the new TemporalMostRecentExclusive native variant is needed or could reuse the existing mode with a parameter; - the focused verification and stopping condition. The map must also cover the material behavior that the summary and PR description do not state. Examples are the Hop and GraphSample default, the DiskGraph serialized variant numbering, and whether the inclusive path in in_memory/graph.py still uses <= for all temporal candidates.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
721-721: Minor · Data Integrity & Integration · Quick win
Raise the diskgraph floor to a release that contains cutoff="exclusive".
packages/experimental/kumo-pytorch/pyproject.toml:31 allows diskgraph>=0.2.0. This PR adds the TemporalMostRecentExclusive sampling mode to DiskGraph, but it keeps the package version at 0.2.0. A 0.2.0 build from the base revision does not define that mode. With cutoff="exclusive", the adapter sends "temporal_most_recent_exclusive" (engines/diskgraph.py:2060-2064). The derived Deserialize on SamplingMode rejects a value that matches no variant, so such an install can fail when the exclusive option runs. The default cutoff="inclusive" path is not affected.
Bump the DiskGraph package version in this change. Raise the lower bound at pyproject.toml:31 to that version, so that installs without the exclusive mode are excluded.
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
this would have to propagate to ttgen, sampling, index building all separately, is this really needed @nittin-murthi ? this would need to be tested across benchmarks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #335
Summary
Add
GraphSample(..., cutoff="exclusive")and the matchingbuild.Hopoption. The default remains inclusive. Each traversal filters candidates before fanout using the unchanged request timestamp.DiskGraph reuses its existing binary search and sampling loop through
temporal_most_recent_exclusive; no Python filtering or timestamp adjustment is added. Existing native modes and their serialized variant numbers remain unchanged.Change map
File-by-file rationale
Testing Done
pytest tests/test_notebooks.py -m notebook -k hm-recommendation).cargo test --release -p diskgraph-engine --lib temporal).Benchmark
CPU, warm index: 1,082,368 synthetic tree nodes (degree 32), 1,024 requests, nanosecond clocks, and equal sampled-node counts for both policies. Compared main
cce65cecwith PR35c1bbf8using separately built native binaries and the same index. Five fresh processes per variant/thread count, rotating variant order; each process uses two warmups, 20 native calls and five full model-batch iterations. Values are medians of process medians in milliseconds per 1,024 requests. Each cell is native sampling / full model batches (batch size 256, one raw numeric node feature). Preparation, ingestion and validation are excluded. Apple M5 Pro, macOS arm64, Rust 1.99.1, Python 3.12, PyArrow 24; PyTorch uses one thread.Inclusive graph outputs match main exactly in every trial. Exclusive outputs pass boundary, fanout, edge-count and unchanged-timestamp checks. These are sampling/batch-generation measurements, not training or cold-storage benchmarks.
For two hops/fanout 10 with four threads, process-median model-batch ranges were main-inclusive: 32.11–33.83 ms; pr-inclusive: 30.66–36.16 ms; pr-exclusive: 33.09–35.53 ms. The small median differences overlap these run-to-run ranges.