Skip to content

Comments

[FS-926] Create new conversation type for global team conversation#2753

Merged
elland merged 11 commits intodevelopfrom
fs-926-add-global-team-conv
Nov 23, 2022
Merged

[FS-926] Create new conversation type for global team conversation#2753
elland merged 11 commits intodevelopfrom
fs-926-add-global-team-conv

Conversation

@elland
Copy link
Contributor

@elland elland commented Oct 6, 2022

This should cover FS-927, as the endpoint has been added.

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

@elland elland temporarily deployed to cachix October 6, 2022 11:28 Inactive
@elland elland temporarily deployed to cachix October 6, 2022 11:28 Inactive
@elland elland changed the title Added basic route to fetch global team conv. [FS-926] Create new conversation type for global team conversation Oct 6, 2022
@elland elland temporarily deployed to cachix October 6, 2022 11:29 Inactive
@elland elland temporarily deployed to cachix October 6, 2022 11:29 Inactive
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Oct 6, 2022
@elland elland temporarily deployed to cachix October 6, 2022 11:57 Inactive
@elland elland temporarily deployed to cachix October 6, 2022 11:57 Inactive
@elland elland temporarily deployed to cachix October 6, 2022 12:07 Inactive
@elland elland temporarily deployed to cachix October 6, 2022 12:07 Inactive
@elland elland temporarily deployed to cachix October 11, 2022 11:59 Inactive
@elland elland temporarily deployed to cachix October 11, 2022 11:59 Inactive
@elland elland temporarily deployed to cachix October 11, 2022 12:18 Inactive
@elland elland temporarily deployed to cachix October 11, 2022 12:18 Inactive
@elland elland force-pushed the fs-926-add-global-team-conv branch from 7ce19ea to 413ebff Compare October 11, 2022 12:38
@elland elland temporarily deployed to cachix October 11, 2022 12:38 Inactive
@elland elland temporarily deployed to cachix October 11, 2022 12:39 Inactive
@elland elland force-pushed the fs-926-add-global-team-conv branch from 413ebff to 4d99a54 Compare October 11, 2022 13:04
@elland elland temporarily deployed to cachix October 11, 2022 13:04 Inactive
@elland elland temporarily deployed to cachix October 11, 2022 13:04 Inactive
@elland elland temporarily deployed to cachix October 12, 2022 08:43 Inactive
@elland elland temporarily deployed to cachix October 12, 2022 08:43 Inactive
@elland elland temporarily deployed to cachix October 12, 2022 14:02 Inactive
@elland elland temporarily deployed to cachix October 12, 2022 14:02 Inactive
@elland elland temporarily deployed to cachix October 12, 2022 14:07 Inactive
@elland elland temporarily deployed to cachix October 12, 2022 14:07 Inactive
@elland elland temporarily deployed to cachix October 13, 2022 07:36 Inactive
@elland elland temporarily deployed to cachix October 13, 2022 07:36 Inactive
@elland elland temporarily deployed to cachix October 13, 2022 08:31 Inactive
@elland elland temporarily deployed to cachix November 21, 2022 09:29 Inactive
@elland elland temporarily deployed to cachix November 21, 2022 09:29 Inactive
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.

There are a few issues, see comments below.

I can't find the code that produces the correct rendering of GTCs when fetched through the normal POST /conversations/list API. There is also no test for listing.

And one more thing that seems to be missing is creating the GTC entry on the list-ids endpoint, so that clients don't need to rely on the mutating semantics of the GET endpoint, just like what we discussed for the self conversation.

@elland elland temporarily deployed to cachix November 21, 2022 15:11 Inactive
@elland elland temporarily deployed to cachix November 21, 2022 15:11 Inactive
@elland elland temporarily deployed to cachix November 21, 2022 15:15 Inactive
@elland elland temporarily deployed to cachix November 21, 2022 15:15 Inactive
@elland elland temporarily deployed to cachix November 22, 2022 13:49 Inactive
@elland elland temporarily deployed to cachix November 22, 2022 13:49 Inactive
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.

Looks generally good, but I would consider changing the way the creator of a GTC is handled. Since a GTC doesn't really have a creator, I would just try to make the code reflect that, instead of forcing one. That means changing the types around a bit, but it shouldn't be a huge effort.

I'll approve for now and let you decide if it's worth doing that or not.

@elland elland temporarily deployed to cachix November 23, 2022 07:54 Inactive
@elland elland temporarily deployed to cachix November 23, 2022 07:54 Inactive
@mdimjasevic mdimjasevic self-requested a review November 23, 2022 09:11
@mdimjasevic mdimjasevic dismissed their stale review November 23, 2022 09:26

A likely outdated review

@elland elland merged commit c4c9ea2 into develop Nov 23, 2022
@elland elland deleted the fs-926-add-global-team-conv branch November 23, 2022 09:33
)
<!! do
const 201 === statusCode
const True === isJust . getHeader "Location"
Copy link
Member

Choose a reason for hiding this comment

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

why all this reformatting as part of this PR? Makes it much harder to see actual changes that happened.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We had some issues with ormolu, I might have missed some places.

Sem r Data.Conversation
getLocalConvForUser qusr lcnv = do
conv <- getConversation (tUnqualified lcnv) >>= noteS @'ConvNotFound
gtc <- getGlobalTeamConversationById lcnv
Copy link
Member

Choose a reason for hiding this comment

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

I don't like the sideeffects introduced here into each lookup of a conversation. This looks badly designed.

Elsewhere, it seems global team conversation id is the same as the team Id (even though this is not documented anywhere; and it means there can only ever be one single global team conversation). Can't this mean you can tell earlier, if you have a user object available, you'd know their team, and already know which kind of conv you're dealing with, without an extra lookup?

And why does a GET of any conversation ID lead to an insert of a random user as creator of this conversation? That makes no sense semantically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We're taking this out in a follow-up 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't like the sideeffects introduced here into each lookup of a conversation. This looks badly designed.

Global team conversations and self conversations are not explicitly created, they are always there conceptually. To keep things consistent with other conversations, we still create records for them in the database at the first chance we get. Namely, they are created when first accessed or when conversations are listed. This way, the creation side effect cannot be observable from the outside.

The reason for this design is to limit the number of places where we have to take some kind of hacky "lock", which is pretty much impossible to do reliably with cassandra. We are already taking one of these locks when processing a commit (and there is no way around that). With this design, we don't need to figure out a way to deal with multiple concurrent creations of the conversation, since all mutable actions happen within commits, and creation itself is idempotent.

And why does a GET of any conversation ID lead to an insert of a random user as creator of this conversation? That makes no sense semantically.

I agree, the creator should not be set on query. That would make creation not idempotent.

smatting added a commit that referenced this pull request Nov 28, 2022
smatting added a commit that referenced this pull request Dec 9, 2022
@smatting smatting mentioned this pull request Dec 9, 2022
1 task
smatting added a commit that referenced this pull request Dec 9, 2022
* Revert "[FS-1267] Patch issue with initial commit bundle throwing a global team conversation error (#2887)"

This reverts commit 1cc2bd2.

* Revert "Commented out GTC for release. (#2879)"

This reverts commit 49da310.

* Revert "Improve global team conversation handling and self conversation creation error. (#2862)"

This reverts commit 381bf7b.

* Revert "[FS-926] Create new conversation type for global team conversation (#2753)"

This reverts commit c4c9ea2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants