Skip to content

fix: prevent duplicate keys in MetadatumMap arbitrary generator#47

Merged
solidsnakedev merged 1 commit into
mainfrom
fix/flaky-auxiliarydata-test
Oct 23, 2025
Merged

fix: prevent duplicate keys in MetadatumMap arbitrary generator#47
solidsnakedev merged 1 commit into
mainfrom
fix/flaky-auxiliarydata-test

Conversation

@solidsnakedev
Copy link
Copy Markdown
Collaborator

The property-based test generator for MetadatumMap was creating invalid metadata by allowing duplicate keys (e.g., two empty strings). When duplicate keys were added to the Map, the second insertion would overwrite the first, causing a mismatch between the expected array length and actual Map size.

This caused flaky test failures in AuxiliaryData.CML.test.ts when comparing Evolution SDK CBOR output with CML CBOR output.

Fixed by using FastCheck.uniqueArray with a selector function that ensures unique keys based on their string values.

Fixes intermittent CI failures in test/AuxiliaryData.CML.test.ts

The property-based test generator for MetadatumMap was creating
invalid metadata by allowing duplicate keys (e.g., two empty strings).
When duplicate keys were added to the Map, the second insertion
would overwrite the first, causing a mismatch between the expected
array length and actual Map size.

This caused flaky test failures in AuxiliaryData.CML.test.ts when
comparing Evolution SDK CBOR output with CML CBOR output.

Fixed by using FastCheck.uniqueArray with a selector function that
ensures unique keys based on their string values.

Fixes intermittent CI failures in test/AuxiliaryData.CML.test.ts
Copilot AI review requested due to automatic review settings October 23, 2025 16:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fixes a test flakiness issue caused by duplicate keys in the MetadatumMap property-based test generator. The generator was creating invalid metadata maps where duplicate keys would overwrite each other, causing mismatches between expected and actual map sizes during CBOR serialization comparisons.

  • Changed from FastCheck.array to FastCheck.uniqueArray to prevent duplicate keys
  • Added a selector function that ensures uniqueness based on the TextMetadatum string values

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@solidsnakedev solidsnakedev merged commit f772bc8 into main Oct 23, 2025
5 checks passed
@solidsnakedev solidsnakedev deleted the fix/flaky-auxiliarydata-test branch October 23, 2025 16:32
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