Tag disk-cached query values with their dep node, not the node index - #71
Closed
xmakro wants to merge 1 commit into
Closed
Tag disk-cached query values with their dep node, not the node index#71xmakro wants to merge 1 commit into
xmakro wants to merge 1 commit into
Conversation
The node index only names a node relative to the session's serialized graph; cross-session value carry needs a tag that still identifies a value's node when the bytes outlive the session that wrote them. `(kind, key_fingerprint)` is unique per node for every kind that caches query values, so tagging with the `DepNode` itself is exactly as strong a within-session check as the index tag while staying valid across sessions. The expected node is threaded from the query layer through `try_load_from_disk_fn`, so the load path checks end to end that the decoded bytes belong to the node the query layer asked for, without consulting the dep graph. Side effects keep their index tags: side-effect nodes are exempt from the uniqueness guarantee, so a node tag would be ambiguous for them. The header format version is bumped because the tag changed.
xmakro
force-pushed
the
cleanup/fingerprint-value-tags
branch
from
July 29, 2026 11:11
9f0eec5 to
3bb2e40
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Disk-cached query values are tagged with their node's
SerializedDepNodeIndex, and the load path checks the tag after looking the position up by that same index. That is a fine within-session integrity check, but the index only names a node relative to the session's serialized graph: cross-session value carry (the #35 ladder) needs a tag that still identifies a value's node when the bytes outlive the session that wrote them.This tags values with the
DepNodeitself.(kind, key_fingerprint)is unique per node — enforced by the reverse-index collision panic inserialized.rs— so the tag stays exactly as strong a discriminator as the index, while also being stable across sessions. The expected node is threaded from the query layer throughtry_load_from_disk_fn, so the check now verifies end to end that the decoded bytes belong to the node the query layer asked for, and the load path no longer needs to consult the dep graph.Side effects keep their index tags: side-effect nodes are exempt from the
(kind, key_fingerprint)uniqueness guarantee, so a node tag would be ambiguous for them, and their values are a strictly within-session artifact.Costs: the tag grows from a varint index (typically 2–3 bytes) to a fixed 18 bytes per cached value, and the
HEADER_FORMAT_VERSIONbump invalidates existing incremental caches once on upgrade.