Skip to content

Conversation

@jdisanti
Copy link
Contributor

@jdisanti jdisanti commented Feb 16, 2022

Motivation and Context

This adds an RFC describing how we should approach versioning and publishing to crates.io long-term. It incorporates feedback from a previous RFC by breaking the requirement that major.minor versions should be the same across all crates in the SDK.

Rendered

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jdisanti jdisanti requested a review from a team as a code owner February 16, 2022 02:55
@jdisanti jdisanti marked this pull request as draft February 16, 2022 02:55
@github-actions
Copy link

A new doc preview is ready to view.

@github-actions
Copy link

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Server Test

- `patch`: Backwards compatible bug fixes
- `pre`: Pre-release version tag (omitted for normal releases)

In the new versioning strategy, the `minor` version number will no longer be coordinated across
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this the case for all three phases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

- Bug fixes that do not break backwards compatibility
- Model updates that _only_ have documentation changes

During phase 3, bumps to the `major` version must be coordinated across all SDK and runtime crates.
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this a requirement of this proposal? I could definitely imagine wanting to major version bump an individual service that made a breaking change, eg.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I suppose this isn't a hard requirement, but we would be walking away from the ability to make a large refactor and coordinate it under a major version release like the other SDKs do with their V2/V3 releases.


### Release Identification

Since there will no longer be one SDK "version", release tags will be dates in `YYYY-MM-DD` format
Copy link
Collaborator

Choose a reason for hiding this comment

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

this refers to tags on GitHub, not cargo versions, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right

# ...
```

The auto-sync tool is responsible for maintaining this file. When it generates a new SDK, it will take
Copy link
Collaborator

Choose a reason for hiding this comment

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

will there be some way to override / hint?

affect only documentation, but then one model update that affects an API, then as a whole they will be
considered as affecting an API and require a `minor` version bump.

The previously released version number will be retrieved from crates.io using its API. The [smithy-rs] version
Copy link
Collaborator

Choose a reason for hiding this comment

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

conceivably we could track the previously deployed version in versions.toml right?

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 could definitely track it in the versions.toml, but I think this has a greater chance for error than retrieving it from the crates.io index.

Comment on lines 99 to 100
[aws-smithy-types]
version = "0.50.1"
Copy link
Collaborator

Choose a reason for hiding this comment

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

the runtime crate versions here are just for consistency right? they aren't actually required for the system to function?

We could consider tracking published = ... and next = ... in this file which removes the crates.io API dependency (or would just provide a spot to verify)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea was to have all the version numbers for a given release tag centralized in one place, so that's why the runtime crate versions are in here. Nothing else is requiring them to be in this file.


![Phase 1: How to validate a runtime version bump](rfc0012_crates_io_publishing/phase1_runtime_crate_version_checks.svg)

- __A: Crate has changed?__ The crate's source files and manifest will be hashed for the previous version
Copy link
Collaborator

Choose a reason for hiding this comment

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

whats manifest here? Cargo.toml?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. Manifest is the name for a Cargo.toml file according to https://doc.rust-lang.org/cargo/reference/manifest.html:

The Cargo.toml file for each package is called its manifest.

- [ ] Update CI to verify no older runtime crates are used. For example, if `aws-smithy-client` is bumped to
`0.50.0`, then verify no crates (generated or runtime) depend on `0.49.0` or lower.

**Estimate:** 2-4 dev weeks
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this a 50th-95th bound?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Comment on lines 170 to 176
The publisher tool will be updated to read the `versions.toml` to yank all versions published in a release.
This process will look as follows:
1. Take a path to a local clone of the [aws-sdk-rust] repository
2. Confirm the branch is `main` and that HEAD is tagged as a release
3. Read `versions.toml` and print out summary of crates to yank
4. Confirm with user before proceeding
5. Yank crates
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm a little confused about this—I think I'm missing how versions.toml tells you which crates were released and which were not given the current schema—do you have to diff the files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's say we have a bad release at tag bad that we want to yank. The versions.toml file at that tag will have all the crate version numbers associated with that release, but if the publish failed half way through, then some of those might be published to crates.io while others might not be. But that's OK since the yank tool can just check that the version is actually published using the crates.io API before yanking it.

That said, I'm now confused by (2) above. I think I'll revise this to make sure you're on a release tag rather than on main.

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

A new doc preview is ready to view.

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Server Test

@jdisanti jdisanti changed the title RFC: Long-term strategy for publishing to Crates.io RFC: Unsynchronized Crate Versioning Apr 6, 2022
@jdisanti jdisanti marked this pull request as ready for review April 6, 2022 18:08
@github-actions
Copy link

github-actions bot commented Apr 6, 2022

A new doc preview is ready to view.

@github-actions
Copy link

github-actions bot commented Apr 6, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Server Test

@github-actions
Copy link

github-actions bot commented Apr 6, 2022

Rust Wrk benchmark report:

Duration: 90 sec, Connections: 32, Threads: 2

Measurement Deviation Current Old
Requests/sec 11.05% 79316.34 71422.89
Total requests 11.10% 7144439 6430444
Total errors NaN% 0 0
Total successes 11.10% 7144439 6430444
Average latency ms 92.42% 1.27 0.66
Minimum latency ms 0.00% 0.02 0.02
Maximum latency ms 21.07% 23.85 19.7
Stdev latency ms 128.12% 2.19 0.96
Transfer Mb 11.10% 742.67 668.45
Connect errors NaN% 0 0
Read errors NaN% 0 0
Write errors NaN% 0 0
Status errors (not 2xx/3xx) NaN% 0 0
Timeout errors NaN% 0 0

Copy link
Contributor

@Velfi Velfi left a comment

Choose a reason for hiding this comment

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

i had a few comments/questions/suggestions

@@ -0,0 +1,207 @@
RFC: Unsynchronized Crate Versioning
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider "Independent Crate Versioning"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like it.


### Release Identification

Since there will no longer be one SDK "version", release tags will be dates in `YYYY-MM-DD` format
Copy link
Contributor

Choose a reason for hiding this comment

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

What if we release 2+ times in one day?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SDK release automation is limited to one release per day, but there is the question of what this would look like in the event of a manual release taking place in addition to an automatic release. I don't really have a good answer for this currently.

Comment on lines 117 to 122
Code generated crates will have their `minor` version bumped when the version of [smithy-rs] used to generate
them changes, or when model updates with API changes are made. Three pieces of information are required to
handle this process: the previously released version number, the [smithy-rs] version used to generate the code,
and the level of model updates being applied. For this last one, if there are multiple model updates that
affect only documentation, but then one model update that affects an API, then as a whole they will be
considered as affecting an API and require a `minor` version bump.
Copy link
Contributor

Choose a reason for hiding this comment

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

paraphrasing this to make sure I understand

"if we update 2+ models in a release, and at least 1 of those models has API changes, all updated models will receive a minor version bump"

Is that right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So imagine we have the following updates to the S3 model, and the S3 version was previously 1.2.3:

  1. Documentation
  2. Documentation
  3. API change
  4. API change

The new version in this case, will be exactly one minor version bump: 1.3.0

Comment on lines 124 to 127
The previously released version number will be retrieved from crates.io using its API. The [smithy-rs] version
used during code generation will become a build artifact that is saved to `versions.toml` in [aws-sdk-rust].
During phase 1, the tooling required to know if a model is a documentation-only change will not be available,
so all model changes will result in a `minor` version bump during this phase.
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we ever going to run into a situation where we start releasing a version and then it chokes on the crates.io upload because of some problem with our code? If yes, would the versioning get messed up?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think in that case, we would make a code fix to the publisher tool in smithy-rs, and then manually run the publish to fix the partial release. Or, otherwise, fix the publisher tool, yank what got published, and let the next automated release fix things.

Comment on lines 140 to 141
a build step to replace those with a consistent `major.minor` will be removed. These runtime crates will begin
having their actual next version number in the Cargo.toml file in smithy-rs.
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this change

Comment on lines 151 to 152
- __A: Crate has changed?__ The crate's source files and manifest will be hashed for the previous version
and the next version. If these hashes match, then the crate is considered unchanged.
Copy link
Contributor

Choose a reason for hiding this comment

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

Cargo has something like this for incremental compilation right? It'd be kinda neat if we could use that functionality to do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be neat, but I think it would require building a tool that utilizes the compiler internals, and introduce the maintenance burden that comes with that kind of tooling.

number was bumped.
- __E: Semverver passes?__ Runs [rust-semverver] against the old and new versions of the crate.
- If semverver fails to run (for example, if it needs to be updated to the latest nightly to succeed),
then fail CI saying that either semverver needs to be updated, or that a minor version bump is required.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
then fail CI saying that either semverver needs to be updated, or that a minor version bump is required.
then fail CI saying that semverver needs maintenance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The point about a minor version bump being an option should stay, but I like the suggestion of "needs maintenance" over "to be updated".

Comment on lines 199 to 200
When stabilizing to 1.x, the version process will stay the same, but with the introduction of the greater than zero
major version number, the minor version bumps caused by version bumping runtime crates, updating models, or changing
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
When stabilizing to 1.x, the version process will stay the same, but with the introduction of the greater than zero
major version number, the minor version bumps caused by version bumping runtime crates, updating models, or changing
When stabilizing to 1.x, the version process will stay the same, but with the minor version bumps caused by version bumping runtime crates, updating models, or changing

The current wording feels a bit redundant but I don't feel super strongly about this

@jdisanti jdisanti changed the title RFC: Unsynchronized Crate Versioning RFC: Independent Crate Versioning Apr 6, 2022
@github-actions
Copy link

github-actions bot commented Apr 6, 2022

A new doc preview is ready to view.

@github-actions
Copy link

github-actions bot commented Apr 6, 2022

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Server Test

@github-actions
Copy link

github-actions bot commented Apr 6, 2022

Rust Wrk benchmark report:

Duration: 90 sec, Connections: 32, Threads: 2

Measurement Deviation Current Old
Requests/sec 2.67% 76362.36 74379.25
Total requests 2.67% 6879670 6700593
Total errors NaN% 0 0
Total successes 2.67% 6879670 6700593
Average latency ms 21.70% 1.29 1.06
Minimum latency ms 0.00% 0.01 0.01
Maximum latency ms 4.99% 24.2 23.05
Stdev latency ms 20.00% 2.16 1.8
Transfer Mb 2.67% 715.15 696.53
Connect errors NaN% 0 0
Read errors NaN% 0 0
Write errors NaN% 0 0
Status errors (not 2xx/3xx) NaN% 0 0
Timeout errors NaN% 0 0

@rcoh rcoh enabled auto-merge (squash) April 25, 2022 16:53
@github-actions
Copy link

A new generated diff is ready to view.

A new doc preview is ready to view.

Rust Wrk benchmark report:

Duration: 90 sec, Connections: 32, Threads: 2

Measurement Deviation Current Old
Requests/sec -2.57% 38520.12 39537.32
Total requests -2.56% 3470053 3561134
Total errors NaN% 0 0
Total successes -2.56% 3470053 3561134
Average latency ms 1.12% 0.9 0.89
Minimum latency ms 0.00% 0.02 0.02
Maximum latency ms -5.37% 18.85 19.92
Stdev latency ms -8.33% 0.77 0.84
Transfer Mb -2.56% 360.71 370.18
Connect errors NaN% 0 0
Read errors NaN% 0 0
Write errors NaN% 0 0
Status errors (not 2xx/3xx) NaN% 0 0
Timeout errors NaN% 0 0

@rcoh rcoh merged commit 6a028e9 into main Apr 25, 2022
@rcoh rcoh deleted the jdisanti-rfc-crates-io branch April 25, 2022 17:34
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.

3 participants