-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Consistent version query semantics #3477
Changes from all commits
bc4d5cf
788397a
8b570f9
3be82c3
3c04841
b63d4da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Consistent version query semantics | ||
Updated semantics for commit/version/time-travel queries when using both DocID and CID. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ func TestQueryCommitsWithDocIDAndCidForDifferentDoc(t *testing.T) { | |
Results: map[string]any{ | ||
"commits": []map[string]any{}, | ||
}, | ||
ExpectedError: "missing cid", | ||
}, | ||
}, | ||
} | ||
|
@@ -70,14 +71,15 @@ func TestQueryCommitsWithDocIDAndCidForDifferentDocWithUpdate(t *testing.T) { | |
Request: ` { | ||
commits( | ||
docID: "bae-not-this-doc", | ||
cid: "bafybeica4js2abwqjjrz7dcialbortbz32uxp7ufxu7yljbwvmhjqqxzny" | ||
cid: "bafyreiale6qsjc7qewod3c6h2odwamfwcf7vt4zlqtw7ldcm57xdkgxja4" | ||
Comment on lines
-73
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just highlighting this for reviewers. This isnt required by the new changes to the commit query semantics. Its actually fixing a unconsequential bug which is using the incorrect |
||
) { | ||
cid | ||
} | ||
}`, | ||
Results: map[string]any{ | ||
"commits": []map[string]any{}, | ||
}, | ||
ExpectedError: "cid does not belong to document", | ||
}, | ||
}, | ||
} | ||
|
@@ -126,3 +128,51 @@ func TestQueryCommitsWithDocIDAndCidWithUpdate(t *testing.T) { | |
|
||
testUtils.ExecuteTestCase(t, test) | ||
} | ||
|
||
func TestQueryCommitsWithDocIDAndCidWithUpdateAndDepth(t *testing.T) { | ||
test := testUtils.TestCase{ | ||
Description: "Simple all commits query with docID and cid, with update", | ||
Actions: []any{ | ||
updateUserCollectionSchema(), | ||
testUtils.CreateDoc{ | ||
CollectionID: 0, | ||
Doc: `{ | ||
"name": "John", | ||
"age": 21 | ||
}`, | ||
}, | ||
testUtils.UpdateDoc{ | ||
CollectionID: 0, | ||
DocID: 0, | ||
Doc: `{ | ||
"age": 22 | ||
}`, | ||
}, | ||
// depth is pretty arbitrary here, as long as its big enough to cover the updates | ||
// from the target cid (ie >=2) | ||
testUtils.Request{ | ||
Request: ` { | ||
commits( | ||
docID: "bae-c9fb0fa4-1195-589c-aa54-e68333fb90b3", | ||
cid: "bafyreiale6qsjc7qewod3c6h2odwamfwcf7vt4zlqtw7ldcm57xdkgxja4", | ||
depth: 5 | ||
) { | ||
cid | ||
} | ||
}`, | ||
Results: map[string]any{ | ||
"commits": []map[string]any{ | ||
{ | ||
"cid": "bafyreiale6qsjc7qewod3c6h2odwamfwcf7vt4zlqtw7ldcm57xdkgxja4", | ||
}, | ||
{ | ||
"cid": "bafyreia2vlbfkcbyogdjzmbqcjneabwwwtw7ti2xbd7yor5mbu2sk4pcoy", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
testUtils.ExecuteTestCase(t, test) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: There is no data breaking change in this PR, if the change detector failed it is because the integration test definitions were changed, not the data on disk. Please change the wording to reflect this.