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
Separate DiskGraph seed scheduling from batch sampling - #427
Seed selection currently lives inside the graph-backed batch iterator, so callers cannot schedule explicit seed batches independently of opening the graph. This separates scheduling into a metadata-only SeedSchedule and adds sample_request(ids) for sampling canonical stage/RHS IDs without advancing the iterator cursor.
Summary
Reuse the same scheduler and sampling operation for local iteration and explicit requests, including selected, weighted, timestamp-grouped, and RHS modes.
Preserve configured neighborhood/history output and the existing length-planning API when rebasing onto current main.
Add native and Python parity/validation tests and document the low-level schedule contract. This is the sampling-API foundation of the Ray Core split; artifact distribution is handled separately.
Python bindings: 7 new explicit-request/schedule tests and 45 existing iterator regressions passed against the rebuilt wheel.
Ruff, mypy, lockfile verification, and git diff --check passed. Changed Rust sections were formatted with Rustfmt 1.99.1; a workspace-wide format check also reports pre-existing formatting differences outside these changes.
Python tests emitted configuration warnings for optional pytest plugins absent from the local environment; no tests were skipped.
No actionable comments were generated in the recent review.
Walkthrough
The runtime now separates seed selection from graph sampling through SeedSchedule and sample_request. Explicit requests validate seed count and stage or RHS membership without advancing the iterator cursor. The Python binding exposes the schedule and request APIs, and shares batch conversion for explicit requests and iterator batches, including configured neighborhoods and history. Tests cover schedule modes, request replay, cursor behavior, validation errors, and construction without a graph index.
This change separates seed scheduling from batch sampling and exposes both through the Python binding. Earlier concerns about validation, documentation and GIL handling appear to be addressed in the current head. One minor test-strength gap remains: the RHS drop-last test may not assert the two full batches. It is low risk and can be handled as a follow-up.
Security architecture risk: Minimal · up to 96b98
The new APIs separate scheduling from sampling without an observed increase in data-access authority. Explicit requests remain bound to the opened graph and configured stage or RHS domain, and do not advance the iterator cursor.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The inspected explicit-request surface allows selection across the configured stage table or RHS candidate domain, not merely the next worker-scheduled batch. Its authority remains that of the existing opened reader and engine; worker sharding and selected-ID lists are scheduling controls, not enforced request authorization boundaries.
Trust Boundaries and Controls
observed — Caller-supplied IDs are checked for request size and stage-table membership or the configured RHS type's range before sampling. Accepted requests reuse the iterator's graph context, sampling flags, feature projection, and pseudo-time filter rather than accepting a replacement graph or policy in the request.
Resilience and Maintainability Implications
observed — Explicit requests do not mutate the seed cursor. The Python tests assert repeated-request parity, unchanged iteration after rejected requests, and sampling after exhaustion. Identical output is not universally promised: unseeded randomized sampling may produce fresh results.
observed — Grouped scheduling is consuming rather than transactional: bucket position advances before selected IDs are checked against stage ranges, so catching an error and continuing does not retry that batch. The base also advanced bucket selection before downstream sampling; the head adds a runtime range rejection instead of relying only on a debug assertion. This does not establish a newly weakened rollback guarantee.
Pre-merge checks: 2 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Change Map Design Review
The check reviews the PR conversation comment that begins with <!-- kumo-pr-change-map -->. That comment body was not supplied in the review context. The PR description links to it (issuecomment-702…
Provide the body of the <!-- kumo-pr-change-map --> conversation comment (or enable PR comment retrieval) and rerun this check. The reviewer should then confirm that the map states the observed failure or requirement, the inspected existi…
Passed checks: 2 passed
Check name
Status
Explanation
Pr Size
The PR size check fails only when the changed-file count exceeds 40. git diff --name-status refs/coderabbit/pre-merge-check/base refs/coderabbit/pre-merge-check/head lists 7 changed files: 2 modifie…
Public Resource Access
The check applies only to external resource references whose text this PR adds or modifies. I ran the changed-file inventory for the reviewed range (7 files: __init__.py, seed_schedule.py, `test_s…
Full details: Pr Size
Explanation
The PR size check fails only when the changed-file count exceeds 40. git diff --name-status refs/coderabbit/pre-merge-check/base refs/coderabbit/pre-merge-check/head lists 7 changed files: 2 modified and 2 added under packages/diskgraph/diskgraph-pybind (__init__.py, seed_schedule.py, test_stateless_sampling.py, runtime_batch_iterator.rs), plus README.md, lib.rs, and sampling_tests.rs under packages/diskgraph/diskgraph-runtime. The count is 7, which is 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 applies only to external resource references whose text this PR adds or modifies. I ran the changed-file inventory for the reviewed range (7 files: __init__.py, seed_schedule.py, test_stateless_sampling.py, runtime_batch_iterator.rs, diskgraph-runtime/README.md, lib.rs, sampling_tests.rs). I then searched every added line for URLs (http(s)://, www., common hosting domains), git/SSH sources, package registry and index references, Cargo git = or path = dependencies, and install commands. There were no hits. The only regex match was the local variable ids_path. The README added no markdown or HTML links. No manifest or lockfile changed. The PR description links to a PR comment, but that text is not in the repository diff, so it is outside this check's scope. Because the PR adds no external resource reference, the check passes.
Full details: Change Map Design Review
Explanation
The check reviews the PR conversation comment that begins with <!-- kumo-pr-change-map -->. That comment body was not supplied in the review context. The PR description links to it (issuecomment-7026832365), but no tool here retrieves PR conversation comments. A search of the checkout found the marker only in docs/development/review.md, which describes the required map. The git refs hold the 5 commits and the reviewed diff (7 files: 1 modified in diskgraph-pybind/python/diskgraph/__init__.py, 2 added, 4 modified). None of that is the change map itself. Because the map's rationale, failure statement, rejected alternatives, verification, and stopping condition cannot be read, I cannot judge whether each change is necessary or belongs at its abstraction layer. Missing evidence cannot establish PASS. No code defect is proven either.
Resolution
Provide the body of the <!-- kumo-pr-change-map --> conversation comment (or enable PR comment retrieval) and rerun this check. The reviewer should then confirm that the map states the observed failure or requirement, the inspected existing behavior, the smallest sufficient change for each file, focused verification, and a stopping condition. The reviewer should also check that the map covers material behavior such as the GIL release, the Python PyRef typed config, the read-only getters, and the drop_last and RHS tail behavior.
Finishing Touches
Fix failing CI checks
Commit to this branch
Create a new PR
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.
Seed selection previously required a graph-backed iterator. This PR separates metadata-only scheduling from explicit graph sampling. It provides the native sampling API for the Ray split; Ray execution and artifact distribution follow separately.
Share one typed scheduler initializer between local iteration and standalone scheduling; remove from_json; validate all selected IDs before sharding, grouped membership, RHS ranges, and explicit requests; prevent offset overflow.
Keep scheduling graph-independent and prevent construction or validation drift.
Expose a Rust-owned, read-only configuration class containing the runtime config; accept a typed PyRef without getattr/extract; release the GIL during native work; share neighborhood/history conversion and preserve length planning.
Expose the shared native API without JSON schedule serialization or output-shape changes.
Make the API and its compatibility expectations explicit.
Validation: the Rust-owned configuration follow-up passed 56 focused Python tests against the rebuilt wheel, binding-crate Clippy, Ruff, mypy, documentation validation, and git diff --check. The preceding shared-initializer revision also passed 46 Rust runtime tests and the full Python suite (931 passed, 3 skipped, one CI-excluded benchmark deselected).
2102-2102: Minor · Data Integrity & Integration · Quick win
Validate grouped sidecar IDs against the stage ranges.
With ranges=[[10,12]], a one-row bucket containing ID 999 passes the sidecar length checks. next_seed_ids() returns [999] as a canonical batch, but the paired sample_request() rejects it. Check grouped IDs against the supplied stage ranges before emitting each batch. Return a data error for an out-of-range ID and keep valid buckets unchanged.
2137-2137: Minor · Stability & Availability · Quick win
Subtract the range base before adding the node ID.
A flat schedule with ranges [[0, 0], [u64::MAX, u64::MAX]] accepts both ranges. For the second row, offset and base are both 1. The bounds check passes, but lo + offset - base evaluates u64::MAX + 1 first and panics with overflow checks enabled. Use lo + (offset - base) so the schedule returns u64::MAX and ordinary mappings stay unchanged. (doc.rust-lang.org)
2069-2069: Minor · Functional Correctness · Quick win
Reject a reversed RHS range at construction.
With rhs=true and ranges=[[24,20]], the range contributes zero nodes but passes the one-range check. The schedule reports normal exhaustion instead of rejecting malformed metadata. Require lo <= hi for the RHS range. Keep lo == hi valid for a one-node domain.
Test selected-ID validation with shuffle disabled.
Both invalid selected-ID cases inherit shuffle=true. The constructor rejects that mode combination before it checks stage membership, so these tests pass even if the membership check is removed. Disable shuffle for these cases and assert the selected seed id outside stage table error. Keep [10, 999] to test an invalid ID assigned to the other worker.
72-73: Minor · Functional Correctness · Quick win
Assert that drop_last preserves the two full RHS batches.
These calls discard their results. If selection returns None immediately but worker_batch_count() still returns 2, the drop-last block passes. Assert Some(vec![20, 21]) and Some(vec![22, 23]) before checking exhaustion.
274-275: Minor · Performance & Scalability · Quick win
Release the GIL while constructing the native schedule.
On GIL-enabled Python, a large weighted schedule blocks other Python threads while from_json opens sidecars and generates every epoch draw before retaining the worker’s share. Add a Python<'_> argument and call py.detach around SeedSchedule::from_json. Keep the existing error mapping after the native call. (pyo3.rs)
packages/diskgraph/diskgraph-runtime/README.md: 3
27-27: Minor · Data Integrity & Integration · Quick win
Document the exact stage_key for each mode.
The same seed and epoch do not reproduce local ordering if the caller hashes the wrong name. For example, the Python stage train can resolve to the table train_seeds. Document that flat schedules use the exact stage-table argument passed to the native iterator, weighted and grouped schedules use the namespaced catalog key, and RHS schedules use the RHS node-type name.
41-42: Minor · Functional Correctness · Quick win
Distinguish output parity from deterministic replay.
The same IDs do not always produce identical batches. With negative sampling enabled and neg_rnd_seed=None, the sampler uses thread_rng, so a replay can draw different negatives. State that sample_request() uses the same output fields and configured augmentations as next_batch(), but does not make randomized sampling deterministic.
31-31: Minor · Functional Correctness · Quick win
Document which modes honor drop_last.
With a three-row timestamp bucket and batch_size=2, the grouped schedule returns a one-row tail even when drop_last=true. State that flat and RHS schedules honor drop_last, grouped schedules retain each bucket’s tail, and selected and weighted schedules reject drop_last=true.
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Reviewed both commits through 2417ccc9. No blocking correctness issues found. Separating seed scheduling from graph access fits the runtime boundary; explicit requests share sampling and preserve Python neighborhood/history conversion.
Two nonblocking improvements:
Consolidate scheduler construction.SeedSchedule::from_json duplicates setup and validation from the graph-backed constructor. They already differ: standalone scheduling validates the entire selected-ID list, while local iteration validates only its worker’s IDs. A shared typed initializer would reduce future drift.
Exercise actual random sampling in replay tests. The fixture has four neighbors and fanout four, so replay equality does not test random neighbor truncation. Use a smaller fanout for one case. The existing ingest, cursor, history, and neighborhood tests otherwise provide useful integration coverage.
I found no material comment-quality issues.
Validation: 43 runtime tests and 117 binding Rust tests passed using available Rust 1.96.1 with ARM feature flags. The pinned 1.99.1 toolchain was unavailable. Python integration tests were not rerun because the environment lacks an installed candidate DiskGraph module.
`test_regression_test_summaries_count_every_holdout_row` fails now and
then, because it compares the summary bias with a float32 mean. This PR
computes that mean in float64, as the product code does.
Design discussion or issue: none. Failed runs: [main,
2026-11-16](https://github.com/NVIDIA/kumo-engine/actions/runs/43921255437)
and [#443,
2026-11-20](https://github.com/NVIDIA/kumo-engine/actions/runs/44810912929/job/136547010755).
## Summary
### What changes
The test gets the reference error of each holdout row as `TARGET_PRED -
TARGET`. It now converts both columns to float64 before the subtraction.
No product code changes.
### Why it changes
The bias assertion failed in CI with a relative gap of 1.2e-6 and
2.0e-6. The default tolerance of `pytest.approx` is 1e-6.
| Run | Summary bias (obtained) | Test reference (expected) | Relative
gap |
| --- | --- | --- | --- |
| main push, 2026-11-16 | 0.0019030134 | 0.0019030158 | 1.2e-6 |
| #443, 2026-11-20 | 0.0013620214 | 0.0013620186 | 2.0e-6 |
Both holdout columns are float32. On main, pandas subtracts them in
float32, and numpy averages the result in float32. Positive and negative
errors cancel in the mean. So a small float32 rounding error in each row
becomes a large share of a small bias.
### Before and now
| Step | Main | This PR |
| --- | --- | --- |
| Summary bias in `evaluation_counts` | float64, because `_floats`
converts both columns | The same |
| Reference error in the test | float32 subtraction | float64
subtraction |
| Reference mean in the test | float32 sum | float64 sum |
| Gap between summary bias and reference | Up to 2.0e-6 in CI | 0.0 |
### Why this is better
Thirty local fits of the same graph and query, with data seeds 1 to 30,
gave these results:
| Reference | Fits with a bias gap over 1e-6 | Largest bias gap |
| --- | --- | --- |
| float32 (main) | 2 of 30 | 1.8e-6 |
| float64 (this PR) | 0 of 30 | 0.0 in all 30 |
A fixed float32 frame with 300 rows and a bias of 0.0020 fails with the
main reference, in the same way as CI: `assert 0.0020043918723240493 ==
0.002004397800192237 ± 2.0e-09`. With the new reference, it passes.
### Trade-off
The MAE assertion uses the same `error`. It now compares the float32
`test_mae` metric with an exact float64 mean. In the same 30 fits, its
largest relative gap was 1.2e-7. On main, it was 1.5e-7. Both are far
below 1e-6.
## Change map
See the [change-map
comment](#450 (comment)).
## Testing Done
- `packages/kumo-engine/test/test_fit_summaries.py`: 4 passed. This run
and the 30 fits used main as of #348 (2026-11-16) plus an unrelated
AutoML error-message change, because the local DiskGraph build is older
than #427. The test file and the regression count code did not change
after #348.
- `packages/kumo-core/tests/test_evaluation_counts.py`,
`test_prediction_counts.py`, `test_score_counts.py`,
`test_evaluation_budget.py` and `tests/evaluation` on current main: 135
passed, 8 skipped (no CUDA or MPS).
- flake8 with the repository `setup.cfg`: no findings. yapf: no change
on the changed lines.
- Linux aarch64, Python 3.14, CPU torch 2.12.
## Hotfix Context
Not a hotfix.
## Checklist
- [x] I listed all the **breaking changes** introduced by the PR: none.
- [x] I made sure to **update examples and documentation** with my
changes (if necessary): none needed.
- [x] I have added and modified unit tests required to cover changes
made by this PR.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Seed selection currently lives inside the graph-backed batch iterator, so callers cannot schedule explicit seed batches independently of opening the graph. This separates scheduling into a metadata-only
SeedScheduleand addssample_request(ids)for sampling canonical stage/RHS IDs without advancing the iterator cursor.Summary
Change map
#427 (comment)
Testing Done
scripts/diskgraph verify --python .venv/bin/python --require-pinpassed.RUSTFLAGS="-C target-feature=+aes,+sse2" cargo +1.99.1 test --manifest-path packages/diskgraph/Cargo.toml -p diskgraph-runtime --lib).git diff --checkpassed. Changed Rust sections were formatted with Rustfmt 1.99.1; a workspace-wide format check also reports pre-existing formatting differences outside these changes.Python tests emitted configuration warnings for optional pytest plugins absent from the local environment; no tests were skipped.