Skip to content

#1755 follow-up#1763

Merged
fisx merged 23 commits intodevelopfrom
pr-1755-follow-up
Sep 16, 2021
Merged

#1755 follow-up#1763
fisx merged 23 commits intodevelopfrom
pr-1755-follow-up

Conversation

@fisx
Copy link
Contributor

@fisx fisx commented Sep 13, 2021

Stuff that should have been part of #1755, but wasn't due to time pressure. See CHANGELOG and individual commits for details. It probably makes sense to read this changelog.d first, then commit-by-commit.

Checklist

  • The PR Title explains the impact of the change.
  • The PR description provides context as to why the change should occur and what the code contributes to that effect. This could also be a link to a JIRA ticket or a Github issue, if there is one.
  • If end-points have been added or changed: the endpoint / config-flag checklist (see Wire-employee only backend wiki page) has been followed.
  • If a schema migration has been added, I ran make git-add-cassandra-schema to update the cassandra schema documentation.
  • changelog.d contains the following bits of information:
    • A file with the changelog entry in one or more suitable sub-sections. The sub-sections are marked by directories inside changelog.d.
    • If /a: measures to be taken by instance operators.
    • If /a: list of cassandra migrations.
    • If public end-points have been changed or added: does nginz need upgrade?
    • If internal end-points have been added or changed: which services have to be deployed in a specific order?

@fisx fisx force-pushed the pr-1755-follow-up branch from a35c98f to 6e3c4b9 Compare September 14, 2021 07:45
@fisx fisx changed the title #1755 follow-up [skip ci] #1755 follow-up Sep 14, 2021
@fisx fisx marked this pull request as ready for review September 14, 2021 10:25
@fisx fisx requested a review from julialongtin September 14, 2021 10:26
@fisx fisx force-pushed the pr-1755-follow-up branch from 19493be to 024a526 Compare September 15, 2021 10:08
fisx added 19 commits September 15, 2021 14:34
(idp by issuer is stored either in one or the other table, never in
both, so this doesn't matter except for considerations as to which is
most likely to fail and should therefore be tried last.)
`guardReplaceeV2` was never called, and what it checks is already
checked in the beginning of `validateNewIdP`; `guardSameTeam` was
either testing a tautology or a falsehood, depending on the call side,
so it was easy to simplify.
There is an error in this test if we do it the way it's supposed to
work, but if we move an offending entry out of the way in
`spar.issure_idp_v2` before running into the bug, the test passes.

Revert of this commit and proper fix coming up!
This reverts commit 024a526b8bc1e3d3a925a6d8fe85acb6a548efbe.
@fisx fisx force-pushed the pr-1755-follow-up branch from fc8ecb0 to adfd1e4 Compare September 15, 2021 12:37
@fisx fisx force-pushed the pr-1755-follow-up branch from 370d1cf to 178ea3b Compare September 15, 2021 13:02
Copy link
Contributor

@pcapriotti pcapriotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in a call.

Data.GetIdPNotFound -> pure ()
res@(Data.GetIdPDanglingId _) -> throwSpar . SparIdPNotFound . ("validateNewIdP: " <>) . cs . show $ res -- database inconsistency
res@(Data.GetIdPNonUnique _) -> throwSpar . SparIdPNotFound . ("validateNewIdP: " <>) . cs . show $ res -- impossible
Data.GetIdPNonUnique ids' {- same team didn't yield anything, but there are at least two other teams with this issuer already -} -> handleIdPClash (Left ids')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems unnecessary to distinguish between the "non unique" case and the "wrong team", since "non unique" implies "wrong team", and they can still be distinguished by the size of the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, but separate PR. (And I think this may become more obvious of a change if I make the CRUD API for IdPs in Spar.Data less abstract, and expose functions that do precisely what's needed on the call side, and nothing else.)

| GetUserNotFound
| GetUserNoTeam
| GetUserWrongTeam
deriving (Eq, Show)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can just deriving Functor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will fix in an upcoming PR. (Also for GetIdPResult in Spar.Data.)

@fisx fisx merged commit 7c82d38 into develop Sep 16, 2021
@fisx fisx deleted the pr-1755-follow-up branch September 16, 2021 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants