Fix verification of tracked struct from high-durability query #1
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.
The test models a situation where we have two files (0, 1), where file 0 has LOW durability and file 1 has HIGH durability. We can query an
index
for each file, and adefinitions
from that index (just a sub-part of the index), and we caninfer
each file. Theindex
anddefinitions
queries depend only on the File they operate on, but theinfer
query has some other dependencies:infer(0)
depends oninfer(1)
, andinfer(1)
also depends directly onFile(0)
(this is to model that resolving a module can depend on existence of various files at various durabilities.) The dependency graph is shown below: light color represents low durability, black represents high durability, dark gray are structs and struct fields; I didn't get around to adding their durability to the graph yet. (The diff used to automatically generate the graph is included in the PR too; if we hit many more bugs like this I'll probably clean this code up and try to make it generally reusable.)The panic occurs because
definitions(1)
is high durability, and depends onindex(1)
which is also high durability.index(1)
creates the tracked structDefinition(1)
, andinfer(1)
(which is low durability) depends onDefinition.file(1)
.After a change to file 0 (low durability), we only shallowly verify
definitions(1)
-- it doesn't need deep-verify because it is high durability. So that means we never verifyindex(1)
at all (deeply or shallowly), which means we never markDefinition(1)
validated. So when we deep-verifyinfer(1)
, we try to access its dependencyDefinition.file(1)
, and hit the panic because we are accessing a tracked struct that has never been re-validated or re-recreated in R2.