From e15bdef4cd4a3b2c5c2f389634018a2bc2d37a90 Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Thu, 19 Nov 2026 12:23:29 +0530 Subject: [PATCH 1/2] docs(changelog): note the lab env request-before-approve fix [no ci] Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a64f510..b9c7fbd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Types of changes: ### Removed ### Fixed +- `publish-lab-env.yml` files a publish request before it approves the environment. Since qBraid/qbraid-api#1334 the server approves only an environment with an open request, so every run failed at approve with `Environment must have status REQUESTED or PENDING to publish`. The request counts toward the API key owner's publish quota and notifies the platform admins ([#491](https://github.com/qBraid/pyqasm/pull/491), [#490](https://github.com/qBraid/pyqasm/issues/490)). ### Dependencies From 19c37f145286cdb71c4bfd31c6bd82593090fd6c Mon Sep 17 00:00:00 2001 From: TheGupta2012 Date: Thu, 19 Nov 2026 12:23:29 +0530 Subject: [PATCH 2/2] fix(lab-env): request publication before approving the environment qbraid-api now approves only an environment with an open publish request, so the direct approve failed with status NONE. File the request first when the status is NONE or DENIED. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/publish-lab-env.yml | 5 +++-- bin/publish_lab_env.py | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish-lab-env.yml b/.github/workflows/publish-lab-env.yml index 981cddad..7eca7315 100644 --- a/.github/workflows/publish-lab-env.yml +++ b/.github/workflows/publish-lab-env.yml @@ -9,8 +9,9 @@ name: Publish qBraid Lab environment # variable QBRAID_ENV_LOGO_URL https URL of a PNG logo (optional; overrides the # pyqasm light and dark logos in bin/publish_lab_env.py) # The steps live in bin/publish_lab_env.py and bin/lab_env_smoke_test.py. -# The run approves directly, without a publish request. That skips the per-plan -# publish quota and the email a request sends every platform admin. +# The run files a publish request and then approves it, because the server +# approves only an environment with an open request. The request counts toward +# the key owner's per-plan publish quota and notifies the platform admins. on: workflow_dispatch: diff --git a/bin/publish_lab_env.py b/bin/publish_lab_env.py index 26b3c6b6..cf625fb3 100644 --- a/bin/publish_lab_env.py +++ b/bin/publish_lab_env.py @@ -318,7 +318,7 @@ def should_set_latest(client: Any, settings: Settings, current: Optional[str], s def publish(settings: Settings, slug: str) -> None: - """Approve, then add to the group as its latest. Skips steps already done.""" + """Request and approve, then add to the group as its latest. Skips steps already done.""" steps = PUBLISH_STEPS[: PUBLISH_STEPS.index(settings.stop_after) + 1] group = settings.group if "publish" in steps and not group: @@ -330,9 +330,11 @@ def publish(settings: Settings, slug: str) -> None: if status == "APPROVED": print(f"'{slug}' is already approved.") else: - # Approve works from any status. Skipping the publish request avoids the - # per-plan publish quota and the email that a request sends every admin. - # Approving is what publishes to the catalog: it makes the environment public. + # The server approves only an environment with an open request, so file one + # first. A request counts toward the owner's per-plan publish quota and + # notifies the platform admins. Approving is what makes the environment public. + if status not in ("REQUESTED", "PENDING"): + client.request_publish(slug) client.approve_publish(slug) status = review_status(client, slug) if status != "APPROVED":