Update MessagePack compatibility and tests#747
Open
YukiMatsuzawa wants to merge 39 commits into
Open
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…improve/update-messagepack
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…pdate-messagepack
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ve/update-messagepack
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades the repository’s MessagePack stack (notably to MessagePack v3.x) while aiming to preserve compatibility for existing persisted data, especially for large-list serialization, and adds regression tests that validate byte-level round-trips.
Changes:
- Upgrade MessagePack packages / frameworks and migrate serialization calls to the newer
MessagePackSerializer+ options API surface. - Refactor restoration-key and annotator-container serialization to work with the updated MessagePack union/formatter approach.
- Add/extend regression tests that assert deserialization of known legacy bytes and stable re-serialization outputs.
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/MSDIAL5/MsdialCoreTests/Parser/MspDbRestorationKeyTests.cs | Updates restoration-key serialization test to use the new non-generic interface + stream rewind. |
| tests/MSDIAL5/MsdialCoreTests/DataObj/ProjectDataStorageTests.cs | Makes test timestamps explicit with timezone offset for stable serialization behavior. |
| tests/MSDIAL5/MsdialCoreTests/DataObj/MoleculeDataBaseTests.cs | Adds missing stream rewind before deserialization in MessagePack round-trip test. |
| tests/Common/CommonStandardTests/MessagePack/LargeListMessagePackTests.cs | Adds byte-level tests for LargeListMessagePack (round-trip + legacy byte fixtures). |
| tests/Common/CommonStandardTests/Lipidomics/LipidEieioMsmsCharacterizationTests.cs | Adjusts deployed resource path for lipidomics test input file. |
| tests/Common/CommonStandardTests/DataObj/Property/AdductIonTests.cs | Adds byte-fixture tests for AdductIon serialization compatibility and stream rewinds. |
| tests/Common/CommonStandardTests/Components/MoleculePropertyTests.cs | New byte-fixture test validating IMoleculeProperty formatter compatibility. |
| tests/Common/CommonStandardTests/Components/DriftTimeTests.cs | Adds stream rewind before deserialization. |
| tests/Common/CommonStandardTests/CommonStandardTests.csproj | Ensures test resource is copied to output under the updated target path. |
| src/MSFINDER/MsfinderConsoleAppCore/MsfinderConsoleAppCore.csproj | Updates .NET Core target from netcoreapp3.0 to netcoreapp3.1. |
| src/MSDIAL5/SpectrumViewer/SpectrumViewer.csproj | Updates System.Runtime.CompilerServices.Unsafe package version. |
| src/MSDIAL5/MsdialGuiApp/MsdialGuiApp.csproj | Upgrades MessagePack package reference to v3.1.7. |
| src/MSDIAL5/MsdialCore/Parser/ReferRestorationKey.cs | Adds union metadata + generic bridge methods to support updated restoration-key serialization. |
| src/MSDIAL5/MsdialCore/Parser/IReferRestorationKey.cs | Introduces a non-generic IReferRestorationKey interface for serialization friendliness. |
| src/MSDIAL5/MsdialCore/DataObj/ShotgunProteomicsDB.cs | Adjusts MessagePack member attributes (e.g., disposedValue) for the new serializer behavior. |
| src/MSDIAL5/MsdialCore/DataObj/ProteomicsAnnotatorParameterPair.cs | Switches stored restoration-key type to non-generic interface + explicit string keys. |
| src/MSDIAL5/MsdialCore/DataObj/MsdialDataStorage.cs | Removes [MessagePackObject] attribute from a base class as part of serializer refactor. |
| src/MSDIAL5/MsdialCore/DataObj/MetabolomicsAnnotatorParameterPair.cs | Switches stored restoration-key type to non-generic interface + explicit string keys. |
| src/MSDIAL5/MsdialCore/DataObj/IAnnotatorParameterPair.cs | Adds a non-generic marker interface to support union-based serialization of annotator pairs. |
| src/MSDIAL5/MsdialCore/DataObj/EadLipidAnnotatorParameterPair.cs | Adds serialization constructor accepting the new non-generic restoration-key interface. |
| src/MSDIAL5/MsdialCore/DataObj/DataBaseItem.cs | Adds a serialization-friendly PairsForSerialization representation using the new non-generic pair interface. |
| src/MSDIAL5/MsdialCore/DataObj/ChromatogramPeakFeature.cs | Adjusts MessagePack member inclusion (notably match-results and interface members). |
| src/MSDIAL5/MsdialCore/DataObj/AnnotatedMSDecResult.cs | Migrates custom formatter to new MessagePack reader/writer APIs with explicit array layout checks. |
| src/MSDIAL5/MsdialCore/Algorithm/Annotation/IAnnotationQueryFactory.cs | Removes an unused Accord.Collections using directive. |
| src/MSDIAL5/MsdialCore/Algorithm/Annotation/AnnotatorContainer.cs | Updates annotator container key types + constructors for new restoration-key serialization approach. |
| src/MSDIAL4/StructureFinderStandard/StructureFinderStandard.csproj | Upgrades MessagePack package reference to v3.1.7. |
| src/MSDIAL4/MathematicsStandard/MathematicsStandard.csproj | Upgrades MessagePackAnalyzer to v3.1.7. |
| src/MSDIAL4/DatabaseStandard/DatabaseStandard.csproj | Upgrades MessagePackAnalyzer to v3.1.7. |
| src/Common/CommonStandard/Paramerter/AnalysisParamOfMsdialGcms.cs | Removes redundant/high-index [Key] attributes on backing fields (favoring keyed properties). |
| src/Common/CommonStandard/MessagePack/MessagePackHandler.cs | Migrates handler to MessagePackSerializer with compression + standard resolver. |
| src/Common/CommonStandard/MessagePack/LargeListMessagePack.cs | Reimplements large-list chunking/formatting against the v3 reader/writer API and adds byte-fixture support. |
| src/Common/CommonStandard/DataObj/Property/AdductIon.cs | Migrates custom AdductIon formatter to v3 reader/writer APIs and updates serialization layout. |
| src/Common/CommonStandard/Components/Interfaces/IMoleculeProperty.cs | Migrates IMoleculeProperty formatter to v3 reader/writer APIs with stricter array-length checks. |
| src/Common/CommonStandard/Components/Interfaces/IChromatogramPeakFeature.cs | Replaces union-based interface serialization with a dedicated interface formatter. |
| src/Common/CommonStandard/CommonStandard.csproj | Upgrades MessagePack + analyzer packages to v3.1.7. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+13
to
+26
| public static void Serialize<T>(Stream stream, IReadOnlyList<T> value) { | ||
| if (value is null) { | ||
| MessagePackSerializer.Serialize(stream, value, MessagePackSerializerOptions.Standard.WithResolver(StandardResolver.Instance).WithCompression(MessagePackCompression.Lz4BlockArray)); | ||
| return; | ||
| } | ||
|
|
||
| private static byte[] GetBufferLZ4() | ||
| { | ||
| return new byte[65536]; | ||
| //if (bufferLz is null) | ||
| //{ | ||
| // bufferLz = new byte[65536]; | ||
| //} | ||
| //return bufferLz; | ||
| var options = MessagePackSerializerOptions.Standard.WithResolver(StandardResolver.Instance).WithCompression(MessagePackCompression.Lz4BlockArray); | ||
| Memory<T> memory = (value as T[]) ?? value.ToArray(); | ||
| var length = memory.Length; | ||
| var size = (int)Math.Sqrt(length) + 1; | ||
| var iteration = (length + size - 1) / size; | ||
| for (int i = 0; i < iteration; i++) { | ||
| MessagePackSerializer.Serialize(stream, new SerializingDataContainer<T> { Data = memory.Slice(i * size, Math.Min(size, length - i * size)) }, options); | ||
| } |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… improve/update-messagepack
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…gine' into improve/update-messagepack
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment on lines
+19
to
+26
| var options = MessagePackSerializerOptions.Standard.WithResolver(StandardResolver.Instance).WithCompression(MessagePackCompression.Lz4BlockArray); | ||
| Memory<T> memory = (value as T[]) ?? value.ToArray(); | ||
| var length = memory.Length; | ||
| var size = (int)Math.Sqrt(length) + 1; | ||
| var iteration = (length + size - 1) / size; | ||
| for (int i = 0; i < iteration; i++) { | ||
| MessagePackSerializer.Serialize(stream, new SerializingDataContainer<T> { Data = memory.Slice(i * size, Math.Min(size, length - i * size)) }, options); | ||
| } |
Comment on lines
+19
to
+26
| var options = MessagePackSerializerOptions.Standard.WithResolver(StandardResolver.Instance).WithCompression(MessagePackCompression.Lz4BlockArray); | ||
| Memory<T> memory = (value as T[]) ?? value.ToArray(); | ||
| var length = memory.Length; | ||
| var size = (int)Math.Sqrt(length) + 1; | ||
| var iteration = (length + size - 1) / size; | ||
| for (int i = 0; i < iteration; i++) { | ||
| MessagePackSerializer.Serialize(stream, new SerializingDataContainer<T> { Data = memory.Slice(i * size, Math.Min(size, length - i * size)) }, options); | ||
| } |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
Preserve large-list file compatibility while moving the MessagePack stack to the newer API surface.
This updates the core serializer path, related data objects, and regression tests so existing persisted data and MessagePack round-trips keep working after the upgrade.