Skip to content

Conversation

rbro112
Copy link
Member

@rbro112 rbro112 commented Aug 7, 2025

Adds new VCS params as args to the mobile-app command and passes them to the API (pending getsentry/sentry#97332). Notably removes sha in favor of head_sha. Given this command is still unreleased and marked experimental, this would usually be a breaking change but I don't believe we need any backwards compatibility here.

We'll implement default value providing for most of these as well in follow ups, as I'd prefer to silo those implementations for easier review && testing.

Copy link
Member Author

rbro112 commented Aug 7, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@rbro112 rbro112 changed the title Add new VCS params to mobile-app command feat(mobile-app): Add new VCS params to mobile-app command Aug 7, 2025
Copy link
Member

@trevor-e trevor-e left a comment

Choose a reason for hiding this comment

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

API lgtm

@rbro112 rbro112 force-pushed the ryan/add_new_vcs_params_to_mobile-app_command branch from dd65d3b to 38b2596 Compare August 8, 2025 17:55
.map(Cow::Borrowed)
.or_else(|| vcs::find_head().ok().map(Cow::Owned));

// TODO: Implement default values
Copy link
Member Author

Choose a reason for hiding this comment

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

Will follow in future PRs for each of these individually.

Copy link
Member

Choose a reason for hiding this comment

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

I am okay with us doing this in future PRs; however, I would prefer not to commit the TODO comment, lest we ever forget to remove it. We should track the work in GitHub/Linear issues instead

Suggested change
// TODO: Implement default values

@rbro112 rbro112 marked this pull request as ready for review August 8, 2025 18:10
@rbro112 rbro112 requested review from szokeasaurusrex and a team as code owners August 8, 2025 18:10
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

lgtm, besides a few minor suggestions to address prior to merge

#[serde(skip_serializing_if = "Option::is_none")]
pub base_ref: Option<&'a str>,
#[serde(skip_serializing_if = "Option::is_none")]
pub pr_number: Option<i32>,
Copy link
Member

Choose a reason for hiding this comment

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

As PR's can only have positive numbers, I would use an unsigned integer (u32) here, rather than a signed integer

Suggested change
pub pr_number: Option<i32>,
pub pr_number: Option<u32>,

.map(Cow::Borrowed)
.or_else(|| vcs::find_head().ok().map(Cow::Owned));

// TODO: Implement default values
Copy link
Member

Choose a reason for hiding this comment

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

I am okay with us doing this in future PRs; however, I would prefer not to commit the TODO comment, lest we ever forget to remove it. We should track the work in GitHub/Linear issues instead

Suggested change
// TODO: Implement default values

Comment on lines 89 to 85
Arg::new("pr_number")
.long("pr-number")
.help("The pull request number to use for the upload. If not provided, the current pull request number will be used.")
Copy link
Member

Choose a reason for hiding this comment

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

This way, Clap can parse straight to a u32 and perform the validation internally

Suggested change
Arg::new("pr_number")
.long("pr-number")
.help("The pull request number to use for the upload. If not provided, the current pull request number will be used.")
Arg::new("pr_number")
.long("pr-number")
.value_parser(clap::value_parser!(u32))
.help("The pull request number to use for the upload. If not provided, the current pull request number will be used.")

Copy link
Member Author

Choose a reason for hiding this comment

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

Very nice to know, figured there was a way to do this I was missing

Comment on lines 118 to 121
let pr_number = matches
.get_one("pr_number")
.map(String::as_str)
.and_then(|s| s.parse::<i32>().ok());
Copy link
Member

Choose a reason for hiding this comment

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

Once you change the pr_number's type to u32 in the struct, and once you add the value_parser above, you will be able to simplify this line greatly:

Suggested change
let pr_number = matches
.get_one("pr_number")
.map(String::as_str)
.and_then(|s| s.parse::<i32>().ok());
let pr_number = matches.get_one("pr_number");

@rbro112 rbro112 force-pushed the ryan/add_new_vcs_params_to_mobile-app_command branch from e9979f6 to c5ecf09 Compare August 11, 2025 16:23
@rbro112 rbro112 merged commit 75920e8 into master Aug 11, 2025
32 checks passed
@rbro112 rbro112 deleted the ryan/add_new_vcs_params_to_mobile-app_command branch August 11, 2025 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