Skip to content

Add index clocks from nanoseconds to days - #123

Merged
Vedaant-J merged 25 commits into
NVIDIA:mainfrom
alan-kumo:fix/native-subsecond-timestamps
Nov 2, 2026
Merged

Vedaant-J merged 25 commits into
NVIDIA:mainfrom
alan-kumo:fix/native-subsecond-timestamps

Conversation

@alan-kumo

@alan-kumo alan-kumo commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds index clocks: a DiskGraph index can store its timestamps in nanoseconds, microseconds, milliseconds, seconds, hours or days. Seconds stays the default, and a seconds index stores exactly the same data as one built on main. The clock changes only the tick that timestamps are stored in and the integer width used to store them; nulls, rounding, truncation, saturation, errors, statistics and prediction output follow main's rules in every clock.

Problem

Teams with event data finer or coarser than one second ask:

  • A prediction is anchored at 12:00:00.500. Why can it miss an event from 12:00:00.300, or see one from 12:00:00.700?
  • Two clicks arrived 300 ms apart in the same second. Why can sampling not tell which one came last?
  • Two anchors 200 ms apart in the same second become training rows with the same anchor. Why do they see the same history?
  • Our tables only carry dates. Can the index store days instead of seconds?

Cause

Every index stores time as epoch seconds. Ingest converts each source timestamp to whole seconds (typed timestamps and integer epochs round up, text truncates), so everything finer than a second is gone before sampling or training-table generation sees it. DatasetMetadata.timestamp_unit exists, but ingest always writes "seconds" and the sampler asserts it.

<index>/
  index_metadata.json        # "timestamp_unit": "seconds", always
  diskgraph_config.json      # no clock setting
  nodes/<table>/shard-*/     # row timestamps: epoch seconds; edge time keys: 32-bit seconds
  col_stats.json             # timestamp min/max as min_secs / max_secs
  kumo_col_stats/            # kumo_timestamp_YYYY-MM-DD HH:MM:SS

Change

Choose the clock when building a snapshot. The default is seconds.

import kumo.engine as kumo
graph = kumo.Graph(tables=..., edges=...)
snapshot = graph.snapshot(timestamp_precision="milliseconds")
# kumo-studio (hosted)
graph.snapshot(timestamp_precision="milliseconds")  # later snapshot() calls, as in fit, keep milliseconds

The index records its clock, and everything that reads it (sampling, training-table generation, statistics, prediction) works in that clock. Kumo calls the setting timestamp_precision; DiskGraph's own files keep their existing timestamp_unit key. A model predicts in the clock it was trained on: kumo-studio's predict snapshots in the training snapshot's clock, also from a new session, kumo-engine rejects a snapshot in another clock, and the server rejects a snapshot or a reused prediction table in another clock, with a configuration error.

<index>/
  index_metadata.json        # "timestamp_unit": "milliseconds"
  diskgraph_config.json      # "timestamp_unit": "milliseconds"   (always written; absent in older configs means seconds)
  nodes/<table>/shard-*/     # row timestamps in milliseconds; edge time keys 64-bit
  col_stats.json             # min_ms / max_ms + "timestamp_unit"   (seconds keeps min_secs / max_secs)
  kumo_col_stats/            # kumo_timestamp_YYYY-MM-DD HH:MM:SS.fff when a fraction is stored

From a millisecond snapshot:

// index_metadata.json
{ "dataset_name": "<graph id>", "timestamp_unit": "milliseconds", ... }

// col_stats.json, events.TS
{ "min_ms": 1704068319815, "max_ms": 1714435166478, "timestamp_unit": "milliseconds" }

// kumo_col_stats/col_stats_full/events.json
"TS__kumo.timestamp__MAX__False": "kumo_timestamp_2024-04-29 23:59:26.478"

What changes with the clock

Clock Row timestamp stored as Edge time key Range
nanoseconds ns since 1970 64-bit 1677–2262
microseconds µs since 1970 64-bit ±292,000 years
milliseconds ms since 1970 64-bit ±292 million years
seconds (default) seconds since 1970, as main 32-bit, as main as main
hours hours since 1970 configured width (≤32-bit) very large
days days since 1970 configured width (≤32-bit) very large

Row timestamps are variable-length integers, so their size follows the clock (a 2026 timestamp takes 3 bytes in days, 5 in seconds, 9 in nanoseconds). On a 2M-user × 60M-event fixture a milliseconds index is 11.8% larger than a seconds one (2,856 vs 2,554 MB), 240 MB of it from the 64-bit edge time keys and 62 MB from row timestamps; ingest, sampling and training-table times are within noise of seconds.

What stays as on main, in every clock

Value Rule
Typed timestamps and integer epochs finer than the clock round up
Text with a fraction truncate
Decimal epochs with a fraction truncate to the finer of their unit and the clock, then round up
Date32 whole days; null outside main's accepted range
Unparseable text, unsupported formats null, as main
Custom training-table timestamps truncate
Datetime literals in filters round up; a naive datetime is local time, a pd.Timestamp is UTC
Request and seed anchors truncate; NodeRange anchors floor
Window and offset lengths truncate to the clock
Out-of-range edge times far-future key
Failed temporal validity checks keep the row
Int64 create/end-time columns epoch nanoseconds
Training-table and prediction outputs timestamp[ns] / timestamp[us] exactly as main

Three rules are needed only because a clock can now be too narrow or too coarse for a value, which never happens in seconds:

  • A source value outside the clock's range becomes a null cell, and the row is dropped if it is the table's time column, as main does for out-of-range Date32 values. Ingest logs one warning per column with the count. Only nanoseconds (1677–2262) is this narrow for real data, for example 0001-01-01 or 9999-12-31 sentinels, which seconds through microseconds keep.
  • A training-table row whose window would run past the clock's range is skipped instead of aborting the job.
  • A window bound or offset shorter than one tick (for example 30 minutes on an hours index) is a configuration error when the plan is built, instead of an empty window.

Temporal link-prediction training batches group seeds by second; each batch now takes its valid candidate items at its earliest anchor. On seconds every anchor in a batch is equal, so this matches main; on finer clocks it keeps a batch from offering items created after a seed's own anchor.

Kumo's default prediction anchor comes from the latest timestamp statistic. Statistics now print the stored fraction, and the anchor parser adds the digits beyond microseconds that Python's datetime drops, so on a nanosecond index the default anchor equals the latest event.

When to opt in

Use a finer clock when the order of events within a second carries signal (clickstreams, trading) and the timestamps are real event times, not load times. A warehouse type such as TIMESTAMP(9) alone is not a reason: sub-second clocks cost 64-bit edge keys (+11.8% index on the fixture above), and the model's time features are still whole seconds. Use hours or days only when time of day never matters.

Back-compat

Situation Behaviour
Existing seconds index Read unchanged.
New seconds index Index data, index_metadata.json and statistics byte-identical to main. diskgraph_config.json gains one line, "timestamp_unit": "seconds", so its hash in ingest_stats.json changes.
Config or metadata without timestamp_unit Read as seconds. An index build started by an older version still resumes.
Snapshot cache / hosted snapshot identity, seconds Unchanged; existing snapshots are reused. Other clocks get their own identity.
Seconds ingest, sampling and training-table generation Same CPU cost as main; see Speed below.
Plan built for a different clock than the index Configuration error (DiskGraphPlanCompiler(index_path=...) writes plans in the index clock; every Kumo caller passes it).
Predicting with a model trained on another clock kumo-studio's predict snapshots in the training snapshot's clock; kumo-engine and the server reject a snapshot or reused prediction table in another clock. Models trained before this PR are seconds and predict as before.
New kumo-studio SDK, older server Seconds works as before; another clock fails clearly instead of silently building seconds.
Older SDK, new server Builds seconds, as before.
Hosted workflows in flight The clock is passed to the ingest child only behind the diskgraph-index-clock-v1 patch.
Prediction Parquet Unchanged: timestamp[us].

Known limitations

  • Changing a snapshot's clock means building a new index.
  • Sub-second clocks use 64-bit edge time keys, so they cannot share a packed key with an edge weight (Kumo never sets one); this is a configuration error.
  • Exported prediction anchors are timestamp[us], so a nanosecond index's exported anchors are truncated to the microsecond.
  • The model's time features are still computed in whole seconds, so a finer clock changes what is visible, its order and its windows, not the model's sense of time.
  • Text timestamps truncate as on main, so a text event can be visible at an earlier anchor in the same tick. Rounding text up, and keeping user anchors exact in outputs, are separate PRs.

Testing Done

  • Seconds equals main. An index built from a fixture with every source type (fractional text with and without formats, s/ms/µs/ns epochs, decimals, Date32 beyond 2038, typed timestamps, nulls, time-keyed edges) is byte-identical to main's apart from the added timestamp_unit line in diskgraph_config.json (and its hash) and files that also differ between two runs of main. Sampled subgraphs and every training-table file match.
  • Every clock gives the same results on whole-day data (decoded values, samples, training tables, statistics), and follows main's null and rounding rule per source type on messy data.
  • Speed. Seconds-clock ingest encode against main, medians of 9 interleaved runs on 5M rows: text +0.2%, decimal −3.3%, Arrow −1.7%, integer epochs +3.3% wall time at equal CPU time. Training-table generation on 2M users × 60M events could not be separated from noise on a shared machine: across three interleaved runs, day windows were 4–13% faster than main and month windows 0–12% slower.
  • End to end. For all six clocks through kumo-engine: snapshot, training table, fit, predict and export complete; exported timestamps are timestamp[us]; the seconds snapshot id equals main's.
  • Suites, on the final head. cargo clippy --workspace --all-targets -D warnings clean; cargo test --release --workspace 2086 passed; diskgraph Python 294, kumo-api 1126, kumo-core 10690, kumo-engine 700, kumoai_studio 657 passed; root test/rest 2410 and test/connector, test/data, test/train 2276 passed. flake8, isort, pyright, ty for kumo-api and kumo-sdk, both packages' pre-commit hooks and the change-map check pass. The remaining failures need a GPU, credentials or a compatible local pyarrow, also fail on main, or pass when rerun alone.

