Skip to content

Fix stale-package cleanup deleting the new bundle#149

Merged
michaeljolley merged 1 commit into
mainfrom
michaeljolley-sturdy-chainsaw
Jul 5, 2026
Merged

Fix stale-package cleanup deleting the new bundle#149
michaeljolley merged 1 commit into
mainfrom
michaeljolley-sturdy-chainsaw

Conversation

@michaeljolley

Copy link
Copy Markdown
Contributor

Problem

The first run of the cleanup step (from #148) failed at the PUT:

InvalidParameterValue ... Existing Package ...

The draft it read looked like this:

WeatherExtension_1.1.0.0_arm64.msix   v1.1.0.0   [Uploaded]      -> delete (correct)
WeatherExtension_1.1.0.0_x64.msix     v1.1.0.0   [Uploaded]      -> delete (correct)
WeatherExtension_1.2.4.0.msixbundle   v1.2.4.0   [PendingDelete] (msstore already marked)
WeatherExtension_1.2.5.0.msixbundle   v(empty)   [PendingUpload] -> WRONGLY deleted ❌

The newly uploaded bundle is still PendingUpload, so Partner Center hasn't extracted its manifest yet and its version field is empty. The version != release filter matched the empty string and marked the new bundle PendingDelete too — so the PUT tried to delete every package (and you can't set a PendingUpload package to PendingDelete), which the API rejected.

Fix

Discriminate by fileStatus, not version:

  • Every inherited package from the last published submission is Uploaded → mark those PendingDelete.
  • The bundle we just uploaded is PendingUpload → always keep it.

This drops all reliance on the version field. Also added:

  • A safety guard that refuses to commit if no package would survive (belt-and-suspenders against ever deleting the release payload).
  • A trap that prints the API's response body on any failing REST call, so future failures show the real error instead of just the status line.

What happens next

The failed run left an uncommitted pending draft on the Store; the next release's msstore publish --noCommit deletes any existing pending submission before creating a fresh one, so it's cleaned up automatically — no manual action needed. Merge this, then cut a new release to exercise it.

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

The freshly uploaded bundle is still PendingUpload when we read the
draft, so its version field is empty. The previous version-based filter
therefore matched it and marked it PendingDelete, and the Store API
rejected the PUT (InvalidParameterValue: existing package). Discriminate
by fileStatus instead: only inherited 'Uploaded' packages are deleted,
while the new 'PendingUpload' bundle is preserved. Add a guard that
refuses to commit if no package would survive, and surface API error
response bodies via a trap.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@michaeljolley michaeljolley merged commit 8433261 into main Jul 5, 2026
2 checks passed
@michaeljolley michaeljolley deleted the michaeljolley-sturdy-chainsaw branch July 5, 2026 06:17
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.

1 participant