The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(release): publication commits the Store draft with auto-publish on
ethernet550e2a891f8e
diff --git a/.github/workflows/desktop-bundled-release.yml b/.github/workflows/desktop-bundled-release.ymlindex e4d5dfd6dff..2866a075507 100644--- a/.github/workflows/desktop-bundled-release.yml+++ b/.github/workflows/desktop-bundled-release.yml@@ -23,9 +23,10 @@ name: Desktop Bundled Release# publish-win32-updater → tested canary bytes + feed# (needs BOTH Windows smoke matrices); stable promotion is sequenced by# the stable publication controller after GitHub publication.-# stable-store → verified Store submission-# (needs stable-publish): materialize the immutable accepted Store bundle-# and submit via the MSStore CLI without rebuilding.+# stable-store → verified Store draft+# (beside stable-publish): materialize the immutable accepted Store bundle+# and upload it via the MSStore CLI without rebuilding; the publication+# pass commits it with auto-publish on.# publish-darwin-updater → macOS electron-updater feed# (needs BOTH darwin legs): scripts.releases.r2 finalize merges the per-arch# ymls into releases/darwin/<channel>/<channel>-mac.yml — the feed@@ -2417,9 +2418,9 @@ jobs:stable-store:name: Submit the verified Store package# Runs beside stable-publish: it materializes and digest-checks its own Store candidate- # from the admitted manifest and never reads stable-publish's output. The submission is- # held (Manual); only "Publish now" in Partner Center puts it live, so a run whose- # stable-publish fails leaves an unreleased Store submission, never a live one.+ # from the admitted manifest and never reads stable-publish's output. It leaves an+ # uncommitted draft; only the publication pass commits it (auto-publish on), so a run+ # whose stable-publish fails leaves a draft no customer sees, never a live build.needs: [validate]if: inputs.release-phase == 'publish' && inputs.skip-store != true# The Store is not a release gate: a failed submission leaves the release publishable@@ -2458,8 +2459,8 @@ jobs:files=(verified/Store-*.msixbundle)test "${#files[@]}" -eq 1test -f "${files[0]}"- # Auto-publish stays off: the submission is committed with- # targetPublishMode Manual and is released by the publication pass.+ # An uncommitted draft: the publication pass sets targetPublishMode+ # Immediate and commits it (scripts/releases/store.py).python -m scripts.releases.store submit "${files[0]}"- name: Name the Store package for a manual uploadif: failure()diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.ymlindex 6344ddd8cbf..60802e084b9 100644--- a/.github/workflows/stable-release.yml+++ b/.github/workflows/stable-release.yml@@ -691,3 +691,8 @@ jobs:CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}CLOUDFLARE_R2_BUCKET: ${{ vars.CLOUDFLARE_R2_BUCKET }}CLOUDFLARE_R2_PUBLIC_URL: ${{ vars.CLOUDFLARE_R2_PUBLIC_URL }}+ # The pass commits this release's Store draft (scripts/releases/store.py).+ MS_STORE_TENANT_ID: ${{ secrets.MS_STORE_TENANT_ID }}+ MS_STORE_CLIENT_ID: ${{ secrets.MS_STORE_CLIENT_ID }}+ MS_STORE_CLIENT_SECRET: ${{ secrets.MS_STORE_CLIENT_SECRET }}+ MS_STORE_PRODUCT_ID: ${{ vars.MS_STORE_PRODUCT_ID }}diff --git a/scripts/releases/sequencer.py b/scripts/releases/sequencer.pyindex 8cfe3b120b3..6b1a78499c3 100644--- a/scripts/releases/sequencer.py+++ b/scripts/releases/sequencer.py@@ -6,6 +6,7 @@ IDs before advancing each eligible head oldest-first."""from __future__ import annotations+import hashlibimport jsonimport osimport subprocess@@ -457,14 +458,16 @@ def reconcile(env: dict, *, run=output, read_head=None, advance_head=None,docker.promote_stable(record["claim_tag"], record["docker_manifest_digest"], record["tag"])log("Docker aliases moved")if "windows-store" in record["lanes"]:- log("Checking the Microsoft Store submission")- # The Store check joins the pass here (after the feeds and aliases- # move). It never releases the held submission: the API cannot,- # so it prints the Publish now step. The Store never blocks a- # release: a failed or unreadable submission becomes a warning.+ log("Releasing the Microsoft Store draft")+ # The Store joins the pass here (after the feeds and aliases move): this+ # release's draft is committed with auto-publish on. The Store never+ # blocks a release: a failed or unreadable submission becomes a warning.try:- store.check_from_env(env)- except store.StoreError as error:+ raw = read_archive(f"releases/tag/{record['claim_tag']}/release-candidates.json")+ if hashlib.sha256(raw).hexdigest() != record["candidate_manifest_sha256"]:+ raise store.StoreError("the archived candidate manifest differs from the receipt")+ store.release_from_env(env, json.loads(raw))+ except (store.StoreError, ValueError) as error:print(f"::warning title=Microsoft Store::{error}. The release is published; ""upload the Store package from the release run's summary in Partner Center.")advance_head = production_advancediff --git a/scripts/releases/store.py b/scripts/releases/store.pyindex ea1b1deed80..1fd97e551c2 100644--- a/scripts/releases/store.py+++ b/scripts/releases/store.py@@ -1,61 +1,62 @@"""Store submission control for the release pipeline.-The green run submits the verified ``.msixbundle`` with auto-publish off-(``targetPublishMode: "Manual"``). The submission API has no call that-releases a held submission, so publication never edits it: the publication-pass only checks its state and tells a person to click Publish now in Partner-Center once it is certified. Both entry points are safe to rerun.+The green run uploads the verified ``.msixbundle`` as a draft submission and+stops: nothing a customer can see changes, and certification has not started.+The publication pass, which runs only when the release really goes out, sets+``targetPublishMode: "Immediate"`` on that draft and commits it, so the Store+build goes live as soon as it passes certification. The submission API has no+call that releases a submission once it is committed and held, which is why+the commit waits for publication instead of happening at green with Manual.+Both entry points are safe to rerun.Green run — ``python -m scripts.releases.store submit <package>`` (Windowsrunner, ``msstore`` CLI configured beforehand by``microsoft/microsoft-store-apppublisher`` + ``msstore reconfigure``):-1. ``msstore submission get <productId>`` — the current submission as JSON; it is- in flight when its status is not one of the terminal/failure states- (``None, Published, PublishFailed, Canceled, CertificationFailed,- PreProcessingFailed, CommitFailed``).-2. ``msstore submission delete <productId> --no-confirm`` — only when one is- in flight. Deleting the last published submission would be wrong, so the- status gates this.+1. ``msstore submission get <productId>`` — the current submission as JSON.+2. ``msstore submission delete <productId> --no-confirm`` — only for a draft+ (``PendingCommit``) or a failed submission. A committed submission that is+ still in certification or publishing belongs to an earlier release going+ live; ``msstore publish`` would delete it, so ``submit`` refuses instead.3. ``msstore publish <package> --appId <productId> --noCommit`` — uploads thepackage and leaves the submission as a draft (``--noCommit`` / ``-nc``,"Disables committing the submission, keeping it in draft state").-4. ``msstore submission get <productId>`` — the complete submission JSON.-5. ``msstore submission update <productId> <json>`` — the same JSON with- ``targetPublishMode: "Manual"``. For MSIX apps ``submission update`` sends- the complete submission JSON, so it sets packages and publish mode at once.-6. ``msstore submission publish <productId>`` — commits; certification starts.-Publication pass — ``scripts.releases.store.check(...)`` (Ubuntu runner,-Partner Center submission REST API, stdlib ``urllib`` only, read-only):+Publication pass — ``scripts.releases.store.release(...)`` (Ubuntu runner,+Partner Center submission REST API, stdlib ``urllib`` only):1. ``POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token`` with``grant_type=client_credentials`` and scope``https://manage.devcenter.microsoft.com/.default`` (the same MS_STORE_*credentials the CLI uses).2. ``GET https://manage.devcenter.microsoft.com/v1.0/my/applications/{id}`` —- ``pendingApplicationSubmission.id`` names the held submission.-3. ``GET .../submissions/{id}/status``. ``Release`` (certified, held by- Manual) and the certification states print a Publish now instruction as- a GitHub warning; the live states are a no-op; a failed state raises.+ ``pendingApplicationSubmission.id`` names the draft.+3. ``GET .../submissions/{id}`` — the draft must carry this release's Store+ bundle (``applicationPackages[].fileName``); a draft from a newer green run+ is left alone.+4. ``PUT .../submissions/{id}`` with ``targetPublishMode: "Immediate"``, then+ ``POST .../submissions/{id}/commit``; certification starts and the build+ goes live when it passes. A submission that is already committed or live is+ a no-op.Sources for the commands and fields above:-- msstore CLI commands and options (``submission status/get/update/delete- --no-confirm/publish``, ``publish --noCommit``):+- msstore CLI commands and options (``submission get/delete --no-confirm``,+ ``publish --noCommit``):https://learn.microsoft.com/en-us/windows/apps/publish/msstore-dev-cli/commands- CLI CI/CD setup (``msstore reconfigure --tenantId --sellerId --clientId--clientSecret`` on the runner):https://learn.microsoft.com/en-us/windows/apps/publish/msstore-dev-cli/github-actions- Submission resource fields (``targetPublishMode``:- ``Immediate``/``Manual``/``SpecificDate``) and the status enum- (``PendingCommit, CommitStarted, PreProcessing, Certification,+ ``Immediate``/``Manual``/``SpecificDate``, ``applicationPackages``) and the+ status enum (``PendingCommit, CommitStarted, PreProcessing, Certification,CertificationFailed, Release, PendingPublication, Publishing, Published, ...``):https://learn.microsoft.com/en-us/windows/uwp/monetize/manage-app-submissions-- REST methods (get an app, get submission status):+- REST methods (get an app, get/update/commit a submission, get its status):https://learn.microsoft.com/en-us/windows/uwp/monetize/get-an-app+ https://learn.microsoft.com/en-us/windows/uwp/monetize/update-an-app-submission+ https://learn.microsoft.com/en-us/windows/uwp/monetize/commit-an-app-submissionhttps://learn.microsoft.com/en-us/windows/uwp/monetize/get-status-for-an-app-submission- The documented methods are get, create, update, commit, delete and status;- none releases a held submission, and update refuses a committed one (409).+ Update and commit refuse a submission that is no longer a draft (409).- Azure AD client-credentials token:https://learn.microsoft.com/en-us/windows/uwp/monetize/create-and-manage-submissions-using-windows-store-services#obtain-an-azure-ad-access-token"""@@ -73,17 +74,14 @@ API_ROOT = "https://manage.devcenter.microsoft.com/v1.0/my"TOKEN_URL = "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token"TOKEN_SCOPE = "https://manage.devcenter.microsoft.com/.default"-# Submission statuses that are terminal or already decided; none of them is an-# in-flight submission the green run would need to clear, and none of them is-# worth touching at release time except the already-live set below.-_NOT_IN_FLIGHT = {- "None", "Published", "PublishFailed", "Canceled",- "CertificationFailed", "PreProcessingFailed", "CommitFailed",-}+_DRAFT = "PendingCommit"+_FAILED = {"CommitFailed", "PreProcessingFailed", "CertificationFailed", "PublishFailed",+ "ReleaseFailed", "Canceled"}+# Nothing pending a green run could clobber: the last submission is live or gone.+_SETTLED = {"None", "Published"}+# Committed and not live yet: certification, or certified and held.+_COMMITTED = {"CommitStarted", "PreProcessing", "Certification", "Release"}_ALREADY_LIVE = {"PendingPublication", "Publishing", "Published"}-# The status of a submission that passed certification and is held by-# targetPublishMode Manual, waiting for release.-_CERTIFIED_HELD = "Release"class StoreError(RuntimeError):@@ -97,8 +95,8 @@ def _cli_run(argv: list[str]) -> str:return result.stdout-def _has_in_flight(submission_output: str) -> bool:- """Whether ``msstore submission get`` names a submission that is not yet decided.+def _status(submission_output: str) -> str:+ """The status of the submission ``msstore submission get`` prints.``submission status`` is no use here: for a packaged (MSIX) app it prints a Spectremarkup line (``Submission Status = ...``) and status tables, never JSON, and prints@@ -113,7 +111,7 @@ def _has_in_flight(submission_output: str) -> bool:key = _key(submission, "status") if isinstance(submission, dict) else Noneif key is None:raise StoreError(f"unreadable submission: {submission_output[:200]!r}")- return submission[key] not in _NOT_IN_FLIGHT+ return submission[key]def _key(submission: dict, name: str) -> str | None:@@ -123,16 +121,17 @@ def _key(submission: dict, name: str) -> str | None:def submit(package: str, *, product_id: str, run=_cli_run) -> dict:- """Submit ``package`` with auto-publish off, clearing any in-flight one."""- if _has_in_flight(run(["msstore", "submission", "get", product_id])):+ """Upload ``package`` as an uncommitted draft; the publication pass commits it."""+ status = _status(run(["msstore", "submission", "get", product_id]))+ if status == _DRAFT or status in _FAILED:run(["msstore", "submission", "delete", product_id, "--no-confirm"])+ elif status not in _SETTLED:+ # Committed and on its way live: an earlier release's Store update, which+ # msstore publish would delete.+ raise StoreError(f"a committed Store submission is {status}; rerun stable-store "+ "after it is published")run(["msstore", "publish", package, "--appId", product_id, "--noCommit"])- submission = json.loads(run(["msstore", "submission", "get", product_id]))- submission[_key(submission, "targetPublishMode") or "TargetPublishMode"] = "Manual"- run(["msstore", "submission", "update", product_id,- json.dumps(submission, separators=(",", ":"))])- run(["msstore", "submission", "publish", product_id])- return {"productId": product_id, "targetPublishMode": "Manual"}+ return {"productId": product_id, "status": _DRAFT}def _http_run(request: dict) -> dict:@@ -175,50 +174,55 @@ def _token(tenant_id: str, client_id: str, client_secret: str, run) -> str:return response["body"]["access_token"]-# Statuses of a committed submission that has not been decided yet.-_IN_CERTIFICATION = {"CommitStarted", "PreProcessing", "Certification"}-_FAILED = {"CommitFailed", "PreProcessingFailed", "CertificationFailed", "PublishFailed",- "Canceled"}---def check(*, product_id: str, tenant_id: str, client_id: str, client_secret: str,- run=_http_run) -> str:- """Report the held submission's state and what a person must do next.+def release(*, product_id: str, store_file: str, tenant_id: str, client_id: str,+ client_secret: str, run=_http_run) -> str:+ """Commit this release's Store draft with ``targetPublishMode: "Immediate"``.- The submission API has no call that releases a held (Manual) submission,- so the publication pass never edits or commits it: a certified submission- is put live by "Publish now" in Partner Center. A failed submission leaves- the run red.+ ``store_file`` is the Store bundle the release's candidate manifest names; a+ draft that does not carry it belongs to another green run and is left alone."""token = _token(tenant_id, client_id, client_secret, run)+ auth = {"Authorization": f"Bearer {token}"}- def get(path: str) -> dict:- response = run({"method": "GET", "url": API_ROOT + path,- "headers": {"Authorization": f"Bearer {token}"}})+ def call(method: str, path: str, body=None) -> dict:+ request = {"method": method, "url": API_ROOT + path, "headers": auth}+ if body is not None:+ request["body"] = body+ response = run(request)if response["status"] != 200:- raise StoreError(f"GET {path} failed: {response['status']}")+ raise StoreError(f"{method} {path} failed: {response['status']} {response['body']}")return response["body"]- app = get(f"/applications/{product_id}")+ app = call("GET", f"/applications/{product_id}")pending = (app.get("pendingApplicationSubmission") or {}).get("id")if not pending:- _notice(f"No Store submission is pending for {product_id}. The green run submits "- "one; check its stable-store job.")- return "no-submission"- state = get(f"/applications/{product_id}/submissions/{pending}/status").get("status")- if state in _FAILED:- raise StoreError(f"Store submission {pending} is {state}; resubmit from a green run")+ _notice(f"No Store draft is pending for {product_id}; check the release's stable-store job.")+ return "no-draft"+ path = f"/applications/{product_id}/submissions/{pending}"+ submission = call("GET", path)+ state = submission.get(_key(submission, "status") or "status")+ packages = submission.get(_key(submission, "applicationPackages") or "applicationPackages") or []+ bound = any(package.get("fileName") == store_file and package.get("fileStatus") != "PendingDelete"+ for package in packages)if state in _ALREADY_LIVE:return "already-live"- if state == _CERTIFIED_HELD:- _notice(f"Store submission {pending} passed certification and is held. "- "Open it in Partner Center and click Publish now.")- return "needs-publish-now"- if state in _IN_CERTIFICATION:- _notice(f"Store submission {pending} is still in certification ({state}). When it "- "passes, open it in Partner Center and click Publish now.")- return "in-certification"- raise StoreError(f"Store submission {pending} has an unexpected status: {state!r}")+ if state in _COMMITTED:+ return "already-committed" if bound else "other-committed"+ if state in _FAILED:+ raise StoreError(f"Store submission {pending} is {state}; resubmit from a green run")+ if state != _DRAFT:+ raise StoreError(f"Store submission {pending} has an unexpected status: {state!r}")+ if not bound:+ _notice(f"The pending Store draft {pending} does not carry {store_file}; a newer "+ "green run replaced it, and that release's publication commits it.")+ return "superseded"+ submission[_key(submission, "targetPublishMode") or "targetPublishMode"] = "Immediate"+ call("PUT", path, submission)+ call("POST", f"{path}/commit")+ after = call("GET", f"{path}/status").get("status")+ if after in _FAILED:+ raise StoreError(f"Store submission {pending} is {after} after commit")+ return "committed"def _notice(text: str) -> None:@@ -226,15 +230,25 @@ def _notice(text: str) -> None:print(f"::warning title=Microsoft Store::{text}")-def check_from_env(env: dict, run=_http_run) -> str:- """Check the Store submission when the environment configures it."""+def store_bundle(manifest: dict) -> str:+ """The Store bundle a candidate manifest names (the one ``materialize --store-only`` picks)."""+ names = [item["path"] for item in manifest.get("files", [])+ if item["path"].startswith("Store-") and item["path"].endswith(".msixbundle")]+ if len(names) != 1:+ raise StoreError(f"the candidate manifest names {len(names)} Store bundles, not one")+ return names[0]+++def release_from_env(env: dict, manifest: dict, run=_http_run) -> str:+ """Release the Store draft for ``manifest`` when the environment configures the Store."""product_id = env.get("MS_STORE_PRODUCT_ID")if not product_id:- print("Store check skipped: MS_STORE_PRODUCT_ID is not configured.",+ print("Store release skipped: MS_STORE_PRODUCT_ID is not configured.",file=sys.stderr)return "not-configured"- return check(+ return release(product_id=product_id,+ store_file=store_bundle(manifest),tenant_id=env["MS_STORE_TENANT_ID"],client_id=env["MS_STORE_CLIENT_ID"],client_secret=env["MS_STORE_CLIENT_SECRET"],@@ -249,12 +263,7 @@ def main(argv: list[str]) -> int:result = submit(package, product_id=product_id)print(json.dumps(result, sort_keys=True))return 0- if argv[:1] == ["check"]:- print(json.dumps({"result": check_from_env(dict(os.environ))},- sort_keys=True))- return 0- print("usage: python -m scripts.releases.store submit <package> | check",- file=sys.stderr)+ print("usage: python -m scripts.releases.store submit <package>", file=sys.stderr)return 2diff --git a/tests/scripts/test_release_sequencer.py b/tests/scripts/test_release_sequencer.pyindex da845126fc9..81dcfa1bd94 100644--- a/tests/scripts/test_release_sequencer.py+++ b/tests/scripts/test_release_sequencer.py@@ -588,10 +588,11 @@ def test_a_fresh_flip_advances_the_head_with_the_receipt_it_just_wrote():assert releases[0]["tag_name"] == "v0.21.5" and releases[0]["draft"] is False-def test_the_store_check_joins_the_pass_after_the_aliases_move(monkeypatch):+def test_the_store_release_joins_the_pass_after_the_aliases_move(monkeypatch):from scripts.releases import channel_releases, docker, sequencer, store- manifest_digest = hashlib.sha256(b"m").hexdigest()+ manifest = json.dumps({"files": [{"path": "Store-Product-win.msixbundle"}]}).encode()+ manifest_digest = hashlib.sha256(manifest).hexdigest()_tags, _releases, run = _sequencer_fixture("0.21.5", manifest_digest=manifest_digest, drafts_on_claim_tag=True)events = []@@ -603,20 +604,22 @@ def test_the_store_check_joins_the_pass_after_the_aliases_move(monkeypatch):monkeypatch.setattr(docker, "promote_stable",lambda claim_tag, digest, release_tag: events.append(("aliases", claim_tag, release_tag)))- seen_env = []+ seen = []monkeypatch.setattr(- store, "check_from_env",- lambda env: seen_env.append(env) or events.append(("store",)))+ store, "release_from_env",+ lambda env, manifest: seen.append((env, manifest)) or events.append(("store",)))steps = sequencer.reconcile({"GITHUB_REPOSITORY": "example/project", "MS_STORE_PRODUCT_ID": "9NTEST"},run=run, read_head=lambda: head[-1], advance_head=None,- read_archive=lambda _key: b"m",+ read_archive=lambda _key: manifest,)assert steps == [{"advance": "0.21.5"}]assert events == [("feed", "0.21.5"), ("aliases", "rc.1-v0.21.5", "v0.21.5"), ("store",)]- assert seen_env[0]["MS_STORE_PRODUCT_ID"] == "9NTEST"+ # The Store releases the draft named by the receipt-bound archived manifest.+ assert seen[0][0]["MS_STORE_PRODUCT_ID"] == "9NTEST"+ assert seen[0][1] == json.loads(manifest)def test_a_publish_that_died_before_the_retarget_is_repaired():@@ -661,7 +664,7 @@ def test_a_release_that_skipped_bundles_ships_only_its_tag_release_and_docker_almonkeypatch.setattr(channel_releases, "advance_stable",lambda *_args: pytest.fail("the protected R2 head moved"))- monkeypatch.setattr(store, "check_from_env", lambda _env: pytest.fail("the Store was checked"))+ monkeypatch.setattr(store, "release_from_env", lambda *_a: pytest.fail("the Store was released"))monkeypatch.setattr(channel_releases, "stable_head_version", lambda _env: "0.21.4")monkeypatch.setattr(docker, "promote_stable", promote)monkeypatch.setattr(docker, "stable_alias_digest", lambda: alias[0])@@ -693,7 +696,8 @@ def test_a_partial_desktop_release_moves_only_what_it_built(monkeypatch, lanes,from scripts.releases import channel_releases, docker as docker_module, sequencer, storedocker_digest = "sha256:" + "b" * 64 if docker else None- manifest = hashlib.sha256(b"m").hexdigest()+ archived = json.dumps({"files": [{"path": "Store-Product-win.msixbundle"}]}).encode()+ manifest = hashlib.sha256(archived).hexdigest()_tags, releases, run = _sequencer_fixture("0.21.5", manifest_digest=manifest, docker_digest=docker_digest, lanes=lanes)alias = [None]@@ -705,20 +709,20 @@ def test_a_partial_desktop_release_moves_only_what_it_built(monkeypatch, lanes,monkeypatch.setattr(channel_releases, "advance_stable",lambda *_args: pytest.fail("a partial desktop set moved the protected head"))- monkeypatch.setattr(store, "check_from_env", lambda _env: events.append(("store",)))+ monkeypatch.setattr(store, "release_from_env", lambda *_a: events.append(("store",)))monkeypatch.setattr(channel_releases, "stable_head_version", lambda _env: "0.21.4")monkeypatch.setattr(docker_module, "promote_stable", promote)monkeypatch.setattr(docker_module, "stable_alias_digest", lambda: alias[0])env = {"GITHUB_REPOSITORY": "example/project", "REQUESTED_VERSION": "0.21.5"}- steps = sequencer.reconcile(env, run=run, read_archive=lambda _key: b"m")+ steps = sequencer.reconcile(env, run=run, read_archive=lambda _key: archived)assert steps == [{"flip": "0.21.5"}, {"advance": "0.21.5"}]assert events == ([("aliases", "rc.1-v0.21.5", "v0.21.5")] if docker else []) + \([("store",)] if store_checked else [])assert releases[0]["tag_name"] == "v0.21.5" and releases[0]["draft"] is False# Finished: the alias carries the receipt's digest, or the release moves no channel at all.- assert sequencer.reconcile(env, run=run, read_archive=lambda _key: b"m") == []+ assert sequencer.reconcile(env, run=run, read_archive=lambda _key: archived) == []def test_the_sequencer_narrates_every_phase_on_stderr_and_keeps_stdout_json(capsys):diff --git a/tests/scripts/test_release_store.py b/tests/scripts/test_release_store.pyindex 13344260812..f0775bf46d5 100644--- a/tests/scripts/test_release_store.py+++ b/tests/scripts/test_release_store.py@@ -1,4 +1,4 @@-"""The Store submission is held until publish and is safe to rerun."""+"""The Store build stays an uncommitted draft until publication, which commits it."""import jsonimport pytest@@ -7,9 +7,9 @@ import pytestclass _Cli:"""Stands in for the msstore CLI. Records every argv it is handed."""- def __init__(self, pending):+ def __init__(self, status="Published"):self.events = []- self.pending = pending+ self.status = statusdef __call__(self, argv):name = " ".join(argv)@@ -17,12 +17,11 @@ class _Cli:# The real CLI prints Spectre markup for an MSIX app, never JSON, and nothing# when no submission is pending (rc.12-v0.21.7: "unreadable submission status: ''").self.events.append(("status", name))- return "Submission Status = Certification\n" if self.pending else ""+ return f"Submission Status = {self.status}\n"if argv[:3] == ["msstore", "submission", "get"]:self.events.append(("get", name))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")+ status = "PendingCommit" if uploaded else self.status# The CLI serializes .NET property names (rc.13-v0.21.7: '{"Id": ..., "ApplicationCategory": ...').return json.dumps({"Status": status, "TargetPublishMode": "Immediate",@@ -46,148 +45,164 @@ class _Cli:return [name for _kind, name in self.events]-def _index(names, prefix):- return next(index for index, name in enumerate(names)- if name.startswith(prefix))+def _names(cli):+ return cli.names()-def test_submit_deletes_the_in_flight_submission_first():+def test_submit_uploads_an_uncommitted_draft_and_stops():from scripts.releases.store import submit- cli = _Cli(pending=True)+ cli = _Cli()submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)names = cli.names()- assert _index(names, "msstore submission delete") \- < _index(names, "msstore publish ")- assert _index(names, "msstore submission delete") \- < _index(names, "msstore submission publish")+ assert names[-1] == "msstore publish verified/Store-1.2.3.msixbundle --appId 9NTEST --noCommit"+ assert not any(name.startswith(("msstore submission update", "msstore submission publish"))+ for name in names)-def test_submit_skips_the_delete_when_nothing_is_in_flight():[email protected]("status", ["PendingCommit", "CommitFailed", "CertificationFailed",+ "PreProcessingFailed", "ReleaseFailed", "Canceled"])+def test_submit_replaces_a_draft_or_failed_submission(status):from scripts.releases.store import submit- cli = _Cli(pending=False)+ cli = _Cli(status)submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)- assert not any(name.startswith("msstore submission delete")- for name in cli.names())+ names = cli.names()+ delete = names.index("msstore submission delete 9NTEST --no-confirm")+ assert delete < next(i for i, n in enumerate(names) if n.startswith("msstore publish "))-def test_submit_turns_auto_publish_off():[email protected]("status", ["Published", "None"])+def test_submit_leaves_a_settled_submission_alone(status):from scripts.releases.store import submit- cli = _Cli(pending=False)+ cli = _Cli(status)submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)- assert cli.updated["TargetPublishMode"] == "Manual"- assert "targetPublishMode" not in cli.updated-+ assert not any(name.startswith("msstore submission delete") for name in cli.names())-def test_submit_commits_the_held_submission():- from scripts.releases.store import submit- cli = _Cli(pending=False)- submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)- names = cli.names()- assert _index(names, "msstore submission update") \- < _index(names, "msstore submission publish")- assert names[-1].startswith("msstore submission publish")[email protected]("status", ["CommitStarted", "Certification", "Release", "Publishing"])+def test_submit_refuses_to_clobber_an_earlier_release_on_its_way_live(status):+ from scripts.releases.store import StoreError, submit+ cli = _Cli(status)+ with pytest.raises(StoreError, match="rerun stable-store"):+ submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)+ assert cli.names() == ["msstore submission get 9NTEST"]-def test_submit_keeps_the_submission_in_draft_until_the_mode_is_set():- from scripts.releases.store import submit- cli = _Cli(pending=False)- submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)- submit_call = next(name for name in cli.names() if name.startswith("msstore publish"))- assert "--noCommit" in submit_call- assert _index(cli.names(), "msstore publish ") \- < _index(cli.names(), "msstore submission update")+STORE_FILE = "Store-HermesBundled-2026.6864.2132.0-win.msixbundle"class _Api:- """Stands in for the Partner Center submission REST API (read-only use)."""+ """Stands in for the Partner Center submission REST API, with state."""- def __init__(self, status, pending="1152921504621243540"):+ def __init__(self, status="PendingCommit", files=(STORE_FILE,), pending="1152921504621243540",+ commit_status=200):self.requests = []self.status = status+ self.files = list(files)self.pending = pending+ self.commit_status = commit_status+ self.mode = "Manual"+ self.commits = 0def __call__(self, request):self.requests.append(request)url, method = request["url"], request["method"]if url.endswith("/token"):return {"status": 200, "body": {"access_token": "tok"}}- if method != "GET":- raise AssertionError(f"the check must never write: {method} {url}")if request.get("headers", {}).get("Authorization") != "Bearer tok":return {"status": 401, "body": {"code": "Unauthorized"}}- if url.endswith("/applications/9NTEST"):+ submission = f"/applications/9NTEST/submissions/{self.pending}"+ if method == "GET" and url.endswith("/applications/9NTEST"):app = {"id": "9NTEST"}if self.pending:app["pendingApplicationSubmission"] = {"id": self.pending}return {"status": 200, "body": app}- if url.endswith(f"/submissions/{self.pending}/status"):+ if method == "GET" and url.endswith(submission):+ return {"status": 200, "body": {+ "id": self.pending, "status": self.status, "targetPublishMode": self.mode,+ "applicationPackages": [{"fileName": f, "fileStatus": "Uploaded"} for f in self.files]}}+ if method == "GET" and url.endswith(f"{submission}/status"):return {"status": 200, "body": {"status": self.status}}+ if method == "PUT" and url.endswith(submission):+ if self.status != "PendingCommit":+ return {"status": 409, "body": {"code": "InvalidState"}}+ self.mode = request["body"]["targetPublishMode"]+ return {"status": 200, "body": request["body"]}+ if method == "POST" and url.endswith(f"{submission}/commit"):+ if self.commit_status != 200 or self.status != "PendingCommit":+ return {"status": self.commit_status if self.commit_status != 200 else 409, "body": {}}+ self.commits += 1+ self.status = "CommitStarted"+ return {"status": 200, "body": {"status": "CommitStarted"}}raise AssertionError(request)+ def writes(self):+ return [r for r in self.requests[1:] if r["method"] != "GET"]+-def _check(status, **kwargs):- from scripts.releases.store import check+def _release(api, store_file=STORE_FILE):+ from scripts.releases.store import release- api = _Api(status, **kwargs)- result = check(product_id="9NTEST", tenant_id="T", client_id="C",+ return release(product_id="9NTEST", store_file=store_file, tenant_id="T", client_id="C",client_secret="S", run=api)- return api, result-def test_a_certified_held_submission_asks_for_publish_now(capsys):- _api, result = _check("Release")- assert result == "needs-publish-now"- out = capsys.readouterr().out- assert out.startswith("::warning title=Microsoft Store::") and "Publish now" in out+def test_release_commits_this_releases_draft_with_auto_publish_on():+ api = _Api()+ assert _release(api) == "committed"+ assert api.mode == "Immediate" and api.commits == 1+ put, commit = api.writes()+ assert put["method"] == "PUT" and commit["url"].endswith("/commit")+++def test_release_is_safe_to_rerun():+ api = _Api()+ _release(api)+ assert _release(api) == "already-committed"+ assert api.commits == 1[email protected]("status", ["CommitStarted", "PreProcessing", "Certification"])-def test_a_submission_in_certification_says_what_comes_next(status, capsys):- _api, result = _check(status)- assert result == "in-certification"- out = capsys.readouterr().out- assert "Publish now" in out and status in out+def test_release_leaves_a_draft_from_another_green_run_alone(capsys):+ api = _Api(files=["Store-HermesBundled-2026.7000.1.0-win.msixbundle"])+ assert _release(api) == "superseded"+ assert api.writes() == [] and "::warning" in capsys.readouterr().out@pytest.mark.parametrize("status", ["PendingPublication", "Publishing", "Published"])-def test_a_live_submission_is_a_noop(status, capsys):- _api, result = _check(status)- assert result == "already-live"- assert capsys.readouterr().out == ""+def test_a_live_submission_is_a_noop(status):+ api = _Api(status)+ assert _release(api) == "already-live" and api.writes() == [][email protected]("status", ["CertificationFailed", "CommitFailed", "PublishFailed",- "Canceled"])-def test_a_failed_submission_leaves_the_run_red_and_says_to_resubmit(status):[email protected]("status", ["CertificationFailed", "CommitFailed", "PublishFailed", "Canceled"])+def test_a_failed_submission_raises_and_says_to_resubmit(status):from scripts.releases.store import StoreErrorwith pytest.raises(StoreError, match="resubmit from a green run"):- _check(status)+ _release(_Api(status))-def test_an_unknown_submission_status_leaves_the_run_red():+def test_a_refused_commit_raises():from scripts.releases.store import StoreError- with pytest.raises(StoreError, match="unexpected status"):- _check("SomethingNew")+ with pytest.raises(StoreError, match="commit failed: 409"):+ _release(_Api(commit_status=409))++def test_no_pending_draft_is_reported_not_invented(capsys):+ api = _Api(pending=None)+ assert _release(api) == "no-draft"+ assert api.writes() == [] and "::warning" in capsys.readouterr().out-def test_no_pending_submission_is_reported_not_invented(capsys):- _api, result = _check("Release", pending=None)- assert result == "no-submission"- assert "::warning" in capsys.readouterr().out+def test_an_unknown_submission_status_raises():+ from scripts.releases.store import StoreError-def test_the_check_never_writes_to_the_store():- # _Api raises on any non-GET after the token; every state must pass.- for status in ("Release", "Certification", "Published"):- api, _ = _check(status)- assert all(r["method"] == "GET" for r in api.requests[1:])+ with pytest.raises(StoreError, match="unexpected status"):+ _release(_Api("SomethingNew"))def test_http_run_sends_the_request_headers(monkeypatch):@@ -219,30 +234,31 @@ def test_http_run_sends_the_request_headers(monkeypatch):assert sent["authorization"] == "Bearer tok"-def test_check_from_env_skips_when_the_store_is_not_configured():- from scripts.releases.store import check_from_env+def test_release_from_env_skips_when_the_store_is_not_configured():+ from scripts.releases.store import release_from_env- assert check_from_env({}) == "not-configured"+ assert release_from_env({}, {"files": []}) == "not-configured"-def test_check_from_env_passes_the_configured_credentials():- from scripts.releases.store import check_from_env+def test_release_from_env_releases_the_manifests_store_bundle_with_the_configured_credentials():+ from scripts.releases.store import release_from_env- api = _Api("Published")+ api = _Api()env = {"MS_STORE_PRODUCT_ID": "9NTEST","MS_STORE_TENANT_ID": "TENANT","MS_STORE_CLIENT_ID": "CLIENT","MS_STORE_CLIENT_SECRET": "SECRET",}- assert check_from_env(env, run=api) == "already-live"+ manifest = {"files": [{"path": "HermesBundled-0.22.0-win.msixbundle"}, {"path": STORE_FILE}]}+ assert release_from_env(env, manifest, run=api) == "committed"token = next(r for r in api.requests if r["url"].endswith("/token"))assert token["form"]["client_id"] == "CLIENT"assert token["form"]["client_secret"] == "SECRET"-def test_submit_reads_and_writes_the_keys_as_the_submission_spells_them():- """The CLI emits PascalCase; a camelCase (REST-shaped) submission keeps its own keys."""+def test_submit_reads_the_status_as_the_submission_spells_it():+ """The CLI emits PascalCase; a camelCase (REST-shaped) submission works the same."""from scripts.releases.store import submitclass _CamelCli(_Cli):@@ -253,7 +269,6 @@ def test_submit_reads_and_writes_the_keys_as_the_submission_spells_them():return json.dumps({k[0].lower() + k[1:]: v for k, v in data.items()})return out- cli = _CamelCli(pending=True)+ cli = _CamelCli("PendingCommit")submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)- assert any(name.startswith("msstore submission delete") for name in cli.names())- assert cli.updated["targetPublishMode"] == "Manual" and "TargetPublishMode" not in cli.updated+ assert "msstore submission delete 9NTEST --no-confirm" in cli.names()diff --git a/website/docs/developer-guide/stable-releases.md b/website/docs/developer-guide/stable-releases.mdindex 5add96e6090..42298ca33a4 100644--- a/website/docs/developer-guide/stable-releases.md+++ b/website/docs/developer-guide/stable-releases.md@@ -279,11 +279,14 @@ at `releases/tag/<attempt ref>/index.html` is not an update feed, and anattempt installed from it is not upgrade-safe: every attempt of a version hasthe same package version, so the published build never replaces it. The Dockerimage is pushed early under the attempt ref; the `stable` and `latest` aliases-move with the feed in the publication pass. The Store submission is held: the-green run submits with auto-publish off. The submission API cannot release a-held submission, so the publication pass only checks it and prints a GitHub-warning; once certification passes, click Publish now for that submission in-Partner Center. A failed submission leaves the publication run red. Stable channel+move with the feed in the publication pass. The Store build follows the same+rule: the green run uploads it as an uncommitted draft, and the publication+pass commits that draft with auto-publish on, so it goes live as soon as+certification passes. The submission API cannot release a submission once it+is committed and held, which is why the commit waits for publication. A draft+that does not carry the release's Store bundle (a newer green run replaced it)+is left for that release's publication. A failed submission becomes a warning;+the release still publishes. Stable channelrecords carry an optional `archiveRef` naming the attempt ref; `releaseTag`stays `vX.Y.Z` and the protected prefix falls back to it when `archiveRef` isabsent.