Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TRUNK-12896] Include bundle_upload_id in meta.json on test bundle upload #105

Conversation

max-trunk
Copy link
Contributor

Includes bundle_upload_id in the meta.json metadata file to help facilitate making that value accessible by the ETL job. Also renames a couple function / type names

cli/src/main.rs Outdated
})
.await?;

let upload = upload_op.context("Failed to create bundle upload.")?;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was looking for a way to set upload here to a CreateBundleUploadResponse from an Option<CreateBundleUploadResponse>, failing otherwise, since I don't think we'd want to continue if upload_op were None. LMK if that's an incorrect assumption. Based on this SO thread :) https://stackoverflow.com/questions/69738600/simplest-way-to-unwrap-an-option-and-return-error-if-none-anyhow

Copy link
Member

Choose a reason for hiding this comment

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

This is good, but I think we can do one better :)

In create_bundle_upload_intent I think we can and should change Option<CreateBundleUploadResponse> to just CreateBundleUploadResponse and then you won't need to do that here. That will also require changing from checking for is_success to checking if the API call is not successful (look at get_quarantining_config for example). This also makes create_bundle_upload_intent more consistent with our other API calls like get_quarantining_config. Eventually, I'll get around to cleaning this up so there's a better, more consistent pattern to all of the API calls with retries we make.

Removing the Option<T> type is a little auto-magical because it's how serde implicitly figures out how to deserialize the response using auto-implemented traits:
https://docs.rs/serde/latest/serde/de/index.html#implementations-of-deserialize-provided-by-serde

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated! lmk how it looks

Copy link

trunk-staging-io bot commented Sep 27, 2024

✅ 75 passed ⋅ (learn more)

settingsdocs ⋅ learn more about trunk.io

Copy link
Member

@dfrankland dfrankland left a comment

Choose a reason for hiding this comment

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

I think this looks great! Definitely makes our code much nicer

@max-trunk max-trunk merged commit d10aebb into main Sep 27, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants