fix(proxy): keep general_settings type-name path fully typed

basedpyright's strict gate counted type(general_settings) as a new
reportUnknownArgumentType because the YAML-derived value is Unknown.
Route the runtime class name through an object-typed helper so the type()
argument is known while preserving the actionable error message.
This commit is contained in:
linhongyu510 2026-10-04 14:45:52 +08:00
parent c4e6f6b6a0
commit 8003d5920b

View file

@ -1014,6 +1014,16 @@ class ProxyInitializationHelpers:
),
envvar="PROMETHEUS_METRICS_PORT",
)
def _value_type_name(value: object) -> str:
"""Return the runtime class name of an arbitrary config value.
The value read from YAML is untyped; annotate the parameter as ``object``
so ``type()`` receives a known-typed argument and the strict type gate does
not count a ``reportUnknownArgumentType`` error on the error path.
"""
return type(value).__name__
def run_server(
cli_args,
host,
@ -1230,7 +1240,7 @@ def run_server(
elif not isinstance(general_settings, dict):
raise ValueError(
"`general_settings` in the proxy config must be a mapping "
f"(got {type(general_settings).__name__}). Check the "
f"(got {_value_type_name(general_settings)}). Check the "
"`general_settings:` block in your config file."
)
### LOAD KEY MANAGEMENT SETTINGS FIRST (needed for custom secret manager) ###