Polysemy Spar: Laws for DefaultSsoCode, Now, IdP and ScimExternalIdStore#1940
Polysemy Spar: Laws for DefaultSsoCode, Now, IdP and ScimExternalIdStore#1940
Conversation
you should interview your client on those. :) you can talk to either me or @smatting to learn more. |
|
CI seems to be genuinely broken. I'll brave setting up the integration tests locally tomorrow! 😱 |
|
@isovector FYI, the README.md has a section on how to run them locally. |
|
Turns out CI was flakey. Everything is fixed now. @pcapriotti, @fisx , PTAL. |
fisx
left a comment
There was a problem hiding this comment.
Would be nice to run this against the cassandra implementation as well. I would like to have the specs in services/src/Spar/Sem/*/Spec.hs, and have a very small integration test suite that just sticks it all together. But this can be done in the a different PR.
But there are some tests in here that I don't understand. Maybe it's time to pair again?
| -- before and after its generators, and check their results for equality. We | ||
| -- can't use 'Now' as this effect, because 'E.get' won't return equivalent | ||
| -- results! And we can't keep it empty, because that triggers a crash in | ||
| -- @polysemy-check@. Thus @Input ()@, which isn't beautiful, but works fine. |
There was a problem hiding this comment.
if it's an oversight, is there a ticket in polysemy-check for allowing empty effect lists? do you have an idea how to fix it?
| E.deleteConfig s | ||
| pure Nothing |
There was a problem hiding this comment.
I think this test may be pointless if you haven't been careful about the Arbitrary instance. Does it return the same UUID twice in a few calls with non-negligible probability?
There was a problem hiding this comment.
You're right --- it almost certainly doesn't. What would you say are the odds of the generators respecting the size parameter?
There was a problem hiding this comment.
I have no idea. :) experiment? I'm not sure that's the right approach, though. We want the keys to come from a small set so that collisions are common, but not anything else. If we didn't use quickcheck but registry, we could "easily" replace the underlying UUID and Issuer generators, but with quickcheck I'm not sure what to do.
(Note to self: the Issuer generator may have not enough entropy, instead of too much. With some of the generators I've been quite lazy.)
| getReplacedBy replaced_id, | ||
| do | ||
| E.setReplacedBy replaced replacing | ||
| (Just replacing_id <$) <$> E.getConfig replaced_id |
There was a problem hiding this comment.
... and I'm not sure this is making too much sense. What are you trying to test here?
There was a problem hiding this comment.
This shows that getReplacedBy actually gives you back what you replaced it by, right?
There was a problem hiding this comment.
Yes, but why the getConfig? Why just pure $ Just replacing_id? (Sorry, my first question wasn't very helpful. It was late...)
There was a problem hiding this comment.
Ah, yeah. Because this is a Maybe (Maybe IdPId) where the outer maybe depends on whether the thing exists in the first place.
Co-authored-by: fisx <mf@zerobuzz.net>
|
@fisx good catch --- coverage checking pointed out that we were hitting lots of pathological cases. I think I've the worrisome ones. |
|
@fisx I'd like to get this merged. |
| if s ^. SAML.idpId == s' ^. SAML.idpId | ||
| then discard | ||
| else pure () | ||
| when (s ^. SAML.idpId == s' ^. SAML.idpId) discard |
There was a problem hiding this comment.
didn't we say this has negligible probability?
| @@ -0,0 +1 @@ | |||
| Added laws for DefaultSsoCode, Now, IdP and ScimExternalIdStore | |||
There was a problem hiding this comment.
this may be a bit confusing for the casual reader of the release notes. i'll fix it on develop after merging.
This PR adds polysemy-check laws for
Now,DefaultSsoCode,IdPandScimExternalIdStore.Nowis just a check that the function is monotonic, and the other three are the usual lens laws (+ delete).The remaining "store" effects in
sparhave weird TTL semantics that I haven't yet worked out what the laws should be. I'll follow up with those when I figure the semantics out.Checklist
changelog.d.