node registration fixes

This commit is contained in:
Dobromir Popov
2026-07-15 10:34:41 +02:00
parent ba7c656364
commit 97e2784b37
5 changed files with 214 additions and 8 deletions

View File

@@ -1101,12 +1101,15 @@ def _registration_quantization(body: dict, quantizations: list[str]) -> str | No
An absent field predates the protocol adding it: it means "unknown", not
"unsupported", so the node keeps the best precision it advertises and stays
routable. Anything the node states explicitly is taken at its word -- a null,
a non-string, or an unsupported name leaves it with no usable precision and
routing excludes it.
routable. An explicit "auto" means the same thing — the node's CLI default
delegates the choice, it does not refuse one. Anything else the node states
explicitly is taken at its word -- a null, a non-string, or an unsupported
name leaves it with no usable precision and routing excludes it.
"""
if "quantization" in body:
return _normalize_quantization(body["quantization"])
declared = body.get("quantization")
declared_auto = isinstance(declared, str) and declared.strip().lower() == "auto"
if "quantization" in body and not declared_auto:
return _normalize_quantization(declared)
supported = [
normalized for value in quantizations
if (normalized := _normalize_quantization(value)) is not None