Closed dfellis closed 2 years ago
I had a related conversation with @isaacbrodsky here: https://github.com/uber/h3-java/pull/36
You are correct, I should check the output of h3Line
for completeness (I'm updating the title of this issue to reflect that). But with the current implementation of h3Line
, it is (almost certainly) impossible to get a non-zero exit code here IFF you got a a value > 0 from h3LineSize
. Both functions just delegate immediately to h3Distance
under the hood.
So while you're right that we should check, the error condition here is (almost certainly) unreachable, and is unlikely to be the source of your bug. I think it's more likely you're running into undefined output due to whatever is behind https://github.com/uber/h3/issues/184.
Hmm... So it looks like Isaac is planning to dig into that issue, but do you have any proposal right now? Maybe I should just confirm that 90+% of the runs succeed? (That would still have very intermittent failures if the random number generator ever does more than 10% lines through pentagons.)
Not sure. Possibilities here:
I don't necessarily think that asserting identical output here is a big issue, since we explicitly don't guarantee stable output across versions - there are multiple "correct" answers here, so the important concern is guaranteeing the properties of the output, not necessarily the consistency of the output.
Well, I am trying to guarantee that the major and minor version numbers for h3-node match those of h3-js so it can be a drop-in replacement (assuming no error condition reached) for anyone wanting a perf boost on Node apps.
Let me think about it a bit more. The random-but-valid input approach was nice as a kind of fuzzing, as well (which is how I found this discrepancy in the first place).
This issue should be covered by the new error handling in #139
Hey @nrabinowitz
So h3-node currently (ab)uses h3-js for unit testing by just confirming that the outputs of both are identical given semi-random inputs.
I've noticed intermittent failures in the
h3Line
test, and after digging through the code, I think the issue might be on the h3-js side.We can see in the declaration of the h3Line function that it returns an integer value.
And in the documentation on the implementation that the return value is an error/success status code
So the h3-node implementation of binding h3Line includes a check for that status
But the h3-js implementation of binding h3Line ignores that status
I'd normally just make a PR to fix this, but since you implemented the C version of the code and the JS bindings, I wanted to bring this up before, in case this was actually intentional?