🤖 Generated with Claude Code

@copy-pr-bot

copy-pr-bot Bot commented Oct 27, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@alan-kumo
alan-kumo had a problem deploying to gha-kumo-workflow-tests October 27, 2026 00:29 — with GitHub Actions Failure
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
Walkthrough

The changes add six index timestamp clocks: seconds, nanoseconds, microseconds, milliseconds, hours, and days. Seconds remain the default. Timestamp conversion, parsing, rowpack storage, sort keys, sampling, temporal validation, plan execution, statistics, and output now use the selected clock. Ingest, snapshot, and plan APIs carry the clock into index construction. Extensions inherit the parent clock. Compatibility handling and tests cover conversion, saturation, metadata, and timestamp output.

Merge Risk: Moderate · previous review 16ad4

An unsupported timestamp sort key can produce an index with incorrect ordering without failing ingest. Other outstanding timestamp-output and diagnostic concerns remain. Resolve or explicitly accept these risks before merging.

Pre-merge checks: Passed 1 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Pr Size Warning The authoritative review-scoped diff changes 121 files. This exceeds the 40-file limit. Split the pull request into smaller, reviewable units.
Change Map Design Review Inconclusive The required <!-- kumo-pr-change-map --> conversation comment is not included in the supplied review context, and no change-map comment exists in the checkout. The PR description only links to an ex… Provide the complete PR conversation comment beginning with <!-- kumo-pr-change-map -->, including its linked problem, per-change rationale, abstraction-layer decisions, existing-behavior analysis, focused verification, and stopping condi…
Passed Passed checks: 1 passed
Check name Status Explanation
Public Resource Access Passed No added or modified external URL was found in the pull-request diff. The only added package source reference is the relative path ../diskgraph-core in `packages/diskgraph/diskgraph-rowpack/Cargo.to…
Full details: Public Resource Access

Explanation

No added or modified external URL was found in the pull-request diff. The only added package source reference is the relative path ../diskgraph-core in packages/diskgraph/diskgraph-rowpack/Cargo.toml:12; its target exists in the same public repository at packages/diskgraph/diskgraph-core. No inaccessible resource reference was introduced.

Full details: Change Map Design Review

Explanation

The required &lt;!-- kumo-pr-change-map --&gt; conversation comment is not included in the supplied review context, and no change-map comment exists in the checkout. The PR description only links to an external maintained map. The repository guidance confirms that the map contains the rationale and file-level design details that this check must assess. The code diff is available, but it cannot establish whether each change was necessary, correctly layered, minimally scoped, and supported by the required verification and stopping condition without that comment.

Resolution

Provide the complete PR conversation comment beginning with &lt;!-- kumo-pr-change-map --&gt;, including its linked problem, per-change rationale, abstraction-layer decisions, existing-behavior analysis, focused verification, and stopping condition. Then reassess the design against the reviewed diff.

Finishing Touches
Resolve merge conflicts
  • Resolve merge conflict in branch fix/native-subsecond-timestamps
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@alan-kumo

alan-kumo commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Change map

File What changed Why
packages/diskgraph/diskgraph-core/src/time.rs Microsecond, millisecond, hour and day unit systems; one clock list and with_index_clock! dispatch; round-up, floor and truncate conversions with clock-constant factors; calendar and offset arithmetic return None past the clock's range The six index clocks and main's rounding rules in each, without panics
packages/diskgraph/diskgraph-core/src/sortkey.rs packages/diskgraph/diskgraph-core/src/metadata.rs 64-bit timestamp sort-key kind; DatasetMetadata.timestamp_unit read with a seconds default Sub-second clocks need 64-bit edge time keys; old indexes read as seconds
packages/diskgraph/diskgraph-core/src/tt_builder.rs Plan carries its clock; Op::map_clock converts a target op's times into another clock The builder converts plan times once, at build()
packages/diskgraph/diskgraph-rowpack/src/access.rs packages/diskgraph/diskgraph-rowpack/src/parser.rs packages/diskgraph/diskgraph-rowpack/src/lib.rs packages/diskgraph/diskgraph-rowpack/Cargo.toml packages/diskgraph/Cargo.lock packages/diskgraph/third_party/artifact-manifest.json Row reader carries the index clock; main's parsing and null rules kept; only the final conversion targets the clock; decimal epochs keep their fraction down to the tick; values outside the clock's range read as null and are counted apart from parse failures; decoders emit the clock's Arrow unit; rowpack depends on diskgraph-core for TimeUnit (lockfile and artifact manifest regenerated) Store row timestamps in the index clock; seconds stays byte-identical to main
packages/diskgraph/diskgraph-rowpack/src/tests_int_string_list.rs Test row reader built with the clock Constructor signature
packages/diskgraph/diskgraph-ingest/src/graph_config.rs packages/diskgraph/diskgraph-ingest/src/lib.rs packages/diskgraph/diskgraph-ingest/src/stage_extension.rs Optional timestamp_unit (written for every clock, read as seconds when absent); recorded in index_metadata.json; edge time-key width per clock; far-future clamp kept; stage extensions inherit the parent clock; Encode markers without the field still resume Ingest into the configured clock with backward-compatible configs
packages/diskgraph/diskgraph-ingest/src/col_stats.rs Timestamp statistics in clock ticks; min_secs/max_secs kept for seconds, min_<unit>/max_<unit> + timestamp_unit otherwise; Kumo timestamp strings print a stored fraction; one warning per column counts values outside the clock's range Statistics in the index clock; seconds output unchanged
packages/diskgraph/diskgraph-ingest/src/config_converter/convert.rs packages/diskgraph/diskgraph-ingest/src/config_converter/inference.rs packages/diskgraph/diskgraph-infer/src/lib.rs Pass the clock through config conversion and temporal inference Callers construct configs and readers with the clock
packages/diskgraph/diskgraph-ingest/README.md Short section on index clocks User-facing documentation
packages/diskgraph/diskgraph-ingest/src/config_converter/tests.rs packages/diskgraph/diskgraph-ingest/src/tests_unit.rs packages/diskgraph/diskgraph-ingest/tests/graph_config.rs packages/diskgraph/diskgraph-ingest/tests/resolution_ingest.rs packages/diskgraph/diskgraph-ingest/tests/resolution_runtime_batch.rs packages/diskgraph/diskgraph-ingest/tests/seed_table_ingest.rs Existing tests set the new config field; new tests for key widths, far-future keys, configs without a clock GraphConfig has no Default; cover the new behaviour
packages/diskgraph/diskgraph-index/src/graph.rs packages/diskgraph/diskgraph-index/src/bin/explore.rs Temporal validity and decoding in the index clock with main's rules (Int64 = epoch ns, Date32 = days, failed check keeps the row) Index reads follow the clock
packages/diskgraph/diskgraph-engine/src/engine.rs Engine reads the clock from metadata; seed timestamps truncate and NodeRange anchors floor into it Sampling in the index clock
packages/diskgraph/diskgraph-train-table/src/ttgen_executor.rs packages/diskgraph/diskgraph-train-table/src/ttgen_resolve.rs packages/diskgraph/diskgraph-train-table/src/ttgen_traversal.rs packages/diskgraph/diskgraph-train-table/src/ttgen_output.rs packages/diskgraph/diskgraph-train-table/src/ttgen_stats.rs packages/diskgraph/diskgraph-train-table/src/split_decider.rs packages/diskgraph/diskgraph-train-table/src/custom_tt_chunk_processor.rs Remove hard-coded seconds from generic code; windows, splits and outputs in the clock; anchors whose windows leave the clock are skipped; custom-table times truncate; outputs saturate; statistics fall back instead of panicking Training tables in the index clock with main's rules
packages/diskgraph/diskgraph-train-table/tests/custom_tt_integration.rs packages/diskgraph/diskgraph-train-table/tests/ttgen_e2e.rs packages/diskgraph/diskgraph-train-table/tests/ttgen_integration.rs Tests pass the clock; skipped-row and calendar-limit cases Signature changes and new behaviour
packages/diskgraph/diskgraph-pybind/src/tt_executor.rs packages/diskgraph/diskgraph-pybind/src/custom_tt_entry.rs packages/diskgraph/diskgraph-pybind/src/tt_builder.rs packages/diskgraph/diskgraph-pybind/src/lib.rs Dispatch once on the index clock; plan clock must match the index; builder keeps times as given and converts at build(); exact datetime literals rounded up; Python TimeUnit gains the new clocks; a window bound or offset shorter than one tick, or a sub-second window unit, is a configuration error Bindings for the clocks
packages/diskgraph/diskgraph-pybind/src/temporal.rs packages/diskgraph/diskgraph-pybind/src/bp_col_stats.rs resolve_temporal(..., timestamp_unit=) and batch-prediction statistics take the clock (default seconds) Kumo statistics in the snapshot's clock
packages/diskgraph/diskgraph-pybind/src/tt_executor/tests.rs packages/diskgraph/diskgraph-pybind/src/tt_executor/pseudo_time_tests.rs Tests pass the clock Signature changes
packages/diskgraph/diskgraph-pybind/python/diskgraph/compiler.py packages/diskgraph/diskgraph-pybind/python/diskgraph/tt_artifacts.py DiskGraphPlanCompiler(index_path=) writes plans in the index clock Plans match the index
packages/diskgraph/diskgraph-pybind/python/tests/test_index_clocks.py Every clock gives the seconds result on whole-day data and main's rules on messy data; the out-of-range warning; windows and offsets shorter than one tick are rejected Pins the invariant
packages/kumo-api/kumoapi/typing.py TimestampPrecision, validate_timestamp_precision and check_prediction_precision One list of clock names and one mismatch error
packages/kumo-core/src/kumo_core/diskgraph/ingest.py DiskgraphIngestSpec.timestamp_precision written into the ingest config's timestamp_unit when not seconds Pass the clock to ingest
packages/kumo-core/src/kumo_core/pquery.py packages/kumo-core/src/kumo_core/prediction.py packages/kumo-core/src/kumo_core/training/table.py packages/kumo-core/src/kumo_core/diskgraph/lightning_data.py packages/kumo-core/src/kumo_core/diskgraph/runtime_adapter.py packages/kumo-core/src/kumo_core/train/shallow_rhs_link_gnn_module.py Plans compiled with index_path; hours and days in the seed/NodeRange unit maps; timestamp statistics keep every nanosecond digit; a temporal-LP training batch takes its valid RHS items at its earliest anchor Training and prediction follow the index clock
packages/kumo-core/tests/test_diskgraph_runtime.py packages/kumo-core/tests/test_pquery.py packages/kumo-core/tests/test_prediction.py packages/kumo-core/tests/test_train_table.py Tests for the above, including exact anchor parsing across ISO formats Coverage
packages/kumo-engine/kumo/engine/graph.py packages/kumo-engine/kumo/engine/trainer/trainer.py packages/kumo-engine/kumo/engine/trainer/_spec.py Graph.snapshot(timestamp_precision=); seconds keeps the existing cache key; GraphSnapshot.timestamp_precision; training-spec.json records the model's clock (seconds when absent) and predict refuses a snapshot in another User-facing option in the pip SDK
packages/kumo-engine/test/test_snapshot_clock.py Six clocks accepted; seconds cache key unchanged; one snapshot per clock; bundles record their clock; predict refuses another clock Coverage
packages/kumo-sdk/kumoai_studio/graph/graph.py packages/kumo-sdk/kumoai_studio/client/graph.py packages/kumo-sdk/kumoai_studio/backend/base.py packages/kumo-sdk/kumoai_studio/trainer/trainer.py Graph.snapshot(timestamp_precision=), which without a precision keeps the clock of the graph's current snapshot; query parameter only when not seconds; checks the server's clock echo; predict snapshots in the clock of the training job's snapshot, read back from the server User-facing option in the hosted SDK
packages/kumo-sdk/test/graph/test_snapshot_clock.py Echo matrix for old and new servers; a snapshot without a precision reuses the current clock; a snapshot's clock is read back; predict uses the training clock Coverage
rest/public/routers/data_snapshot.py rest/driver/data_snapshot_api_driver.py rest/config/data_backend.py rest/config/graph_v2.py Snapshot request accepts the clock; driver records it; router echoes the stored clock in X-Kumo-Timestamp-Precision when a snapshot is created or read Hosted snapshots in the requested clock
rest/backends/data_backend/data_backend.py rest/backends/data_backend/activities/data_backend_activities.py rest/backends/data_backend/workflows/graph_refresh_workflow.py rest/backends/data_backend/workflows/diskgraph_ingest_workflow.py pool/activities.py pool/diskgraph_args.py rest/driver/batch_prediction_job_logic.py rest/backends/ml_backend/activities/ml_backend_activities.py Clock carried through version info, ingest args and the refresh workflow (behind the diskgraph-index-clock-v1 patch); seconds snapshot identity unchanged; prediction statistics use the recorded clock; a batch prediction refuses a pinned snapshot or reused prediction table in another clock than its model's, and an unpinned one refreshes in the model's clock Hosted ingest, prediction and statistics
kumo/diskgraph/ingest.py kumo/diskgraph/service.py kumo/data/generic/diskgraph_batch_pred.py kumo/data/generic/diskgraph_train_table.py Ingest config gets the clock; hosted plans compiled with index_path; statistics clock passed through Hosted workers
kumo/connector/timestamp_convert.py kumo/connector/utils.py kumo/connector/connector.py One vectorized conversion into any clock (timestamp_ticks_from_array); text statistics truncate into the snapshot clock Connector statistics in the snapshot's clock
test/rest/backends/test_snapshot_clock.py test/rest/backends/test_data_backend.py test/rest/backends/test_diskgraph_graph_refresh_workflow.py test/connector/local/test_timestamp_convert.py test/rest/driver/test_batch_prediction_job_logic.py Hosted identity, workflow argument, echo, statistics and prediction-clock tests Coverage
test/data/generic/test_diskgraph_batch_pred.py test/data/generic/test_diskgraph_generate_train_table.py test/data/generic/test_diskgraph_predict_plan_ttng.py test/data/generic/test_diskgraph_runtime_adapter.py test/data/generic/test_diskgraph_train_table_forecasting.py test/data/generic/test_ttng_cross_graph_contamination_e2e.py test/train/datamodule/test_diskgraph_lightning_data.py test/train/test_shallow_rhs_link_gnn_module.py Test doubles accept index_path; fixtures write index_metadata.json; hours/days seed conversion; earliest-anchor valid RHS items Signature changes and coverage

@alan-kumo

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Please review the native timestamp precision changes and their compatibility with existing second-based indexes. Focused native and SDK integration tests pass; the broader Rust suites are still completing.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6


Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 3961984 and 8053470.

Files selected for processing: 44
  • packages/diskgraph/diskgraph-core/src/metadata.rs
  • packages/diskgraph/diskgraph-core/src/sortkey.rs
  • packages/diskgraph/diskgraph-core/src/time.rs
  • packages/diskgraph/diskgraph-engine/src/engine.rs
  • packages/diskgraph/diskgraph-index/src/bin/explore.rs
  • packages/diskgraph/diskgraph-index/src/graph.rs
  • packages/diskgraph/diskgraph-ingest/README.md
  • packages/diskgraph/diskgraph-ingest/src/col_stats.rs
  • packages/diskgraph/diskgraph-ingest/src/lib.rs
  • packages/diskgraph/diskgraph-ingest/src/stage_extension.rs
  • packages/diskgraph/diskgraph-pybind/python/diskgraph/compiler.py
  • packages/diskgraph/diskgraph-pybind/python/diskgraph/tt_artifacts.py
  • packages/diskgraph/diskgraph-pybind/python/tests/test_sampling.py
  • packages/diskgraph/diskgraph-pybind/python/tests/test_subsecond_time.py
  • packages/diskgraph/diskgraph-pybind/python/tests/test_tt_artifacts_split_marshalling.py
  • packages/diskgraph/diskgraph-pybind/src/custom_tt_entry.rs
  • packages/diskgraph/diskgraph-pybind/src/tt_builder.rs
  • packages/diskgraph/diskgraph-pybind/src/tt_executor.rs
  • packages/diskgraph/diskgraph-rowpack/src/access.rs
  • packages/diskgraph/diskgraph-rowpack/src/bin/rowpack_ctx_inspect.rs
  • packages/diskgraph/diskgraph-rowpack/src/lib.rs
  • packages/diskgraph/diskgraph-rowpack/src/parser.rs
  • packages/diskgraph/diskgraph-rowpack/src/tests_timestamp_precision.rs
  • packages/diskgraph/diskgraph-train-table/README.md
  • packages/diskgraph/diskgraph-train-table/src/custom_tt_chunk_processor.rs
  • packages/diskgraph/diskgraph-train-table/src/pass_b.rs
  • packages/diskgraph/diskgraph-train-table/src/route.rs
  • packages/diskgraph/diskgraph-train-table/src/split_decider.rs
  • packages/diskgraph/diskgraph-train-table/src/ttgen_executor.rs
  • packages/diskgraph/diskgraph-train-table/src/ttgen_output.rs
  • packages/diskgraph/diskgraph-train-table/src/ttgen_resolve.rs
  • packages/diskgraph/diskgraph-train-table/src/ttgen_stats.rs
  • packages/diskgraph/diskgraph-train-table/src/ttgen_traversal.rs
  • packages/kumo-core/src/kumo_core/diskgraph/ingest.py
  • packages/kumo-core/src/kumo_core/prediction.py
  • packages/kumo-core/src/kumo_core/train/diskgraph_nested_trainer.py
  • packages/kumo-core/src/kumo_core/train/io.py
  • packages/kumo-core/src/kumo_core/train/output.py
  • packages/kumo-core/src/kumo_core/training/table.py
  • packages/kumo-core/tests/test_prediction.py
  • packages/kumo-core/tests/test_train_output.py
  • packages/kumo-core/tests/test_train_table.py
  • packages/kumo-engine/kumo/engine/graph.py
  • packages/kumo-engine/test/test_prediction_output_columns.py
Files with no reviewable changes: 1
  • packages/kumo-core/src/kumo_core/train/output.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@alan-kumo
alan-kumo had a problem deploying to gha-kumo-workflow-tests October 27, 2026 01:07 — with GitHub Actions Failure
@alan-kumo

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

Other comments: 1
packages/diskgraph/diskgraph-rowpack/src/access.rs: 1

2504-2511: Minor · Functional Correctness · Quick win

Date32 range check is lost for Seconds precision.

get_timestamp rejects Date32 days outside -106752..=24855. The reason in its comment is that seconds-based sort keys use i32 epoch seconds.

get_timestamp_with_precision now handles Date32 before it delegates to get_timestamp. For Seconds it returns days * 86_400 with only an overflow check. A date after 2038 now produces a value above i32::MAX. encode_timestamp_value clamps it into the last Int32 bucket, so temporal ordering is silently wrong on legacy seconds indexes.

Apply the legacy range check in the Seconds arm. Only the nanosecond arm needs the unrestricted range.

Proposed fix
         if matches!(array.data_type(), DataType::Date32) {
             let days = array.as_any().downcast_ref::<arrow_array::Date32Array>().ok_or_else(|| anyhow!("date cast"))?.value(self.row);
+            if precision == crate::TimestampPrecision::Seconds && !(-106752..=24855).contains(&days) {
+                return Err(anyhow!("date out of range: day {days}"));
+            }
             let factor = match precision {

Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 8053470 and 0f35e0e.

Files selected for processing: 24
  • packages/diskgraph/diskgraph-core/src/sortkey.rs
  • packages/diskgraph/diskgraph-core/src/tt_builder.rs
  • packages/diskgraph/diskgraph-index/src/graph.rs
  • packages/diskgraph/diskgraph-ingest/src/lib.rs
  • packages/diskgraph/diskgraph-pybind/python/diskgraph/compiler.py
  • packages/diskgraph/diskgraph-pybind/python/diskgraph/tt_artifacts.py
  • packages/diskgraph/diskgraph-pybind/python/tests/test_compiler.py
  • packages/diskgraph/diskgraph-pybind/python/tests/test_subsecond_time.py
  • packages/diskgraph/diskgraph-pybind/python/tests/test_tt_artifacts_split_marshalling.py
  • packages/diskgraph/diskgraph-pybind/src/tt_builder.rs
  • packages/diskgraph/diskgraph-rowpack/src/access.rs
  • packages/diskgraph/diskgraph-rowpack/src/parser.rs
  • packages/diskgraph/diskgraph-rowpack/src/tests_timestamp_precision.rs
  • packages/diskgraph/diskgraph-train-table/README.md
  • packages/diskgraph/diskgraph-train-table/src/custom_tt_chunk_processor.rs
  • packages/diskgraph/diskgraph-train-table/src/pseudo_time.rs
  • packages/diskgraph/diskgraph-train-table/src/split_decider.rs
  • packages/diskgraph/diskgraph-train-table/src/ttgen_accumulator.rs
  • packages/diskgraph/diskgraph-train-table/src/ttgen_executor.rs
  • packages/diskgraph/diskgraph-train-table/src/ttgen_output.rs
  • packages/diskgraph/diskgraph-train-table/src/ttgen_resolve.rs
  • packages/diskgraph/diskgraph-train-table/src/ttgen_traversal.rs
  • packages/diskgraph/diskgraph-train-table/tests/custom_tt_integration.rs
  • packages/diskgraph/diskgraph-train-table/tests/ttgen_integration.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@alan-kumo
alan-kumo had a problem deploying to gha-kumo-workflow-tests October 27, 2026 03:16 — with GitHub Actions Failure
@alan-kumo

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 0f35e0e and c2032ca.

Files selected for processing: 3
  • packages/diskgraph/diskgraph-ingest/src/lib.rs
  • packages/diskgraph/diskgraph-rowpack/src/access.rs
  • packages/diskgraph/diskgraph-rowpack/src/tests_timestamp_precision.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@alan-kumo
alan-kumo had a problem deploying to gha-kumo-workflow-tests October 27, 2026 03:29 — with GitHub Actions Failure
@alan-kumo

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Major · Validate timestamp precision before changing the output. · lib.rs:7114

packages/diskgraph/diskgraph-ingest/src/lib.rs:7114
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Validate timestamp precision before changing the output.

A fresh ingest removes the local publication marker and deletes the output root before IngestContext::new validates timestamp precision. A precision mismatch can therefore delete an existing index without producing a replacement. Move this validation before invalidate_publication() and the fresh-output wipe. Preserve the existing Encode-marker identity when moving the validation.


Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between c2032ca and dbc4c42.

Files selected for processing: 5
  • packages/diskgraph/diskgraph-ingest/src/lib.rs
  • packages/diskgraph/diskgraph-pybind/python/tests/test_subsecond_time.py
  • packages/diskgraph/diskgraph-rowpack/src/access.rs
  • packages/diskgraph/diskgraph-rowpack/src/lib.rs
  • packages/diskgraph/diskgraph-rowpack/src/tests_timestamp_precision.rs

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@alan-kumo
alan-kumo had a problem deploying to gha-kumo-workflow-tests October 27, 2026 03:39 — with GitHub Actions Failure
@alan-kumo

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

The outside-diff finding about validation order is fixed in a4ee0f3. Precision normalization now runs before publication invalidation, output preparation, or a fresh-output wipe. Encode marker bytes are captured first, preserving the prior identity contract. A native regression asserts that an invalid precision configuration preserves every byte of an existing index, including its publication marker. Focused Rust checks pass; native end-to-end and resume-equivalence checks are running.

Please check the complete precision-validation and publication path for any remaining issues.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@alan-kumo
alan-kumo had a problem deploying to gha-kumo-workflow-tests October 27, 2026 03:55 — with GitHub Actions Failure
@alan-kumo

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Commit aed86e2 fixes the hosted native CI findings. The observed-encoding regression now supplies one key buffer for its one-column context, satisfying the debug-build invariant; all five timestamp regressions pass with debug assertions enabled. The timestamp reader uses ? for the Int64 downcast, satisfying Clippy while preserving its existing Option behavior. Hosted workspace tests and Clippy are rerunning. The separate cloud-backed import job fails during AWS credential configuration before tests execute.

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@alan-kumo
alan-kumo had a problem deploying to gha-kumo-workflow-tests October 27, 2026 04:03 — with GitHub Actions Failure
@alan-kumo

Copy link
Copy Markdown
Collaborator Author

Commit 6b5723d uses expect_err directly in the ordinary timestamp-overflow regression, resolving the remaining Clippy finding. The focused regression passes. Hosted cargo test --locked --workspace passed on aed86e2; native CI is rerunning on this test-only follow-up.

@alan-kumo

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@alan-kumo
alan-kumo had a problem deploying to gha-kumo-workflow-tests October 27, 2026 04:17 — with GitHub Actions Failure
@Vedaant-J
Vedaant-J had a problem deploying to gha-kumo-workflow-tests November 2, 2026 20:01 — with GitHub Actions Failure
Vedaant-J and others added 17 commits November 2, 2026 20:38
A source value beyond the range of the index clock (for example year 9999
on a nanosecond index) now reads as an error, so ingest stores a null cell
and drops the row when the column is a required time column, as main does
for Date32 values outside its range. Data values are no longer saturated.
Ingest logs one warning per column with the number of such values. Every
real value fits the seconds clock, so seconds indexes are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Calendar arithmetic returns None instead of panicking, and a row whose
window, lag or split shift runs past the clock is dropped rather than
wrapped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Kumo timestamp strings and training-table dates print the fraction a
finer clock stores, and nothing extra when it is zero, so seconds output
is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DiskGraphTTBuilder held plan times in nanoseconds, so a seconds or
millisecond plan clamped anchors outside 1677-2262. It now keeps each
anchor, split bound and offset as given and converts it straight into
the plan clock in build(). A window bound or offset shorter than one tick
of that clock is a configuration error instead of an empty window, and a
sub-second window unit is one instead of a panic.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
check_prediction_precision rejects predicting on a snapshot in another
clock than the model was trained on.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Written into the ingest config only when it is not seconds, so seconds
configs stay identical to main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Seconds keeps main's snapshot cache key; every other clock gets its own.
The model bundle records the clock it was trained on (seconds when absent),
and predict refuses a snapshot built on another.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Training and prediction pass index_path to DiskGraphPlanCompiler, the
runtime adapter and NodeRange anchors understand hours and days indexes,
and timestamp statistics keep every nanosecond digit of their fraction.
A temporal-LP training batch takes its valid RHS items at its earliest
anchor, since its anchors share a second rather than a tick.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The clock is sent as a query parameter only when it is not seconds, and
the SDK requires the server to echo the clock it built; a missing echo
means an older server, which builds seconds. Without a clock, snapshot()
keeps the clock of the graph's current snapshot, so the implicit call in
fit reuses it. predict snapshots in the clock of the training job's
snapshot, also from a new session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The clock travels from the snapshot request through GraphDataComputeInput,
GraphDataVersionInfo and DiskgraphIngestArgs into the ingest config. Seconds
keeps main's snapshot identity; other clocks hash their own. The refresh
workflow passes the clock to the ingest child only behind the
diskgraph-index-clock-v1 patch. Creating or reading a snapshot echoes the
clock recorded for it in X-Kumo-Timestamp-Precision.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A batch prediction refuses a pinned snapshot or a reused prediction table
in another clock than its model's training snapshot, and an unpinned one
refreshes its graph in the model's clock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Batch-prediction statistics read the clock from the snapshot's
index_metadata.json when the snapshot was not built in seconds, falling back
to seconds when the file is missing or unreadable. Python sample statistics
convert through resolve_temporal in that clock; typed seconds columns keep
their vectorized path, which returns the same values.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Six-clock acceptance in kumo-engine and kumoai_studio, the unchanged seconds
cache key and hosted identity, the clock echo for old and new SDKs and
servers, the patched ingest workflow argument, statistics in the snapshot's
clock, and NodeRange and seed times on hours and days indexes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Typed columns take the same vectorized conversion in every clock, which
matches resolve_temporal; text statistics truncate into the snapshot clock.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Vedaant-J
Vedaant-J force-pushed the fix/native-subsecond-timestamps branch from 9ee85ab to 99457dc Compare November 2, 2026 22:37
@Vedaant-J
Vedaant-J had a problem deploying to gha-kumo-workflow-tests November 2, 2026 22:37 — with GitHub Actions Failure
@Vedaant-J
Vedaant-J had a problem deploying to gha-kumo-workflow-tests November 2, 2026 22:37 — with GitHub Actions Failure
@Vedaant-J

Copy link
Copy Markdown
Contributor

Updated in 99457dcb:

  • 7: predict now uses the training snapshot's clock. kumo-studio reads it back from the server and snapshots in it, so a new session or scheduled job works. The server rejects a pinned snapshot or reused prediction table in another clock, and refreshes an unpinned graph in the model's clock. kumo-engine records the clock in the bundle and predict refuses a snapshot in another clock. Models trained before this PR are seconds.
  • 8: checked with real ingests. Typed, text and integer-epoch 0001-01-01/9999-12-31 are kept on seconds, ms and µs and dropped only on ns. Date32 is already nulled on main. Ingest now logs one warning per column with the count, and the README notes it. Windows and offsets shorter than one tick are rejected at build time instead of returning empty results.
  • Description: dropped "why can a window not be shorter than a second?". PQL's finest window unit is minutes, so sub-second windows are out of scope here.

@aaron-kumo

Copy link
Copy Markdown
Collaborator

Thanks, @Vedaant-J fixes LGTM.

Non-blocking nit: on hours/days, a window bound that isn't a whole number of ticks still truncates silently (e.g. 90 minutes on an hours index becomes 1 hour). Could reject those the same way as sub-tick ones. OK to follow-up later or defer for now.

This branch had an error being deployed

1 failed deployment
gha-kumo-workflow-tests — 99457dcb Deployed Nov 2, 2026 by Vedaant-J via Check OpenAPI Changes #616
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.

4 participants