fix(release): the Store submit reads the CLI's PascalCase submission keys
rc.13-v0.21.7 failed 'Submit the verified Store package' with
'unreadable submission: {"Id": ..., "ApplicationCategory": ...'.
msstore submission get serializes the .NET DevCenterSubmission property names
(Status, TargetPublishMode), not the REST API's camelCase, so the in-flight
check never found 'status' and the Manual-publish write added a second
'targetPublishMode' key the CLI would ignore. Both now use the key as the CLI
spells it. The test fake emits the CLI's casing; with it main fails 5 tests
with the production error.
This commit is contained in:
@@ -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])
|
||||
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user