From 009d202231220981f5e64ada04daa0c2730d108f Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Fri, 7 Aug 2026 12:04:15 +1000 Subject: [PATCH 1/2] cli: inspect detail and details keys on error (bug 2059648) --- lando_cli/cli.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lando_cli/cli.py b/lando_cli/cli.py index 06b84f6..78172c9 100644 --- a/lando_cli/cli.py +++ b/lando_cli/cli.py @@ -147,7 +147,14 @@ def post_actions( try: response_json = result.json() - click.echo(response_json["details"]) + # Bug 2059648: check the desired property, + # but fall back to the deprecated one. + click.echo( + response_json.get( + "detail", + response_json.get("details", "(missing detail in error response)"), + ) + ) except Exception: click.echo("Unknown error.") From f69bfde9bade166fddfaaf7f5de4a142780060a8 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Mon, 10 Aug 2026 13:59:02 +1000 Subject: [PATCH 2/2] test: add test for detail/details support --- tests/test_cli.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 606bf4f..0204fae 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,6 +1,8 @@ from typing import Callable import pytest from pathlib import Path +import requests +import requests_mock import subprocess from lando_cli.cli import ( @@ -12,9 +14,15 @@ detect_merge_from_current_head, determine_base_sha_for_push, get_current_branch, + post_actions, ) +@pytest.fixture +def config() -> Config: + return Config("token", "https://lando.example.net", "user@example.net", True) + + @pytest.mark.parametrize( "config_content, expected, should_raise", [ @@ -230,3 +238,25 @@ def test_determine_base_sha_for_push_with_relbranch_missing( "branch_name": "FIREFOX_101_RELBRANCH", "commit_sha": merge_base, } + + +@pytest.mark.parametrize("error_key", ("detail", "details", None)) +def test_post_actions_error_details( + config: Config, capsys: pytest.CaptureFixture, error_key: str | None +): + with requests_mock.Mocker() as m: + repo_name = "test-repo" + m.post( + f"{config.lando_url}/api/repo/{repo_name}", + json={error_key: "Some error"}, + status_code=400, + ) + with pytest.raises(requests.HTTPError): + post_actions(config, repo_name, [{}]) + + outerr = capsys.readouterr() + + if error_key: + assert "Some error" in outerr.out + else: + assert "(missing detail in error response)" in outerr.out