Repository navigation
Conversation
deversify wrote the parsed major and minor into Vrsn_1_0 and returned that same object. After any non-1.0 version string was parsed, every default that reads Vrsn_1_0 (versify, Serder, the event builders) used the parsed version instead. sizeify's unsupported-version guard compared the result to Vrsn_1_0 by reference, so it could never fire. deversify now returns a new Version, and sizeify compares by value and reports the version it rejects. Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
VEREX matches hex digits and versify writes them with toString(16), but deversify decoded them with unary +, so a digit of a-f became NaN. Parse them with parseInt(_, 16). Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
Vrsn_1_0 is the default version for versify, Serder and the event builders, so any write to it changes every later serialization. The previous commit removed the one writer; freezing the object stops the next one. Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
keripy's rematch raises VersionError for a v1-form version string with major > 1. deversify accepted it, and Saider, which calls deversify directly rather than going through sizeify, would digest a header keripy calls malformed. Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #424 +/- ##
=======================================
Coverage 97.46% 97.46%
=======================================
Files 1 1
Lines 79 79
Branches 28 28
=======================================
Hits 77 77
Misses 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
daidoji
suggested changes
Oct 15, 2026
| match[4], | ||
| match[5], | ||
| ]; | ||
| if (version.major > 1) { |
Contributor
There was a problem hiding this comment.
Probably should be version.major != 1 as your regex allows for version 0.0.
| match[4], | ||
| match[5], | ||
| ]; | ||
| if (version.major > 1) { |
Contributor
There was a problem hiding this comment.
Suggested change
| if (version.major > 1) { | |
| if (version.major != 1) { |
| * Denotes version 1.0 of a protocol. | ||
| */ | ||
| export const Vrsn_1_0 = new Version(); | ||
| export const Vrsn_1_0 = Object.freeze(new Version()); |
Contributor
There was a problem hiding this comment.
Suggested change
| export const Vrsn_1_0 = Object.freeze(new Version()); | |
| export const Vrsn_1_0 = Object.freeze(new Version(major: 1, minor: 0)); |
Since we use this as Version 1.0 global probably better to be explicit.
This branch has not been deployed
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.
Fixes #423.
deversifywrote the parsed major and minor intoVrsn_1_0and returned that same object. That had two effects. Every default that readsVrsn_1_0(versify,Serder, the event builders) picked up whatever version was parsed last, and the guard insizeifycompared againstVrsn_1_0by reference, so it could never fire. The first commit hasdeversifyreturn a newVersionand makessizeifycompare major and minor by value. Once the guard could fire, its message printed[object Object], so it now prints the version, e.g. "unsupported version 1.1".The second commit reads the version digits as hex.
VEREXmatches[0-9a-f]andversifywrites withtoString(16), butdeversifyused unary+, so a digit from a to f came back asNaN. The stream parser from #413 had the same problem and reads them as hex now, as keripy'sVEREX1does.The last two commits are smaller. One freezes
Vrsn_1_0, so that the next code to write to it fails instead of quietly changing every later serialization. Nothing writes to aVersion's fields today. The other makesdeversifyreject a v1 version string whose major is above 1, as keripy'srematchdoes.Saidercallsdeversifydirectly rather than throughsizeify, so without this it would digest a header likeKERI20JSON…_that keripy calls malformed.There's one behavior change to note.
sizeify, and therefore building aSerderfrom a ked, now throws on a version string other than 1.0, where before it accepted it silently. I checked every use ofVrsn_1_0, and none depends on its identity apart from that comparison.The new tests cover a hex digit decoding to 10, parsing a 1.1 string leaving
Vrsn_1_0at 1.0 and frozen,sizeifyrejecting 1.1, anddeversifyrejecting 2.0.