Skip to content
This repository has been archived by the owner on Feb 3, 2018. It is now read-only.

Refactor hashing #143

Merged
merged 12 commits into from
Jan 15, 2017
Merged

Refactor hashing #143

merged 12 commits into from
Jan 15, 2017

Conversation

sdboyer
Copy link
Owner

@sdboyer sdboyer commented Jan 14, 2017

#139 was prematurely merged.

  • Refactor tests to pass with new input set
  • Cover combination cases with new tests
  • Separate tests for rootdata ops
  • Introduce logic for typed constraint string dumps
  • Dump Source unconditionally from constraints, normalizing via method

We DON'T actually want to dump the source unconditionally, as they're not semantically equivalent - an empty ProjectIdentifier.Source allows for the possibility of having the source switched on the fly by something that comes along later in the algorithm.

This provides a convenient way of letting the debugging func inject a
newline after each write (for readability in debugging).
This separates a bunch of the static state/rules/information that comes
from the root project and input parameters into a discrete subsystem.
The only real benefit here is focusing the state tracked by the solver
in on the actual algorithm of solving, and less so these static rules -
which should make it a bit easier for other people to grok.
All changes are geared towards making "default"-type values explicit, as
that increases the likelihood that equivalent inputs will produce
identical hash digests.
@sdboyer sdboyer added this to the v0.14.0 milestone Jan 14, 2017
@sdboyer sdboyer self-assigned this Jan 14, 2017
Hashing functions are exquisitely sensitive to inputs - that's why
they're useful. But it makes them a PITA to work with. Having an
easy-to-scan visualization of hashing inputs in tests frees up cognitive
capacity to focus on the algorithm.
@codecov-io
Copy link

codecov-io commented Jan 15, 2017

Current coverage is 77.68% (diff: 90.29%)

Merging #143 into master will increase coverage by 0.39%

@@             master       #143   diff @@
==========================================
  Files            24         25     +1   
  Lines          3694       3759    +65   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           2855       2920    +65   
- Misses          633        635     +2   
+ Partials        206        204     -2   

Powered by Codecov. Last update 65939b4...85a0fc3

To further improve debugging of issues with the input hashing, this adds
"section headers" - strings that are output prior to each type of data
that's present in the cache.

Also partially switched to progressive mutation table-based tests for
input hashing, and added test cases that cover salient combinations of
overrides, imports, and constraints.
Makes it easier to see problem spots on a quick scan.
These solve the problem, at least in the hasher, of the possibility for
strings representing different types of versions to collide. For
example, prior to this change, a branch constraint named "foo" and a
version constraint named "foo" could cause the hasher to produce the
same hash, even though the two inputs would not have admitted the same
solution set.
@sdboyer sdboyer merged commit 69fdac2 into master Jan 15, 2017
@sdboyer sdboyer deleted the refactor-hashing branch April 5, 2017 18:33
krisnova pushed a commit to krisnova/dep that referenced this pull request Apr 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants