Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/api/data_types/chunking/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ pub struct ChunkedBuildRequest<'a> {
pub chunks: &'a [Digest],
#[serde(skip_serializing_if = "Option::is_none")]
pub build_configuration: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
pub release_notes: Option<&'a str>,
Copy link

Choose a reason for hiding this comment

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

Bug: Missing Serde Attribute Causes Inconsistent Serialization

The new release_notes field is missing the #[serde(skip_serializing_if = "Option::is_none")] attribute. This means it will serialize as null when None, unlike other optional fields that are omitted, potentially causing API compatibility issues.

Fix in Cursor Fix in Web

// VCS fields
#[serde(skip_serializing_if = "Option::is_none")]
pub head_sha: Option<&'a str>,
Expand Down
19 changes: 2 additions & 17 deletions src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,10 +1034,7 @@ impl<'a> AuthenticatedApi<'a> {
&self,
org: &str,
project: &str,
checksum: Digest,
chunks: &[Digest],
build_configuration: Option<&str>,
vcs_info: &VcsInfo<'_>,
request: &ChunkedBuildRequest<'_>,
) -> ApiResult<AssembleBuildResponse> {
let url = format!(
"/projects/{}/{}/files/preprodartifacts/assemble/",
Expand All @@ -1046,19 +1043,7 @@ impl<'a> AuthenticatedApi<'a> {
);

self.request(Method::Post, &url)?
.with_json_body(&ChunkedBuildRequest {
checksum,
chunks,
build_configuration,
head_sha: vcs_info.head_sha,
base_sha: vcs_info.base_sha,
provider: vcs_info.vcs_provider,
head_repo_name: vcs_info.head_repo_name,
base_repo_name: vcs_info.base_repo_name,
head_ref: vcs_info.head_ref,
base_ref: vcs_info.base_ref,
pr_number: vcs_info.pr_number,
})?
.with_json_body(&request)?
.send()?
.convert_rnf(ApiErrorKind::ProjectNotFound)
}
Expand Down
30 changes: 25 additions & 5 deletions src/commands/build/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ use symbolic::common::ByteView;
use zip::write::SimpleFileOptions;
use zip::{DateTime, ZipWriter};

use crate::api::{Api, AuthenticatedApi, ChunkUploadCapability, ChunkedFileState, VcsInfo};
use crate::api::{
Api, AuthenticatedApi, ChunkUploadCapability, ChunkedBuildRequest, ChunkedFileState, VcsInfo,
};
use crate::config::Config;
use crate::utils::args::ArgExt as _;
#[cfg(all(target_os = "macos", target_arch = "aarch64"))]
Expand Down Expand Up @@ -90,6 +92,11 @@ pub fn make_command(command: Command) -> Command {
.long("build-configuration")
.help("The build configuration to use for the upload. If not provided, the current version will be used.")
)
.arg(
Arg::new("release_notes")
.long("release-notes")
.help("The release notes to use for the upload.")
)
}

pub fn execute(matches: &ArgMatches) -> Result<()> {
Expand Down Expand Up @@ -169,6 +176,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
let pr_number = matches.get_one::<u32>("pr_number");

let build_configuration = matches.get_one("build_configuration").map(String::as_str);
let release_notes = matches.get_one("release_notes").map(String::as_str);

let api = Api::current();
let authenticated_api = api.authenticated()?;
Expand Down Expand Up @@ -238,6 +246,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
&org,
&project,
build_configuration,
release_notes,
&vcs_info,
) {
Ok(artifact_url) => {
Expand Down Expand Up @@ -397,6 +406,7 @@ fn upload_file(
org: &str,
project: &str,
build_configuration: Option<&str>,
release_notes: Option<&str>,
vcs_info: &VcsInfo<'_>,
) -> Result<String> {
const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \
Expand Down Expand Up @@ -457,10 +467,20 @@ fn upload_file(
let response = api.assemble_build(
org,
project,
checksum,
&checksums,
build_configuration,
vcs_info,
&ChunkedBuildRequest {
checksum,
chunks: &checksums,
build_configuration,
release_notes,
head_sha: vcs_info.head_sha,
base_sha: vcs_info.base_sha,
provider: vcs_info.vcs_provider,
head_repo_name: vcs_info.head_repo_name,
base_repo_name: vcs_info.base_repo_name,
head_ref: vcs_info.head_ref,
base_ref: vcs_info.base_ref,
pr_number: vcs_info.pr_number,
},
)?;
chunks.retain(|Chunk((digest, _))| response.missing_chunks.contains(digest));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ Options:
--build-configuration <build_configuration>
The build configuration to use for the upload. If not provided, the current version will
be used.
--release-notes <release_notes>
The release notes to use for the upload.
-h, --help
Print help

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ Options:
--build-configuration <build_configuration>
The build configuration to use for the upload. If not provided, the current version will
be used.
--release-notes <release_notes>
The release notes to use for the upload.
-h, --help
Print help

Expand Down