Repository navigation
fix: a format version that is not a whole number, or is lower, is refused for what it is - #54
Merged
Merged
Conversation
…used for what it is Closes #50. `"v":"2"` was refused by System.Text.Json's own message, which names no annotation, because TryGetInt32 was asked before the element's kind. And a version below the one this package reads was said to come from a newer SchemaKit, with the advice to update. Both were refused before and are refused now; only what they are told changes. Only a higher version says "newer" and "Update the package". Co-Authored-By: Claude Fable 5.2 <[email protected]>
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.
Closes #50
Problem
DeclarationCodec.Readrefuses a stored declaration whose format versionvis not the one it reads. Two of those refusals said the wrong thing:"v":"2"(ortrue,null, an array) threw System.Text.Json's own message, "The requested operation requires an element of type 'Number', but the target element has type 'String'", with no annotation key in it.TryGetInt32was called before the element's kind was checked.vbelow 2 was told the snapshot "was written by a newer SchemaKit … Update the package", which is wrong advice for an older format.Nothing was read wrongly: both were refused before and are refused now.
Change
Declarations/Internal/DeclarationCodec.cs: the element's kind is checked beforeTryGetInt32.Infrastructure/Internal/SchemaKitStrings.cs:UnknownFormatVersionkeeps its first sentence and ends in one of three: not a whole number (edited or damaged), written by a newer SchemaKit (update), or an older format this version does not read.Tests
Kernel tests without a server: 263 before, 271 after. The PostgreSQL integration tests did not run locally; CI runs them.
A_format_version_this_version_does_not_know_is_refusednow has 11 rows:3,1,0,-1, missing,"2",2.5,true,null,[2]and a number too large for anint. Each asserts the key, the stored version and the reason, and that only3is told "newer" and "Update the package".TryGetInt32"2",true,null,[2]1,0,-1🤖 Generated with Claude Code