From 4396eda26ceb7c080b22d1e6b76912c2c91d6c27 Mon Sep 17 00:00:00 2001 From: Tejas-Raj01 Date: Fri, 26 Jun 2026 14:06:41 +0530 Subject: [PATCH 1/2] fix(store): raise error when upload processing status is 'error' Ensure the CLI raises a SnapcraftError and aborts the process if the store processing review returns an 'error' code, preventing silent failures and misleading success messages. Fixes #6299 --- snapcraft/store/client.py | 5 +++++ tests/unit/store/test_client.py | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/snapcraft/store/client.py b/snapcraft/store/client.py index e4686b76ea..d9ee01756d 100644 --- a/snapcraft/store/client.py +++ b/snapcraft/store/client.py @@ -576,6 +576,11 @@ def notify_upload( # noqa: PLR0913 (too-many-arguments) raise errors.SnapcraftError( f"Issues while processing snap:\n{error_string}" ) + if status.get("code") == "error": + raise errors.SnapcraftError( + f"Store processing failed with status: {human_status!r}. " + "Please check the automated review on the Snap Store." + ) break time.sleep(_POLL_DELAY) diff --git a/tests/unit/store/test_client.py b/tests/unit/store/test_client.py index e44f0d0151..8ac35f996b 100644 --- a/tests/unit/store/test_client.py +++ b/tests/unit/store/test_client.py @@ -2277,3 +2277,38 @@ def test_on_prem_list_releases( headers={"Content-Type": "application/json", "Accept": "application/json"}, ) ] + + +def test_notify_upload_error_status_raises_error(mocker): + """Test that notify_upload raises SnapcraftError if store processing returns code 'error'.""" + status_url = "https://dashboard.snapcraft.io/dev/api/snap-push/123/status/" + + # Use the exact class we found from grep + test_client = client.StoreClientCLI() + + post_response = mocker.Mock() + post_response.json.return_value = {"status_details_url": status_url} + + get_response = mocker.Mock() + get_response.json.return_value = { + "processed": True, + "code": "error", + "errors": [], + "revision": 1, + } + + mocker.patch.object( + test_client, "request", side_effect=[post_response, get_response] + ) + + with pytest.raises( + errors.SnapcraftError, match="Store processing failed with status" + ): + test_client.notify_upload( + snap_name="test-snap", + upload_id="upload-123", + snap_file_size=1024, + built_at=None, + channels=None, + components=None, + ) From 2b5207405522452f6a7f57b21c2a1c054b92fbc7 Mon Sep 17 00:00:00 2001 From: Tejas-Raj01 Date: Tue, 21 Jul 2026 15:08:11 +0530 Subject: [PATCH 2/2] fix(docs): update readthedocs URLs to documentation.ubuntu.com --- docs/explanation/cryptography.rst | 10 +++++----- docs/reference/package-repositories.rst | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/explanation/cryptography.rst b/docs/explanation/cryptography.rst index bf634757c0..0b67442817 100644 --- a/docs/explanation/cryptography.rst +++ b/docs/explanation/cryptography.rst @@ -282,11 +282,11 @@ is invoked by the consuming application. .. _Apt: https://wiki.debian.org/AptCLI .. _Bazaar: https://launchpad.net/bzr -.. _Craft Application cryptography: https://canonical-craft-application.readthedocs-hosted.com/en/latest/explanation/cryptography/ -.. _Craft Archives cryptography: https://canonical-craft-archives.readthedocs-hosted.com/en/latest/explanation/cryptography/ -.. _Craft Parts cryptography: https://canonical-craft-parts.readthedocs-hosted.com/en/latest/explanation/cryptography/ -.. _Craft Providers cryptography: https://canonical-craft-providers.readthedocs-hosted.com/en/latest/explanation/cryptography/ -.. _Craft Store cryptography: https://canonical-craft-store.readthedocs-hosted.com/en/latest/explanation/cryptography/ +.. _Craft Application cryptography: https://documentation.ubuntu.com/craft-application/latest/explanation/cryptography/ +.. _Craft Archives cryptography: https://documentation.ubuntu.com/craft-archives/latest/explanation/cryptography/ +.. _Craft Parts cryptography: https://documentation.ubuntu.com/craft-parts/latest/explanation/cryptography/ +.. _Craft Providers cryptography: https://documentation.ubuntu.com/craft-providers/latest/explanation/cryptography/ +.. _Craft Store cryptography: https://documentation.ubuntu.com/craft-store/latest/explanation/cryptography/ .. _Crystal snap: https://snapcraft.io/crystal .. _curl: https://curl.se/ .. _dirmngr: https://manpages.ubuntu.com/manpages/noble/man8/dirmngr.8.html diff --git a/docs/reference/package-repositories.rst b/docs/reference/package-repositories.rst index d52ebf3249..d08cd0fea0 100644 --- a/docs/reference/package-repositories.rst +++ b/docs/reference/package-repositories.rst @@ -19,4 +19,4 @@ packages. For more information on how to configure package repositories, see the `Craft Archives documentation`_. -.. _Craft Archives documentation: https://canonical-craft-archives.readthedocs-hosted.com/en/latest/reference/repo_properties/ +.. _Craft Archives documentation: https://documentation.ubuntu.com/craft-archives/latest/