-
Notifications
You must be signed in to change notification settings - Fork 114
Fix exception in explain-activation #346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix exception in explain-activation #346
Conversation
d01e761
to
bbabe3e
Compare
The changes basically look correct to me; looks like I broke this in #276. Thanks for submitting a PR for this.
have "< 0 temperature" in the string somewhere using a regex. Unfortunately testing against strings is messy (which is why we tested against the underlying inspection API instead) but even a very simple test could help prevent errors like this in the future. Clojure's with-out-str would allow such a test to capture the output.
FYI I'll be otherwise occupied next week so I may not reply to anything here until the week after that. I can help with the testing on this then if desired. |
RE: Changelog/contributors -- I was trying to follow the CONTRIBUTING.md guidelines and existing patterns there. I'm happy to remove either or both; my only interest here is having the function not crash. |
The logic around ensuring the data underlying explanations is correct is already tested elsewhere, so I've added a simple test that the function doesn't crash. This may need to be expanded, but it's a start and will ensure this specific issue doesn't regress. |
@dgoeke please squash your commits together; we prefer to have each commit in the history reflect a distinct logical change to Clara rather than a step in development. Otherwise I'm OK with merging this. I'll leave it open for now in case anyone else wants to look at this, but I'll plan to merge this in the week after next when I'm back and don't object if someone else merges it before then. |
Looks good to me, modulo the squash that Will mentioned. Thanks for fixing and contributing this to the project! |
Previously, when iterating over a list of matches, each match was assumed to be a vector of `[fact condition]` but was actually a map of `{:fact ... :condition ...}`. Destructuring the map into a vector threw an UnsupportedOperationException.
92da8d9
to
a77515c
Compare
Updated with a squashed commit. I'm accustomed to just using the github "squash and merge" feature on PRs. |
Previously, when iterating over a list of matches, each match
was assumed to be a vector of
[fact condition]
but was actuallya map of
{:fact ... :condition ...}
. Destructuring the map intoa vector threw an UnsupportedOperationException.