Skip to content

Fix normalized hash test in case of collisions. - #2870

Merged
DavyLandman merged 1 commit into
mainfrom
fix/normalized-hash-collision
Aug 27, 2026
Merged

Fix normalized hash test in case of collisions.#2870
DavyLandman merged 1 commit into
mainfrom
fix/normalized-hash-collision

Conversation

@toinehartman

@toinehartman toinehartman commented Aug 26, 2026

Copy link
Copy Markdown
Member

Allow normalized hash collisions in tests in case there would be a hash collision for the input strings anyway.

Example failure:
https://github.com/usethesource/rascal/actions/runs/32944398075/job/98103370299

rascal>import IO;
ok
rascal>str1 = "𠙹𠟒𒇇𠢆𒑡𡓅𒌓";
str: "��������������"
───
𠙹𠟒𒇇𠢆𒑡𡓅𒌓
───

rascal>str2 = "𠌰𒄇𒑃𒎔𒉱𠤿𠙨";
str: "��������������"
───
𠌰𒄇𒑃𒎔𒉱𠤿𠙨
───

rascal>md5Hash(str1) == md5Hash(str2);
bool: true

Fixes test added in:

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46%. Comparing base (16abf95) to head (197225b).

Additional details and impacted files
@@           Coverage Diff           @@
##              main   #2870   +/-   ##
=======================================
- Coverage       46%     46%   -1%     
+ Complexity    6776    6768    -8     
=======================================
  Files          844     844           
  Lines        67103   67103           
  Branches     10022   10022           
=======================================
- Hits         30903   30884   -19     
- Misses       33828   33842   +14     
- Partials      2372    2377    +5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DavyLandman DavyLandman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ouch, our random test actually found a md5 hash collision?

@DavyLandman
DavyLandman merged commit 4f96714 into main Aug 27, 2026
9 checks passed
@toinehartman

Copy link
Copy Markdown
Member Author

Exactly! But the test was formulated in a way that never allowed collisions of the 'normalized' hash. Now we allow a 'normalized' has collision whenever there would be a collision on the raw strings.

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.

2 participants