Repository navigation
fix(walk): read version strings the way keripy's smell does - #6
Merged
Merged
Conversation
Two bugs, both found by Kent Bull in the signify-ts copy of this walker (WebOfTrust/signify-ts#413) and present here too. The v1 version digits were matched as decimal, so a valid token like `KERI1aJSON00012b_` (protocol version 1.10) was not a version string at all. keripy's VEREX1 reads them as hex, like the size; VersionValue already did. parseVersion searched a 128-byte window and tried the v2 layout first, so a version-like string inside a field value could take over the outer message's framing: `{"v":"KERI10JSON000033_","x":"KERICAACAAJSONAAD_."}` framed as a 255-byte v2 message from byte 30 and was reported as recoverably incomplete. It now does what smell does: one combined v2|v1 search for the earliest token, rejected if it starts more than MAXVSOFFSET (8) bytes in, with the window read one character per byte so offsets are byte offsets. When fewer than SMELLSIZE bytes remain and no token is found, the result is `incomplete` rather than a permanent `no-version-string`, since the token may be cut off. Short garbage in the viewer therefore reads as too short rather than as not CESR; the tests that used 7-byte garbage now use input long enough to rule a token out. Claude-Session: https://claude.ai/code/session_01WRfCuQNE3iHSDxqvPGMUez Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
dhh1128
added a commit
that referenced
this pull request
Oct 13, 2026
…incomplete (#6 hostile pass). Under SMELLSIZE (27) bytes with no version token, walk() returns incomplete/permanent:false even when no offset 0..8 could start a token (e.g. 26 '@' bytes). Faithful to keripy smell (ShortageError on len<SMELLSIZE, kering.py:227), where the cold-start ColdCodex sniff on byte 0 rejects garbage first. Fix: add a cold-start first-byte sniff, or a prefix-feasibility check that returns no-version-string once no position <= MAXVSOFFSET can still begin [A-Z]{4}. Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
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.
Ports two version-string fixes from the signify-ts copy of this walker, where Kent Bull found them in review (WebOfTrust/signify-ts#413). Both bugs exist here too.
The v1 version digits were matched as decimal, so a valid token like
KERI1aJSON00012b_(protocol version 1.10) was not recognised as a version string at all. keripy's VEREX1 reads them as hex, as it does the size, andVersionValuealready did.parseVersionsearched a 128-byte window and tried the v2 layout first, so a version-like string inside a field value could take over the outer message's framing.{"v":"KERI10JSON000033_","x":"KERICAACAAJSONAAD_."}was framed as a 255-byte v2 message starting at byte 30 and reported as recoverably incomplete. It now does what keripy'ssmelldoes: one combined v2|v1 search for the earliest token, rejected if it starts more than MAXVSOFFSET (8) bytes in, with the window read one character per byte so that offsets are byte offsets.When fewer than SMELLSIZE (27) bytes remain and no token is found, the result is
incompleterather than a permanentno-version-string, because the token may be cut off. Short garbage in the viewer therefore reads as too short rather than as not CESR. The tests that used 7-byte garbage now use input long enough to rule a token out.Type renames and the body/attachments restructure from #413 are left for a later PR.
Tests:
tscclean; vitest 238 passed, 8 skipped. New tests are insrc/cesr/__tests__/walk.test.tsunder "version-string smelling (keripy smell)".🤖 Generated with Claude Code
https://claude.ai/code/session_01WRfCuQNE3iHSDxqvPGMUez