Skip to content

Fail fast on unsupported serialization format versions - #290

Merged
mbastian merged 1 commit into
masterfrom
fail-fast-unsupported-version
Aug 25, 2026
Merged

Fail fast on unsupported serialization format versions#290
mbastian merged 1 commit into
masterfrom
fail-fast-unsupported-version

Conversation

@mbastian

Copy link
Copy Markdown
Member

Summary

  • Reading a file written by a newer, incompatible graphstore version currently fails deep inside 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 after readVersion is read in all three deserializeGraphModel* entry points, before any config/store bytes are touched, and raises a new UnsupportedFormatVersionException (extends IOException, so no signature changes) when the file's version exceeds what this build supports.
  • The new exception exposes getFileVersion()/getMaxSupportedVersion() so consumers like Gephi can catch it specifically and build a clean, localized error message instead of parsing generic IOException text.
  • Serialization.VERSION stays at 0.5f for now — no format change accompanies this PR — so the check is currently a no-op and only activates the next time VERSION is bumped for an actual format change.

Test plan

  • mvn -o test -Dtest=SerializationTest,SerializationCompatibilityTest
  • mvn -o test (full suite)

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>
@mbastian mbastian added this to the 0.8.7 milestone Aug 25, 2026
@mbastian
mbastian merged commit c0f3d79 into master Aug 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant