Skip to content

Update MessagePack compatibility and tests#747

Open
YukiMatsuzawa wants to merge 39 commits into
masterfrom
improve/update-messagepack
Open

Update MessagePack compatibility and tests#747
YukiMatsuzawa wants to merge 39 commits into
masterfrom
improve/update-messagepack

Conversation

@YukiMatsuzawa

Copy link
Copy Markdown
Contributor

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.

YukiMatsuzawa and others added 22 commits July 6, 2026 15:15
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>
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);
}
Comment thread src/Common/CommonStandard/MessagePack/LargeListMessagePack.cs Outdated
Comment thread src/MSDIAL5/MsdialCore/Algorithm/Annotation/AnnotatorContainer.cs Outdated
Comment thread src/Common/CommonStandard/Components/Interfaces/IMoleculeProperty.cs Outdated
Comment thread src/Common/CommonStandard/DataObj/Property/AdductIon.cs
YukiMatsuzawa and others added 5 commits July 9, 2026 20:33
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>
YukiMatsuzawa and others added 5 commits July 10, 2026 15:12
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 37 changed files in this pull request and generated 7 comments.

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 thread src/Common/CommonStandard/MessagePack/LargeListMessagePack.cs Outdated
Comment thread src/MSDIAL5/MsdialCore/Algorithm/Annotation/AnnotatorContainer.cs Outdated
Comment thread src/MSDIAL5/MsdialCore/DataObj/ProteomicsAnnotatorParameterPair.cs
Comment thread src/MSDIAL5/MsdialCore/DataObj/EadLipidAnnotatorParameterPair.cs
Comment thread src/MSDIAL5/MsdialCore/Algorithm/Annotation/AnnotatorContainer.cs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 37 changed files in this pull request and generated 4 comments.

Comment thread src/Common/CommonStandard/Components/Interfaces/IMoleculeProperty.cs Outdated
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 thread src/MSDIAL5/MsdialCore/Parser/IReferRestorationKey.cs Outdated
Comment thread src/MSDIAL5/MsdialCore/Parser/IReferRestorationKey.cs Outdated
YukiMatsuzawa and others added 3 commits July 13, 2026 19:06
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants