Fail fast on unsupported serialization format versions - #290
Merged
Conversation
A file written by a newer graphstore than the one reading it currently fails deep inside deserialize()'s switch with a generic "Unknown serialization type tag" once it hits an unrecognized tag, after the store has already been locked/partially mutated. Check the version immediately after it's read, before touching any state, and raise a dedicated UnsupportedFormatVersionException (extends IOException, so no signature changes) that callers like Gephi can catch specifically to show a clean, localized message instead of a generic I/O error. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.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.
Summary
deserialize()'s tag switch with a generic "Unknown serialization type tag" error, only after the store has already been locked/partially mutated.checkVersionSupported()now runs immediately afterreadVersionis read in all threedeserializeGraphModel*entry points, before any config/store bytes are touched, and raises a newUnsupportedFormatVersionException(extendsIOException, so no signature changes) when the file's version exceeds what this build supports.getFileVersion()/getMaxSupportedVersion()so consumers like Gephi can catch it specifically and build a clean, localized error message instead of parsing genericIOExceptiontext.Serialization.VERSIONstays at0.5ffor now — no format change accompanies this PR — so the check is currently a no-op and only activates the next timeVERSIONis bumped for an actual format change.Test plan
mvn -o test -Dtest=SerializationTest,SerializationCompatibilityTestmvn -o test(full suite)