From 735d4076c1351109b73a1b1129215879c91207db Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Aug 2026 10:03:43 -0500 Subject: [PATCH] Keep the top-level suppression total and honest The check guards URL-ish names before _node_key (a malformed entry belongs to the drop warning, not a RuntimeError) and matches against top_level_keys so the message says exactly what it verifies; a transitive-only node can still fail compatibility later and must not suppress the drop report. --- esphome/platformio/library.py | 5 ++++- tests/unit_tests/test_platformio_library.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/esphome/platformio/library.py b/esphome/platformio/library.py index 049d4f3b87..999b1d3f11 100644 --- a/esphome/platformio/library.py +++ b/esphome/platformio/library.py @@ -994,7 +994,10 @@ def convert_libraries( dep_name = dependency.get("name") if ( isinstance(dep_name, str) - and _node_key(dep_name, None, None)[0] in nodes + # _node_key raises for a malformed URL-ish name; that + # entry belongs to the warning below, not a traceback + and "://" not in dep_name + and _node_key(dep_name, None, None)[0] in top_level_keys ): # Already requested top-level: present in the build, not # a drop (a false warning teaches users to ignore the diff --git a/tests/unit_tests/test_platformio_library.py b/tests/unit_tests/test_platformio_library.py index 8202658675..4b5b4508a0 100644 --- a/tests/unit_tests/test_platformio_library.py +++ b/tests/unit_tests/test_platformio_library.py @@ -665,3 +665,17 @@ def test_versionless_dependency_requested_top_level_stays_quiet( _backend(), ) assert "has no version to resolve" not in caplog.text + + +def test_versionless_url_ish_dependency_name_warns_cleanly( + tmp_path, monkeypatch, caplog: pytest.LogCaptureFixture +) -> None: + """A malformed URL-ish dependency name falls to the drop warning, never + a RuntimeError out of the key parser.""" + _patch_download_with_manifests( + monkeypatch, + tmp_path, + {"esphome/A": {"name": "A", "dependencies": [{"name": "file://"}]}}, + ) + convert_libraries([Library("esphome/A", None, None)], _backend()) + assert "'file://' of esphome/A has no version to resolve" in caplog.text