Repository navigation
Conversation
This is part 1 of the versioned-features proof of concept: Stage 1, P1 feature values on layout v4, Mode A. diskgraph-index gets a version sidecar in <index>/versions/: a manifest and, for each shard, a bitmap of the nodes with versions, offsets, and one full row for each later version. The base row stays the first state of the node. TableReader can now return the row of a node at a time tau, and it refuses a sidecar that belongs to another index build. diskgraph-ingest gets the history spec (a column-level audit log, or periodic snapshots, which the build refuses for now), an audit-log reader, and a gate that refuses every kind of change that Stage 1 does not support. A refusal returns a report with a count and up to five sample rows for each reason. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This is part 2 of the versioned-features proof of concept. diskgraph_ingest::versions::build_versions(index_dir, history_json) runs the gate, then folds the changes of each node forward from its base row in time order, and writes the version sidecar. A change is live from the first index tick at or after its changed_at. Changes of one node inside one tick merge in (changed_at, file row order). The fold refuses an old_value that differs from the value before the change, a value that does not fit the column type, and a row over the node-data limit. Any refusal writes nothing. A rerun replaces the sidecar, also when the reader rejects the old one, because the build opens the index without loading versions/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This is part 3 of the versioned-features proof of concept. DiskGraphEngine loads the version sidecar when it opens an index. Every sampler read of a node row of a versioned table now returns the row that is live at the anchor time of the node instance's root seed: the fused frontier, the fused leaf, the chunked fetch (which now dedups by node and version), and the non-fused fetch after sampling. A read of a versioned table without an anchor time fails with InvalidRequest, never with a silent base-row read. The engine refuses Uniform and DeterministicUniform fanouts on a graph with versioned tables, because they read no anchor time. fetch_features_for_type and the legacy load refuse versioned data. Anchors in a finer unit round down on a versioned graph. An index without versions/ takes the old code paths. It also fixes a bug that main has too: a fused request that failed partway left decoded rows in the pooled TypeState, and the next request on that state emitted them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This is part 4 of the versioned-features proof of concept. When the entity table has versions, training-table generation reads the entity row that is live at each anchor time tau for the seed checks: the entity filter and its entity-column operands, the split value and the include bit. A label op (an Aggregate or HasEdges op, or an entity Column op, that feeds the target) reads entity columns from the row live at the end of the label window, the latest end among the label windows. Non-temporal plans read at the emitted timestamp. Every other read of a changed column stops the plan with an InvalidPlan error that names the table, the column and the read site. Reads of unchanged columns, and COUNT of a changed column, stay allowed. A node without versions keeps the once-per-entity seed path, and a node with versions rebuilds its seed only when the live version changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This is part 5 of the versioned-features proof of concept.
diskgraph.build_versions(index_dir, history_json) builds the version
sidecar of an existing index and returns the report as JSON.
diskgraph.ingest_with_history(config_json, history_json, output_dir)
checks the history spec against the config first, so a bad spec fails
before any ingest work, then runs ingest and build_versions, and
returns {"ingest": ..., "versions": ...}. If the gate refuses after
ingest, the base index stays without versions/.
A refusal raises DiskgraphDataError. Its first line names the reasons,
and the rest is the report as JSON. A history that does not parse
raises DiskgraphConfigError. The config-only table checks of the gate
move into check_config, which the pre-check shares.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This is part 6 of the versioned-features proof of concept. scripts/versions_e2e/gen_data.py writes a small fixture (20,000 users, 180,000 orders, and an audit log of about 41,000 changes to tier, score and status) and an independent oracle of each user's row at any time. e2e_engine.py ingests the fixture, runs build_versions, and compares every sampled row and every training-table row with the oracle: seed and one-hop reads, fused and non-fused, the runtime batch path, five label kinds, and the refusals, each of which must succeed on the index without history first. Run it with the diskgraph wheel installed: python e2e_engine.py --data <fixture folder> --work <work folder> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
Change mapObserved need: a DiskGraph index holds one state per row, so features that change over time either stay at the first state or leak later states. Existing behavior: every read returns the base row. Smallest change for Stage 1: keep the base index, add a version sidecar for changed feature values, and read it at each anchor. Focused check: the version tests, and an end-to-end oracle check of every sampled and training-table row. Stopping condition: engine-level reads match the oracle. Product-level runs at 100M rows are a later step.
|
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueNote
|
CodeQL reports the panic message as cleartext logging, because the value can be a UUID. The test needs only the fact that the users id column is not Int64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Design discussion or issue: none. This PR is the Stage 1 proof of concept of mutable data in DiskGraph: P1 feature values on layout v4, Mode A.
Summary
This PR lets a DiskGraph index serve the feature values that a node had at the anchor time of each sample. On main, each row has only one fixed state. A new call,
build_versions, reads a column-level audit log and writes a version sidecar next to an existing index. The sampler and training-table generation then read the row that was live at each anchor time.This is one large draft PR, so that the whole proof of concept can be reviewed in one place. Its six commits follow its parts: the sidecar and the gate, the fold, the sampler, training-table generation, the Python bindings, and an end-to-end check.
It also fixes a bug that main has too, in
TypeState::adaptive_reset. A fused sampler request that fails partway leaves decoded rows in the pooled state. The next request on that state then returns them.Why
A DiskGraph index stores one row per node. When a feature value changes over time, for example a user's status, the index can hold only one state. Training then sees either the first state at every anchor, or a later state that leaks future information. This proof of concept stores the first state as the base row and the later states in a sidecar. Each anchor then reads the state that was true at that time.
Before and now
versions/sidecar with one full row for each later version of a changed nodeingestonlyingest, unchanged, thenbuild_versions(index_dir, history_json).ingest_with_historyruns both. A longer history reruns onlybuild_versions.changed_at. Periodic snapshots are in the spec, but the build refuses them for now.fetch_features, legacyloadA version is live from the first index tick at or after its
changed_atuntil the next version starts.Why the new way is better
Trade-off and known limits
build_versionsholds all version rows in memory until it writes the sidecar.WHERE status = 'active' AND COUNT(...) > 0, is refused today.versions/, and it then reads as an index without history untilbuild_versionsruns again.Change map
See the change-map comment on this PR.
Testing Done
cargo test --locked --workspaceinpackages/diskgraph: 2,283 passed, 18 ignored and 1 failed. The failure isdisk_manager::tests::test_eviction_under_real_disk_pressure, which measures free space on a shared disk. It missed by 1,000,000 bytes on the test machine.cargo clippy --locked --workspace --all-targets -- -D warnings: clean, except the unchangeddiskgraph-ptrhash/src/test.rs, which fails the same way on main on aarch64.test_versions.py. 1 test and 4 test modules fail only because the test machine has nokumoapimodule. They fail the same way on main.scripts/versions_e2e/e2e_engine.py: 26 of 26 checks passed with 0 mismatches over 22,063,665 compared values. It compares every sampled row and every training-table row with an independent oracle. It also runs every refusal case on the index without history first, where the case must succeed.Hotfix Context
Not a hotfix.
Checklist
🤖 Generated with Claude Code