Parity & provenance¶
kglite-datasets did not start as fresh code — it is a behavior-preserving
extraction of loaders that lived inside kglite. This page explains how that
extraction was verified correct, and why the frozen oracles in this repo now
carry that authority forward.
The extraction¶
The loaders were moved out of kglite via a mechanical import transform
(kglite::(api::)datasets:: → kglite_datasets::, kglite. →
kglite_datasets.) with zero engine coupling — the engine-free loaders
fetch, parse, and emit CSV / blueprint JSON / N-Triples, and the graph build
stays in kglite. Because the transform only rewrote import paths, the copied
inline unit tests — byte-identical to kglite’s — pass against the transformed
code, proving the port is behavior-preserving.
The one behavioral change in the whole extraction is the SEC injectable
clock: sec::run_all now delegates to run_all_at(..., extracted_at), so the
source_extracted_at provenance column can be pinned. That makes SEC output
deterministic and therefore goldenable — the only clock leak on the SEC extract
path.
Regenerating a golden¶
Do not regenerate a golden to turn a red test green — a digest change means
the emitted CSVs changed. Regenerate only when that change is intended (a parser
fix, a new column, a shape change), in the same commit as the code change,
with a recorded reason. Both capture paths honour UPDATE_GOLDEN=1:
# Rust (sodir):
UPDATE_GOLDEN=1 cargo test -p kglite-datasets --test csv_golden
# Python (SEC):
UPDATE_GOLDEN=1 .venv/bin/python -m pytest \
kglite_datasets/tests/test_parity_golden.py
Re-baseline benchmarks/baseline.json only for a deliberate, measured perf
change — never to paper over a regression. Judge by the ratio, not absolute ms
(which is machine-specific).