Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
[eas-cli] Use wrapper instead of telemetry subscriber for metadata #1169
[eas-cli] Use wrapper instead of telemetry subscriber for metadata #1169
Changes from all commits
6aa3a78
50f38a0
530649f
9cb17fa
97c361f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of the
as AppleData
cast?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the same as: #1169 (comment) We could relax the types, but we would need to add more checks in the tasks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of this, since it kind of obfuscates the original error. But I don't see a "safe" way of exposing the
executionId
to the user outsidewithTelemetryAsync
.We can always do something like the snippet below, but that's not super safe. And adding an intermediate Error class also feels a bit weird (e.g.
MetadataDownloadError < TelemetryError < Error
). But I'm open to other suggestions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could make
withTelemetryAsync
return whatever passed callback returnsor handle that error inside withTelemetryAsync (or inside callback that you are passing to withTelemetryAsync)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm against returning errors as if they were regular data. I like the other suggestion better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the cast?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's going from a
Partial<AppleData>
to a finalizedAppleData
. What we can do is relax the typing onuploadAsync
anddownloadAsync
. But that would increase the checks we need to do within the tasks themselves.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't follow. If we're passing a partial object and the function expects a non-partial one it can lead to strange errors in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use
ts-mockito
instead of usingas any
. We use it in www.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice! TIL, I used the
any
to only pass a partial version of the original type (only the types that we need in the tests). I'll look intots-mockito
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await expect(...).rejects.toThrow(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await expect(...).rejects.toThrow(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had this at first, but in we also need to test the "executionId". I don't think we can do such a thing with just that line, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see your point but you're just checking if
executionId
andoriginalError
were set to anything. If we're using typescript for all files in this repo then it's not possible to create an instance ofMetadataTelemetryError
without specifying those two fields.I'm not feeling too strong about this though.