Unverified Commit 979c0cac authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Fix runtime-versioner audit edge case with SDK releases (#3581)

In the time gap between smithy-rs and SDK releases, the
runtime-versioner can incorrectly allow changes to aws/rust-runtime
crates without version bumping. This PR fixes this issue by detecting
this edge case.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent 2865a3fe
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -12,7 +12,8 @@ use crate::{
use anyhow::{anyhow, bail, Context, Result};
use camino::{Utf8Path, Utf8PathBuf};
use smithy_rs_tool_common::{
    command::sync::CommandExt, index::CratesIndex, release_tag::ReleaseTag,
    command::sync::CommandExt, index::CratesIndex, package::PackageCategory,
    release_tag::ReleaseTag,
};
use std::{
    collections::{BTreeMap, BTreeSet},
@@ -57,9 +58,22 @@ pub fn audit(args: Audit) -> Result<()> {

fn audit_crate(repo: &Repo, release_tag: &ReleaseTag, rt_crate: RuntimeCrate) -> Result<()> {
    if rt_crate.changed_since_release(repo, release_tag)? {
        // There is an edge case with the aws/rust-runtime crates due to the decoupled smithy-rs/SDK releases.
        // After a smithy-rs release and before a SDK release, there is a period of time where the smithy-rs
        // runtime crates are published to crates.io, but the SDK runtime crates are not.
        //
        // The way this manifests is that the crate's previous release version is now the same as the version
        // number at HEAD, and the crate is not published.
        let is_sdk_runtime_edge_case = PackageCategory::from_package_name(&rt_crate.name).is_sdk()
            && rt_crate.previous_release_version.as_ref() == Some(&rt_crate.next_release_version)
            && !rt_crate.next_version_is_published();
        if is_sdk_runtime_edge_case {
            tracing::info!("For '{}', detected that a new version of smithy-rs has been released, but that the SDK release hasn't caught up yet.", rt_crate.name);
        }

        // If this version has never been published before, then we're good.
        // (This tool doesn't check semver compatibility.)
        if !rt_crate.next_version_is_published() {
        if !rt_crate.next_version_is_published() && !is_sdk_runtime_edge_case {
            if let Some(previous_version) = rt_crate.previous_release_version {
                tracing::info!(
                    "'{}' changed and was version bumped from {previous_version} to {}",