An independent review of every deleted test against its named keeper
found contracts whose only proof had gone, or that no test had ever
pinned. Each restoration is one assertion in an existing test, proven red
by the production mutation named:
- gateway /model reply shows the context length the async resolver
returns (the deleted async-matches-sync test was its only check);
red when resolve_display_context_length_async drops the value.
- parse_model_switch_args("sonnet") has scope "default" (the deleted
tuple test covered the no-flag case).
- shared metrics runtime sends nothing when collection is on but send is
off; red when the gate reads resolved.enabled instead of resolved.send.
- the terminal env-sync test also probes every key gateway.run's bridge
looks up, so a gateway-only key (which the old source parse caught)
still fails it.
- desktop: the deliver ceiling equals the backend's lock wait plus every
attempt, read from the Python defaults.
Also: the tools/bot_relay.py mirror comment names relay-budget.ts, and a
comment orphaned by the Windows encoding-test deletion goes with it.
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
"""Single-owner /model argument parsing (hermes_cli.model_switch.parse_model_switch_args)."""
|
|
|
|
|
|
from hermes_cli.model_switch import (
|
|
MODEL_SWITCH_ERR_ONCE_WITH_GLOBAL,
|
|
MODEL_SWITCH_ERROR_TEXT,
|
|
parse_model_switch_args,
|
|
)
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
|
# parse_model_switch_args — the ONE parser
|
|
# ---------------------------------------------------------------------------
|
|
|
|
|
|
def test_provider_flag_and_scopes():
|
|
req = parse_model_switch_args("sonnet --provider anthropic --global")
|
|
assert req.target == "sonnet"
|
|
assert req.explicit_provider == "anthropic"
|
|
assert req.is_global is True
|
|
assert req.scope == "global"
|
|
assert req.errors == ()
|
|
|
|
assert parse_model_switch_args("sonnet").scope == "default"
|
|
assert parse_model_switch_args("sonnet --session").scope == "session"
|
|
assert parse_model_switch_args("sonnet \u2013session").scope == "session" # iOS/Telegram en-dash
|
|
assert parse_model_switch_args("sonnet --once").scope == "once"
|
|
assert parse_model_switch_args("--refresh").force_refresh is True
|
|
|
|
|
|
def test_once_with_global_conflict():
|
|
req = parse_model_switch_args("sonnet --once --global")
|
|
assert MODEL_SWITCH_ERR_ONCE_WITH_GLOBAL in req.errors
|
|
assert MODEL_SWITCH_ERROR_TEXT[MODEL_SWITCH_ERR_ONCE_WITH_GLOBAL] in req.error_messages()
|