Skip to content
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

Prevent runtime incompatibility with 'early-semver' content-api-scala-client #305

Conversation

rtyley
Copy link
Member

@rtyley rtyley commented Jan 25, 2024

closed, as already taken care of in #306 !

Now that both content-api-models and content-api-scala-client are both using 'early-semver' and adhering to it (thanks to gha-scala-library-release-workflow and sbt-version-policy) this should mean that it is no longer possible for a single project that depends on content-api-scala-client, content-api-models and facia-scala-client to have incompatible versions of those artifacts.

This should prevent horrible runtime compatibility errors like #301, which occurred with the rollout of the innocent-looking changes in facia-scala-client v4.0.6.

sbt messaging when incompatibility is introduced

As ana example, this is the "suspected to be binary incompatible" compile time error you'll get in facia-tool if you try to upgrade the FAPI client library to 5.0.0, without also upgrading the version of the CAPI client to match:

[error] (update) found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[error] 
[error] 	* com.gu:content-api-client_2.13:20.0.2 (early-semver) is selected over 19.2.1
[error] 	    +- com.gu:fapi-client-play28_2.13:5.0.0               (depends on 20.0.2)
[error] 	    +- com.gu:content-api-client-default_2.13:19.2.1      (depends on 19.2.1)

Just upgrading the CAPI client version to the ultimately-selected version (20.0.2) will fix the problem here.

In general, you want to upgrade any related library to be compiled against the selected library version - so in the example above, any library we're using in facia-tool that depends on the CAPI client, needs to have been compiled against CAPI client version 20.0.x (the x there is because we can tolerate PATCH level version differences).

@rtyley rtyley changed the title Prevent runtime incompatibility with 'early-semver' Prevent runtime incompatibility with 'early-semver' content-api-scala-client Jan 25, 2024
@rtyley rtyley force-pushed the prevent-runtime-incompatibility-with-early-semver-content-api-scala-client branch from d3dbe31 to dc2a96b Compare January 25, 2024 15:47
@@ -185,6 +185,7 @@ object TestModel {
tags: Seq[StubTag],
elements: Option[Seq[StubElement]]
) extends Content {
val channels: Option[Seq[ContentChannel]] = None // alternatively, create StubContentChannel
Copy link
Member Author

Choose a reason for hiding this comment

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

This is to cope with the channels model changes introduced in guardian/content-api-models#211, which was released with content-api-models v17.6.0 in April 2023.

As none of the tests in facia-scala-client seem to care about the value of channels, its easiest to just make this value None rather than create a StubContentChannel - but if in the future tests do eventually need this value, we can make one.

@@ -1,7 +1,7 @@
import sbt._

object Dependencies {
val capiVersion = "19.2.3"
val capiVersion = "20.0.2-PREVIEW.update-to-latest-version-of-content-api-models-scala.2024-01-25T1416.253f60e5"
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the preview of guardian/content-api-scala-client#405

Copy link

@rtyley has published a preview version of this PR with release workflow run #7, based on commit dc2a96b:

5.0.0-PREVIEW.prevent-runtime-incompatibility-with-early-semver-content-api-scala-client.2024-01-25T1557.dc2a96be

Want to make another preview release?

Click 'Run workflow' in the GitHub UI, specifying the prevent-runtime-incompatibility-with-early-semver-content-api-scala-client branch, or use the GitHub CLI command:

gh workflow run release.yml --ref prevent-runtime-incompatibility-with-early-semver-content-api-scala-client

Want to make a full release after this PR is merged?

Click 'Run workflow' in the GitHub UI, leaving the branch as the default, or use the GitHub CLI command:

gh workflow run release.yml

Now that both content-api-models and content-api-scala-client are both
using 'early-semver' and adhering to it (thanks to
gha-scala-library-release-workflow and sbt-version-policy) this should
mean that it is **no longer possible** for a single project that depends
on content-api-scala-client, content-api-models and facia-scala-client
to have _incompatible_ versions of those artifacts.

guardian/content-api-scala-client#405
@rtyley rtyley force-pushed the prevent-runtime-incompatibility-with-early-semver-content-api-scala-client branch from dc2a96b to fd2cdc6 Compare January 25, 2024 17:50
@@ -1,7 +1,7 @@
import sbt._

object Dependencies {
val capiVersion = "19.2.3"
val capiVersion = "20.0.2"
Copy link
Member Author

@rtyley rtyley Jan 25, 2024

Choose a reason for hiding this comment

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

WIth guardian/content-api-scala-client#405, content-api-scala-client v20.0.2 is the first release of the library that depends upon a version of content-api-models (v18.0.1) where both of them use, and adhere to, 'early-semver'.

@rtyley rtyley marked this pull request as ready for review January 25, 2024 18:01
Copy link

@rtyley has published a preview version of this PR with release workflow run #8, based on commit fd2cdc6:

5.0.0-PREVIEW.prevent-runtime-incompatibility-with-early-semver-content-api-scala-client.2024-01-25T1802.fd2cdc6a

Want to make another preview release?

Click 'Run workflow' in the GitHub UI, specifying the prevent-runtime-incompatibility-with-early-semver-content-api-scala-client branch, or use the GitHub CLI command:

gh workflow run release.yml --ref prevent-runtime-incompatibility-with-early-semver-content-api-scala-client

Want to make a full release after this PR is merged?

Click 'Run workflow' in the GitHub UI, leaving the branch as the default, or use the GitHub CLI command:

gh workflow run release.yml

@rtyley rtyley requested a review from a team January 30, 2024 14:57
@rtyley rtyley force-pushed the prevent-runtime-incompatibility-with-early-semver-content-api-scala-client branch 3 times, most recently from 9767f9d to fd2cdc6 Compare February 28, 2024 14:58
@rtyley
Copy link
Member Author

rtyley commented Feb 28, 2024

This was taken care of in #306, so we can close this PR!

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.

1 participant