mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-09 08:21:50 +00:00
refactor(inventory): make force_fresh_nous_tier keyword-only + pin contract
Some checks failed
Deploy Site / deploy-vercel (push) Waiting to run
Deploy Site / deploy-docs (push) Waiting to run
Docker Build and Publish / build-amd64 (push) Waiting to run
Docker Build and Publish / build-arm64 (push) Waiting to run
Docker Build and Publish / merge (push) Blocked by required conditions
Lint (ruff + ty) / ruff + ty diff (push) Waiting to run
Lint (ruff + ty) / ruff enforcement (blocking) (push) Waiting to run
Lint (ruff + ty) / Windows footguns (blocking) (push) Waiting to run
Nix Lockfile Fix / auto-fix-main (push) Waiting to run
Nix Lockfile Fix / fix (push) Waiting to run
Nix / nix (macos-latest) (push) Waiting to run
Nix / nix (ubuntu-latest) (push) Waiting to run
Tests / test (1) (push) Waiting to run
Tests / test (2) (push) Waiting to run
Tests / test (3) (push) Waiting to run
Tests / test (4) (push) Waiting to run
Tests / test (5) (push) Waiting to run
Tests / test (6) (push) Waiting to run
Tests / save-durations (push) Blocked by required conditions
Tests / e2e (push) Waiting to run
OSV-Scanner / Scan lockfiles (push) Has been cancelled
uv.lock check / uv lock --check (push) Has been cancelled
Some checks failed
Deploy Site / deploy-vercel (push) Waiting to run
Deploy Site / deploy-docs (push) Waiting to run
Docker Build and Publish / build-amd64 (push) Waiting to run
Docker Build and Publish / build-arm64 (push) Waiting to run
Docker Build and Publish / merge (push) Blocked by required conditions
Lint (ruff + ty) / ruff + ty diff (push) Waiting to run
Lint (ruff + ty) / ruff enforcement (blocking) (push) Waiting to run
Lint (ruff + ty) / Windows footguns (blocking) (push) Waiting to run
Nix Lockfile Fix / auto-fix-main (push) Waiting to run
Nix Lockfile Fix / fix (push) Waiting to run
Nix / nix (macos-latest) (push) Waiting to run
Nix / nix (ubuntu-latest) (push) Waiting to run
Tests / test (1) (push) Waiting to run
Tests / test (2) (push) Waiting to run
Tests / test (3) (push) Waiting to run
Tests / test (4) (push) Waiting to run
Tests / test (5) (push) Waiting to run
Tests / test (6) (push) Waiting to run
Tests / save-durations (push) Blocked by required conditions
Tests / e2e (push) Waiting to run
OSV-Scanner / Scan lockfiles (push) Has been cancelled
uv.lock check / uv lock --check (push) Has been cancelled
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:
parent
eb70ab894b
commit
44c0c2d4ac
2 changed files with 19 additions and 0 deletions
|
|
@ -1178,6 +1178,7 @@ def list_authenticated_providers(
|
|||
current_base_url: str = "",
|
||||
user_providers: dict = None,
|
||||
custom_providers: list | None = None,
|
||||
*,
|
||||
force_fresh_nous_tier: bool = False,
|
||||
max_models: int = 8,
|
||||
current_model: str = "",
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue