mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-18 13:40:22 +00:00
test: fix CI stubs for profile_config; widen #1855 source window
CI Tests job (run 28525484615) failed one test per shard: - Stubs for _resolve_compatible_session_model_state lacked profile_config (wakeup wiring spy, start_session_turn runtime adapter fixture). - #1855 structural test used 6k char slice; resolver helper outgrew window. Co-authored-by: b3nw <b3nw@users.noreply.github.com>
This commit is contained in:
@@ -269,7 +269,12 @@ class TestFastPathSourceShape:
|
||||
"""The fast-path return must come BEFORE the catalog lookup."""
|
||||
src = _read("api/routes.py")
|
||||
idx = src.find("def _resolve_compatible_session_model_state(")
|
||||
body = src[idx:idx + 6000]
|
||||
# Helper grew (profile_config, custom repair); 6k window no longer reaches
|
||||
# the slow-path catalog call — use a bounded slice through the next def.
|
||||
body = src[idx:idx + 12000]
|
||||
next_def = body.find("\ndef ", 100)
|
||||
if next_def != -1:
|
||||
body = body[:next_def]
|
||||
fast_path_idx = body.find("if model and requested_provider:")
|
||||
catalog_idx = body.find("catalog = get_available_models()")
|
||||
assert fast_path_idx != -1 and catalog_idx != -1
|
||||
|
||||
@@ -50,7 +50,7 @@ def _stub_routes(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
routes_mod,
|
||||
"_resolve_compatible_session_model_state",
|
||||
lambda model, provider, profile_provider=None, profile_default_model=None, prefer_cached_catalog=False: (model, provider, model),
|
||||
lambda model, provider, **kwargs: (model, provider, model),
|
||||
)
|
||||
|
||||
# 4. Block the per-session live-view fan-out (it pokes a real registry).
|
||||
|
||||
@@ -123,13 +123,15 @@ def test_wakeup_resolve_passes_prefer_cached_catalog(monkeypatch):
|
||||
real = routes._resolve_compatible_session_model_state
|
||||
|
||||
def _spy(model_id, model_provider=None, *, profile_provider=None,
|
||||
profile_default_model=None, prefer_cached_catalog=False):
|
||||
profile_default_model=None, profile_config=None,
|
||||
prefer_cached_catalog=False, **kwargs):
|
||||
seen["prefer_cached_catalog"] = prefer_cached_catalog
|
||||
# The wakeup path now also threads the session's profile model defaults
|
||||
# through (greptile fix) so a brand-new session with an empty model
|
||||
# falls back to the profile default, not the global DEFAULT_MODEL.
|
||||
seen["profile_provider"] = profile_provider
|
||||
seen["profile_default_model"] = profile_default_model
|
||||
seen["profile_config"] = profile_config
|
||||
return ("m", None, False)
|
||||
|
||||
monkeypatch.setattr(
|
||||
|
||||
Reference in New Issue
Block a user