Skip to content

The agent that grows with you

fix(release): the Store submit reads the CLI's PascalCase submission keys

Teknium6992df4cdc8e
diff --git a/scripts/releases/store.py b/scripts/releases/store.py
index 239d527f165..ea1b1deed80 100644
--- a/scripts/releases/store.py
+++ b/scripts/releases/store.py
@@ -110,9 +110,16 @@ def _has_in_flight(submission_output: str) -> bool:
submission = json.loads(submission_output)
except json.JSONDecodeError:
raise StoreError(f"unreadable submission: {submission_output[:200]!r}")
- if not isinstance(submission, dict) or "status" not in submission:
+ key = _key(submission, "status") if isinstance(submission, dict) else None
+ if key is None:
raise StoreError(f"unreadable submission: {submission_output[:200]!r}")
- return submission["status"] not in _NOT_IN_FLIGHT
+ return submission[key] not in _NOT_IN_FLIGHT
+
+
+def _key(submission: dict, name: str) -> str | None:
+ """The submission's own spelling of ``name``. The CLI serializes .NET property names
+ (``Status``, ``TargetPublishMode``); the REST API documents camelCase."""
+ return next((k for k in submission if k.lower() == name.lower()), None)
def submit(package: str, *, product_id: str, run=_cli_run) -> dict:
@@ -121,7 +128,7 @@ def submit(package: str, *, product_id: str, run=_cli_run) -> dict:
run(["msstore", "submission", "delete", product_id, "--no-confirm"])
run(["msstore", "publish", package, "--appId", product_id, "--noCommit"])
submission = json.loads(run(["msstore", "submission", "get", product_id]))
- submission["targetPublishMode"] = "Manual"
+ submission[_key(submission, "targetPublishMode") or "TargetPublishMode"] = "Manual"
run(["msstore", "submission", "update", product_id,
json.dumps(submission, separators=(",", ":"))])
run(["msstore", "submission", "publish", product_id])
diff --git a/tests/scripts/test_release_store.py b/tests/scripts/test_release_store.py
index 563d413d0ac..b41aa36600e 100644
--- a/tests/scripts/test_release_store.py
+++ b/tests/scripts/test_release_store.py
@@ -23,9 +23,10 @@ class _Cli:
uploaded = any(kind == "submit" for kind, _ in self.events)
# Before the upload: the last submission (in flight or published). After: the new draft.
status = "PendingCommit" if uploaded else ("Certification" if self.pending else "Published")
+ # The CLI serializes .NET property names (rc.13-v0.21.7: '{"Id": ..., "ApplicationCategory": ...').
return json.dumps({
- "status": status, "targetPublishMode": "Immediate",
- "friendlyName": "Submission 2", "listings": {}})
+ "Status": status, "TargetPublishMode": "Immediate",
+ "FriendlyName": "Submission 2", "Listings": {}})
if argv[:3] == ["msstore", "submission", "delete"]:
self.events.append(("delete-pending", name))
return ""
@@ -76,7 +77,8 @@ def test_submit_turns_auto_publish_off():
cli = _Cli(pending=False)
submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)
- assert cli.updated["targetPublishMode"] == "Manual"
+ assert cli.updated["TargetPublishMode"] == "Manual"
+ assert "targetPublishMode" not in cli.updated
def test_submit_commits_the_held_submission():