unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.81k stars 271 forks source link

Make hash of cacheable code the same as if it were uncached #5409

Closed dolio closed 1 month ago

dolio commented 1 month ago

This implements the change that throws away the cacheability information when serializing for hashing, so that it doesn't influence the hash.

Also tweaks the interpreter-tests.sh file to accept a ucm on the command line, and falls back to using stack to find the file, which was accidentally changed in the last PR. This will avoid me accidentally changing it in the future.

pchiusano commented 1 month ago

@dolio @SystemFw before merging this, I'm uncertain how your test in cloud client passed before (that the hashes of things didn't change). It seems like until this PR, the hash of a bunch of things would have changed, and that would have caused your test to fail.

dolio commented 1 month ago

What is being hashed? Most stuff didn't change. Only the hash of Code values.

pchiusano commented 1 month ago

Oh okay, what about the hash of a Unison function? As in:

blah x = x + 938

> crypto.hash Sha3_256 blah

You're saying that never was changed, even before this PR?

dolio commented 1 month ago

Right, that is a partial application whose hash is based on the reference for blah and its arguments (but there are 0 in this case). The only thing that would change hash is if you asked for the Code of blah and then hashed it.