Fix: --force exits with error when no prior deployment exists#209
Open
codxbrexx wants to merge 1 commit intometacall:masterfrom
Open
Fix: --force exits with error when no prior deployment exists#209codxbrexx wants to merge 1 commit intometacall:masterfrom
--force exits with error when no prior deployment exists#209codxbrexx wants to merge 1 commit intometacall:masterfrom
Conversation
'if (repo)' was always truthy for empty arrays, crashing on repo[0]. Replace with repo.length > 0 and guard repoSubscriptionDetails[0]. Add unit tests for empty, full, and mismatched cases.
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.
Closes #208
Problem
Running
metacall-deploy --forceon a project that has never been deployed exits with:X Deployment Aborted because this directory is not being used by any applications.
and the deploy never starts.
The root cause:
api.inspect()returns an empty array when no deployment exists. The old checkif (repo)is always truthy for an empty array in JS, so the code proceeds torepo[0].prefix— which isundefined— and throws. The catch block then callserror()and exits with code1.The existing comment in
force.tsalready documents the intended behavior: if no deployment is found,--forceshould skip deletion and continue as a normal deploy.Changes
src/force.tsif (repo)withif (repo.length > 0)to correctly detect an empty resultrepoSubscriptionDetails[0]access independentlylistSubscriptionsDeploys()andinspect()are separate API calls and their results may not alignsrc/test/force.spec.tsnew fileinspect()→ returns''without throwing (regression test)args.planrepoSubscriptionDetails[0]Testing
All pass. Integration tests require API credentials and are only run on push to

masterper the existing CI workflow.