[eas-cli] metadata: re-throw MetadataDownloadError / MetadataUploadError so exit code reflects failure#3692
Open
Maples7 wants to merge 1 commit into
Open
[eas-cli] metadata: re-throw MetadataDownloadError / MetadataUploadError so exit code reflects failure#3692Maples7 wants to merge 1 commit into
Maples7 wants to merge 1 commit into
Conversation
…dataUploadError so exit code reflects failure handleMetadataError previously logged the aggregated errors and then returned, swallowing the failure. The MetadataPush/MetadataPull commands therefore exited with status 0 even when individual entity sync operations (screenshot upload, delete, reorder, app-info, etc.) failed inside logAsync. Re-throwing the error lets EasCommand.catch propagate it to oclif and the process exits non-zero. Refs expo#3689
|
Subscribed to pull request
Generated by CodeMention |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
eas metadata:push(and to a lesser extenteas metadata:pull) currently exits with status0even when individual entity sync operations fail. In production this means an apparently-successful run can leave App Store Connect in a partially-synced state with the user none the wiser.Concrete repro that triggered this fix: a real
metadata:pushrun printed multipleFailed uploading <screenshot>.png (<locale>)lines via thelogAsyncspinner (transient ASC 503s during peak hours) and still exited0, so the surrounding bash retry loop saw "success" and stopped.Closes #3689.
Root cause
logAsynccorrectly re-throws when the wrapped action rejects, anduploadMetadataAsync/downloadMetadataAsynccorrectly accumulate those errors and throw a wrappingMetadataUploadError/MetadataDownloadError. The exit code is dropped one layer up, inhandleMetadataError:MetadataValidationErrorwas swallowed the same way, even though the upstream call sites incommands/metadata/push.tsandcommands/metadata/pull.tsalready treathandleMetadataErroras terminal (it's the last call in theircatchblock).How
Replace both
return;branches inhandleMetadataErrorwiththrow error;so the error propagates up toEasCommand.catch, which logs it via Sentry and re-throws a sanitized${commandId} command failed.error. oclif then exits non-zero. Validation errors are now also propagated (matches the existing JSDoc which already promises "this method will re-throw that error").The friendly multi-line block (
error.message+ per-error messages + "If this issue persists, open a new issue at …") is still printed exactly as before, so the visible UX is unchanged for users who were already paying attention to the spinner output. The only user-visible change is that the process now exits1, which CI / wrapper scripts can finally observe.Test Plan
Added unit tests in
packages/eas-cli/src/metadata/__tests__/errors.test.tscovering all four branches ofhandleMetadataError(generic, validation, upload-aggregate, download-aggregate). Each asserts the original error instance bubbles back out so the calling command exits non-zero.Full metadata suite still passes (
yarn test src/metadata→ 16 suites, 191 tests, 187 baseline + 4 new).yarn typecheckclean.yarn lintclean (0 errors; the 12 pre-existing warnings are unchanged).I haven't been able to E2E-reproduce a transient ASC 503 inside the change because I'd need to be able to deterministically force
AppScreenshot.uploadAsyncto throw — happy to add an integration-style test if there's a preferred mocking pattern in this repo./changelog-entry bug-fix [eas-cli] Fix
eas metadata:pushandeas metadata:pullexiting with status0even when individual screenshot, app-info, or other entity sync operations failed.