refactor(inventory): make force_fresh_nous_tier keyword-only + pin contract
Follow-up to the salvaged perf fix. The new force_fresh_nous_tier param was inserted into list_authenticated_providers between custom_providers and max_models. Make it keyword-only (*) so a positional caller passing max_models as the 5th arg can never silently mis-bind it to the tier-refresh flag, and add a signature-contract test that fails if the keyword-only separator is later dropped. All in-repo callers already use keyword args; verified no caller breaks.
This commit is contained in:
@@ -217,6 +217,24 @@ def test_build_models_payload_can_force_fresh_nous_tier():
|
||||
assert mock_list.call_args.kwargs["force_fresh_nous_tier"] is True
|
||||
|
||||
|
||||
def test_list_authenticated_providers_force_fresh_is_keyword_only():
|
||||
"""``force_fresh_nous_tier`` must be keyword-only on the public listing API.
|
||||
|
||||
It was inserted between ``custom_providers`` and ``max_models``; making it
|
||||
keyword-only ensures no positional caller passing ``max_models`` as the 5th
|
||||
arg silently mis-binds it to the tier-refresh flag. Pin the contract so a
|
||||
future signature edit that drops the ``*`` separator is caught.
|
||||
"""
|
||||
import inspect
|
||||
|
||||
from hermes_cli.model_switch import list_authenticated_providers
|
||||
|
||||
sig = inspect.signature(list_authenticated_providers)
|
||||
param = sig.parameters["force_fresh_nous_tier"]
|
||||
assert param.kind is inspect.Parameter.KEYWORD_ONLY
|
||||
assert param.default is False
|
||||
|
||||
|
||||
def test_pricing_uses_cached_nous_tier_by_default():
|
||||
rows = [_nous_row()]
|
||||
ctx = _empty_ctx(provider="nous", model="openai/gpt-5.5")
|
||||
|
||||
Reference in New Issue
Block a user