From 84230673b97c261dba2cdbded01b8d21f7ef0c7f Mon Sep 17 00:00:00 2001 From: iomgaa Date: Sat, 5 Sep 2026 01:17:12 -0400 Subject: [PATCH] fix: import the ThinkingWire that __all__ already promised MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous commit added the name to __all__ but never bound it, so `from polygateway import ThinkingWire` and `import *` both raised while the whole suite stayed green — the export test names symbols one by one, and nobody thought to add the new one. The guard is now the invariant rather than a longer list: every name in __all__ must be an attribute of the package. --- src/polygateway/__init__.py | 7 ++++++- tests/unit/test_package.py | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/polygateway/__init__.py b/src/polygateway/__init__.py index b7b1f9e..fb1c1ad 100644 --- a/src/polygateway/__init__.py +++ b/src/polygateway/__init__.py @@ -22,7 +22,12 @@ from polygateway.errors import ( ) from polygateway.ocr import OcrClient from polygateway.pricing import ModelPrice, PricingTable -from polygateway.providers import DEFAULT_PROFILES, ProviderProfile, register_provider +from polygateway.providers import ( + DEFAULT_PROFILES, + ProviderProfile, + ThinkingWire, + register_provider, +) from polygateway.telemetry.schema import telemetry_schema_sql from polygateway.thinking import ( ThinkingCapability, diff --git a/tests/unit/test_package.py b/tests/unit/test_package.py index 7730a97..52866a4 100644 --- a/tests/unit/test_package.py +++ b/tests/unit/test_package.py @@ -66,6 +66,7 @@ def test_thinking_public_surface_exported(): "ThinkingCapability", "ThinkingObservation", "ThinkingUnsupportedError", + "ThinkingWire", "get_capability", "register_capability", "resolve_thinking", @@ -74,3 +75,14 @@ def test_thinking_public_surface_exported(): assert name in polygateway.__all__, name assert "observe_thinking" not in polygateway.__all__ assert "reconcile_thinking" not in polygateway.__all__ + + +def test_every_promised_export_is_actually_importable(): + """`__all__` 里的每个名字都必须真的绑在包上。 + + 只维护 `__all__` 而漏掉 import,`from polygateway import X` 与 `import *` + 都会当场炸,而逐个点名的用例只覆盖它当时想到的符号——2026-09-04 的 + `ThinkingWire` 正是这样漏进来的(在 `__all__` 里躺了一个提交却 import 不到)。 + """ + missing = [name for name in polygateway.__all__ if not hasattr(polygateway, name)] + assert not missing, f"__all__ 承诺了但没绑上的符号: {missing}"