feat: export TelemetryStatus from the package root
client.telemetry_status exists so downstream can reconcile telemetry programmatically, but annotating its return type meant reaching into polygateway.types while the convention here is that the top-level exports are the public API surface. The port itself stays unexported: nobody outside the library implements it.
This commit is contained in:
@@ -31,6 +31,7 @@ from polygateway.types import (
|
||||
OcrLayoutResult,
|
||||
OcrTextResult,
|
||||
SourceConfig,
|
||||
TelemetryStatus,
|
||||
)
|
||||
|
||||
__version__ = "1.2.4"
|
||||
@@ -61,6 +62,7 @@ __all__ = [
|
||||
"SourceConfig",
|
||||
"SourceDeadError",
|
||||
"SourceNotConfiguredError",
|
||||
"TelemetryStatus",
|
||||
"TransientError",
|
||||
"__version__",
|
||||
"gather_bounded",
|
||||
|
||||
@@ -37,3 +37,15 @@ def test_telemetry_schema_sql_exported():
|
||||
assert callable(polygateway.telemetry_schema_sql)
|
||||
assert "missing_columns_warning" not in polygateway.__all__
|
||||
assert not hasattr(polygateway, "missing_columns_warning")
|
||||
|
||||
|
||||
def test_telemetry_status_exported():
|
||||
"""issue #15: `client.telemetry_status` 的返回类型必须能从顶层 import。
|
||||
|
||||
下游对账/告警要给这个快照做类型标注,若只在 `polygateway.types` 里,标注就得
|
||||
深入子模块,而本库的约定是「顶层导出即公共 API 面」。`TelemetryStatusProvider`
|
||||
则**不**导出: 它是端口,库外无实现者,导出即多一份永久承诺。
|
||||
"""
|
||||
assert "TelemetryStatus" in polygateway.__all__
|
||||
assert polygateway.TelemetryStatus is not None
|
||||
assert "TelemetryStatusProvider" not in polygateway.__all__
|
||||
|
||||
Reference in New Issue
Block a user