Reload & verify
# grade this stage (from your course directory)
npx theinference test --stage deserialize --watchRead it back. loadSegment(bytes, params) reconstructs the in-memory index from the serialized bytes. The proof it worked: search the reloaded index and get identical results to the original.
What to build
Implement loadSegment + round-trip
Implement loadSegment. Wire the roundtrip subcommand: build the index, serialize it, reload it, and print the four equality checks:
{ "headerOk": 1, "vectorsClose": 1, "adjacencyEqual": 1, "resultsEqual": 1 }
./your_program.sh roundtrip <fixture>/chapters/07-persistence/steps/03-deserialize/fixtures/data.json
A round-trip bug almost always shows as 'vectors fine, adjacency scrambled' — an offset or endianness mismatch in the adjacency block, where variable-length degree-prefixed lists are easy to misalign. Assert the reloaded adjacency equals the pre-serialization graph before you trust the search results.
Process mode: stdout_json_match, atol 0. All four flags must be 1: header magic/version OK, reloaded vectors match (exact for a float32 round-trip), adjacency identical, and the reloaded index returns identical search results to the in-memory one.