Skip to content

Conversation

chromy
Copy link
Contributor

@chromy chromy commented Aug 5, 2025

Adds output when uploading a mobile app to show the analysis URL:

$ sentry-cli mobile-app upload ~/apks/HackerNews.apk
> Preparing for upload completed in 0.229s
Successfully uploaded 1 file to Sentry
  - /Users/chromy/apks/HackerNews.apk https://sentry.my.sentry.io/sentry/preprod/internal/57

Also updates the sentry-cli logic for recent changes to the upload endpoint:

  • gitSha renamed to headSha
  • Endpoint also returns artifactId
  • We now are not expected to poll till assemble is complete, instead we call assemble twice:
    • First time to find the missing chunks
    • (here we upload all missing chunks)
    • Second time to get the artfiactId and trigger an assembly job
      This avoids having to wait for the (slow) assembly process to complete prior to the CLI exiting.

@chromy chromy requested review from a team and szokeasaurusrex as code owners August 5, 2025 19:16
@chromy chromy changed the title Show mobile-app upload show analysis URL DNM: Show mobile-app upload show analysis URL Aug 5, 2025
@chromy chromy marked this pull request as draft August 5, 2025 19:17
cursor[bot]

This comment was marked as outdated.

@chromy chromy force-pushed the chromy/2025-09-05-show-url branch 3 times, most recently from e900afe to eb9eef4 Compare August 6, 2025 10:32
@chromy chromy changed the title DNM: Show mobile-app upload show analysis URL Show mobile-app upload show analysis URL Aug 6, 2025
@chromy chromy requested a review from rbro112 August 6, 2025 10:32
@chromy chromy force-pushed the chromy/2025-09-05-show-url branch 3 times, most recently from c77f660 to 270f8ca Compare August 6, 2025 14:37
@chromy chromy marked this pull request as ready for review August 7, 2025 09:42
@chromy chromy force-pushed the chromy/2025-09-05-show-url branch from 270f8ca to 41feac8 Compare August 7, 2025 09:42
@chromy chromy changed the title Show mobile-app upload show analysis URL Show analysis URL after mobile-app upload Aug 7, 2025
@chromy chromy force-pushed the chromy/2025-09-05-show-url branch from 41feac8 to de1d2de Compare August 7, 2025 10:30
@chromy chromy changed the title Show analysis URL after mobile-app upload feat(preprod): Show analysis URL after mobile-app upload Aug 7, 2025
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.

The code looks alright to me. However, I am unsure we should implement this feature, see the inline comment about how this would require us to wait for assembly to finish.

If you have any questions, please feel free to reach out.

Comment on lines 424 to 426
response
.artifact_id
.ok_or(anyhow!("Missing artifactId in response"))
Copy link
Member

Choose a reason for hiding this comment

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

The disadvantage here is that because we require the artifact ID to be present in the response, we will always have to wait until the artifact has finished assembling, which could significantly slow down the command. It looks like we are already doing this, but in the future we may want to change it, as it is likely not the ideal behavior.

If we want to print the URL, there's probably no way around waiting for the assembly to finish. But, it is likely worth reconsidering whether we really think it is worth waiting for assembly to finish, just to be able to print the URL (with no way to opt in or out of this behavior)

Copy link
Member

Choose a reason for hiding this comment

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

Also, is the artifact_id always expected to be there if we hit this line (i.e., if the assembly status is OK)?

If not, I would suggest improving the error message to make it more actionable to the user.

If we do expect the artifact_id to be there, I would suggest we rewrite the error message to indicate that this is an internal error with the CLI and/or with the server, as it is not fixable by the user. You can do this by using expect rather than returning an error, as expect panics, and Sentry CLI's panic handler prints a message stating that an internal error has occurred, and that users should file a bug report

Copy link
Member

@szokeasaurusrex szokeasaurusrex Aug 8, 2025

Choose a reason for hiding this comment

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

Edit: Not sure the above is accurate, I am currently reviewing #2683 and getsentry/sentry#97435 to verify this

Edit to the edit: I think my initial thoughts here were correct

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've updated the way this works so now the artifact id/url is available immediately.

@szokeasaurusrex
Copy link
Member

szokeasaurusrex commented Aug 8, 2025

This change would conflict with what @NicoHinderling is implementing in #2683, as I describe here, since #2683 removes the assembly polling, on which this PR depends

@chromy
Copy link
Contributor Author

chromy commented Aug 8, 2025

This change would conflict with what @NicoHinderling is implementing in #2683, as I describe here, since #2683 removes the assembly polling, on which this PR depends

Yes! Partly because of what you were saying (assembly can be slow) and also that assembly happens in a task so it's awkward to get the file.id out (turned out the query we were running was far to slow on us) we moved the creation of the artifactId up earlier into the process so now it's returned immediately. I also didn't get a chance to read all of the PRs get but I think broadly we want to land something like Nico's PR (#2683) first and then if anything is left to do I can rebase this one. I'll make this a draft for now.

@szokeasaurusrex
Copy link
Member

@chromy just wanted to write it here so the discussion is preserved: after meeting with @NicoHinderling and understanding his changes better, I believe this PR should not conflict with his PR, once the needed changes are made on that PR and once this PR is rebased on it

@chromy chromy force-pushed the chromy/2025-09-05-show-url branch from 7090e8e to ab71fc0 Compare August 11, 2025 10:26
@chromy
Copy link
Contributor Author

chromy commented Aug 11, 2025

@chromy just wanted to write it here so the discussion is preserved: after meeting with @NicoHinderling and understanding his changes better, I believe this PR should not conflict with his PR, once the needed changes are made on that PR and once this PR is rebased on it

Thanks! Nico and I have updated this one to hopefully take in to account all the feedback on both PRs (with the exception of having the server return a URL rather than an id which we would like to do in a follow up after this lands since it requires a server side change).

@chromy chromy requested a review from loewenheim August 11, 2025 10:30
@chromy chromy marked this pull request as ready for review August 11, 2025 10:30
cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

@loewenheim loewenheim left a comment

Choose a reason for hiding this comment

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

LGTM aside from some nits

@szokeasaurusrex szokeasaurusrex force-pushed the chromy/2025-09-05-show-url branch from 19a3331 to ab71fc0 Compare August 11, 2025 10:54
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.

I also left some suggestions, the rest looks good though!

@chromy chromy force-pushed the chromy/2025-09-05-show-url branch 2 times, most recently from e86d183 to 7f7e773 Compare August 11, 2025 13:37
@chromy chromy force-pushed the chromy/2025-09-05-show-url branch from 7f7e773 to 18162ba Compare August 11, 2025 13:39
@chromy
Copy link
Contributor Author

chromy commented Aug 11, 2025

Thanks both!

@chromy chromy merged commit d482c44 into master Aug 11, 2025
31 checks passed
@chromy chromy deleted the chromy/2025-09-05-show-url branch August 11, 2025 13:56
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.

4 participants