feat(core): compress ValidMeasurementResults when serializing#769
Merged
Conversation
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Member
Author
|
I confirmed the minimization is happening by running a new operation using https://ibm.github.io/ado/examples/no-priors-characterization/ I was then able to do |
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
michael-johnston
requested changes
Mar 31, 2026
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Co-Authored-By: Michael Johnston <66301584+michael-johnston@users.noreply.github.com> Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.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
This PR implements a compressed serialization format for
ValidMeasurementResultto eliminate redundantExperimentReferencedata. Instead of repeating the sameExperimentReferencein every measurement's property, it's now stored once at the top level, significantly reducing serialized size. The implementation maintains full backward compatibility with the old format.Resolves #709
Files Changed
📄
orchestrator/schema/result.pyAdded custom serialization and deserialization methods to
ValidMeasurementResultclass:serialize_to_custom_format(): Custom serializer that extracts the commonExperimentReference(validated to be identical across all measurements) and stores it at the top level, removing it from individualObservedPropertyValueentries. Properly handles all Pydantic serialization settings likeexclude_none,exclude_defaults, etc.deserialize_from_custom_format(): Custom validator that handles both old (redundant) and new (compressed) formats, ensuring backward compatibility. Detects the format and reconstructs measurements appropriately.📄
tests/schema/test_measurement_result.pyAdded comprehensive test coverage for the new serialization format:
test_compressed_serialization_format(): Verifies the new format structure withexperimentReferenceat top leveltest_old_format_deserialization(): Ensures backward compatibility by testing deserialization of old format datatest_new_format_deserialization(): Validates correct deserialization of the new compressed formattest_serialization_deserialization_roundtrip(): Tests full roundtrip to ensure data integritytest_compression_achieved(): Quantifies compression benefits by comparing serialized sizestest_json_serialization_roundtrip(): Verifies JSON string serialization/deserialization works correctly with the new format