Skip to content

Conversation

@mdimjasevic
Copy link
Contributor

@mdimjasevic mdimjasevic commented Feb 14, 2022

(Do not merge before Sept 2022 and/or before most deployments are on chart version >= 4.1.0. In case this is merged and deployed before 4.1.0 was deployed first, a transient period of the time it takes to roll out a deployment (in the order of minutes usually) of 'HTTP status 500 internal server errors' on client API calls to conversations can happen.)

This PR is a follow-up to PR #2125 that was merged on Feb 14, 2022.

The PR also removes the managed key from JSON instances in client API version 2. This makes it a client API breaking change so versioning is used; version 1 is kept intact.

Checklist

  • Rebase on top of the latest develop. Make sure to update schemaVersion in Galley and rename services/galley/schema/src/V60_DropManagedConversations.hs accordingly.
  • 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 a cassandra 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 (details):
    • 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 cassandra schema migration is backwards incompatible (see also these docs), measures to be taken by on-premise instance operators are explained.

@mdimjasevic mdimjasevic marked this pull request as draft August 31, 2022 11:12
@mdimjasevic mdimjasevic changed the title [DO_NOT_MERGE] Drop the managed Column from team_conv Table in Galley Drop the managed Column from team_conv Table in Galley Aug 31, 2022
Marko Dimjašević added 2 commits September 1, 2022 11:22
- This is a breaking API change. In FromJSON instances, this key was
already ignored during parsing, but now it is removed from ToJSON
instances as well. The change is reflected only in version 2 of the
client API, and version 1 stays intact.
@mdimjasevic mdimjasevic force-pushed the mdimjasevic/drop-managed-conv-schema branch from 57332e1 to 58281d8 Compare September 1, 2022 09:24
@mdimjasevic mdimjasevic temporarily deployed to cachix September 1, 2022 09:24 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 1, 2022 09:24 Inactive
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Sep 1, 2022
@mdimjasevic mdimjasevic marked this pull request as ready for review September 1, 2022 09:49
@mdimjasevic mdimjasevic temporarily deployed to cachix September 1, 2022 10:13 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 1, 2022 10:13 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 1, 2022 10:15 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 1, 2022 10:15 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 1, 2022 11:57 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 1, 2022 11:57 Inactive
@pcapriotti
Copy link
Contributor

I'm not sure how the version bounds meant for servant routes ended up in API types, but I would recommend not doing that. As discussed, I don't think we need separate types for older versions, because this feature never actually worked and was never used. We only need to support the interface in V1, not the functionality. So I would only have the types for v2, and just make the JSON instances backward compatible. No messing around with versions should be necessary.

Marko Dimjašević added 3 commits September 2, 2022 12:54
- This puts them back to their old instances as we never output these
types, and it doesn't really matter that we keep the "managed" key in
JSON instances as it is ignored when parsing anyway.
@mdimjasevic mdimjasevic temporarily deployed to cachix September 5, 2022 20:32 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 5, 2022 20:32 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 5, 2022 20:37 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 5, 2022 20:37 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 5, 2022 20:45 Inactive
@mdimjasevic
Copy link
Contributor Author

I'm not sure how the version bounds meant for servant routes ended up in API types, but I would recommend not doing that. As discussed, I don't think we need separate types for older versions, because this feature never actually worked and was never used. We only need to support the interface in V1, not the functionality. So I would only have the types for v2, and just make the JSON instances backward compatible. No messing around with versions should be necessary.

I've reverted the changes to the ConvTeamInfo and NewConv types to incorporate your feedback: they are never used in output/responses, so it doesn't hurt to have managed in their ToJSON instances.

However, TeamConversation and TeamConversationList do end up in output/endpoint responses, so for both of them I've introduced a version boundary type index so we can provide different ToJSON instances depending on the version used.

Can you take a look again?

@mdimjasevic mdimjasevic temporarily deployed to cachix September 7, 2022 12:36 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 7, 2022 12:36 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 7, 2022 12:37 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 7, 2022 12:37 Inactive
@elland elland requested a review from pcapriotti September 7, 2022 12:41
@mdimjasevic mdimjasevic temporarily deployed to cachix September 7, 2022 12:54 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 7, 2022 12:54 Inactive
@pcapriotti
Copy link
Contributor

pcapriotti commented Sep 8, 2022

However, TeamConversation and TeamConversationList do end up in output/endpoint responses, so for both of them I've introduced a version boundary type index so we can provide different ToJSON instances depending on the version used.

I still don't think this is necessary. Just output a managed field with a value of false regardless of the version, and make it deprecated. Ideally, hide it from swagger if that's not too hard to achieve, so we can drop it when V1 becomes unsupported. Also, combinators like From V2 are not intended to be used as type arguments for data types like that. If you ever actually need a type that depends on a version, just use the version itself or simply make a different type with a V2 suffix or similar.

@mdimjasevic mdimjasevic temporarily deployed to cachix September 8, 2022 13:53 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 8, 2022 13:53 Inactive
@mdimjasevic
Copy link
Contributor Author

However, TeamConversation and TeamConversationList do end up in output/endpoint responses, so for both of them I've introduced a version boundary type index so we can provide different ToJSON instances depending on the version used.

I still don't think this is necessary. Just output a managed field with a value of false regardless of the version, and make it deprecated. Ideally, hide it from swagger if that's not too hard to achieve, so we can drop it when V1 becomes unsupported. Also, combinators like From V2 are not intended to be used as type arguments for data types like that. If you ever actually need a type that depends on a version, just use the version itself or simply make a different type with a V2 suffix or similar.

Thanks for this comment and a thorough explanation in a call. I think I've addressed all of your feedback and it should be fine now. Can you take a look?

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 good to me.

@mdimjasevic mdimjasevic temporarily deployed to cachix September 8, 2022 14:58 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 8, 2022 14:58 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 8, 2022 15:00 Inactive
@mdimjasevic mdimjasevic temporarily deployed to cachix September 8, 2022 15:00 Inactive
@mdimjasevic mdimjasevic merged commit 40f8184 into develop Sep 8, 2022
@mdimjasevic mdimjasevic deleted the mdimjasevic/drop-managed-conv-schema branch September 8, 2022 19:45
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