mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-17 03:59:28 +00:00
test(learning-harness): apply the group 1 review suggestions
A mechanism claimed by two families now fails as loudly as a weakness claimed twice, with a named offender. Two behaviours that were correct but unasserted are pinned: the obligations tool refuses a path outside the repository, and a provider that refuses to build degrades to no endpoint instead of raising into a scan. The TypeScript parse assertion is now exact rather than a quarter-of- the-slice allowance, which surfaces one real corpus defect: a TSX excerpt harvested as a truncated destructuring parameter list is not valid TypeScript on its own, and belongs to the re-harvest rather than to the grammar. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01T7XD7x5KonMdmGRkp63EQG
This commit is contained in:
co-authored by
Claude Opus 5
parent
d05c516a10
commit
17fc18c785
@@ -67,6 +67,18 @@ def test_resolution_order_override_then_scripted_then_openrouter_then_none(monke
|
||||
assert resolve_chat_endpoint(ResolvedConfig()) is None
|
||||
|
||||
|
||||
def test_a_provider_that_refuses_to_build_degrades_to_no_endpoint(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
from openultrasast.learning.endpoint import resolve_chat_endpoint
|
||||
|
||||
_endpoint_env(monkeypatch, OPENROUTER_API_KEY="or-key")
|
||||
|
||||
def _refuse() -> provider.OpenRouterChatClient:
|
||||
raise provider.OpenRouterError("no key after all")
|
||||
|
||||
monkeypatch.setattr(provider.OpenRouterChatClient, "from_env", staticmethod(_refuse))
|
||||
assert resolve_chat_endpoint(ResolvedConfig()) is None # a caller degrades; nothing raises into a scan
|
||||
|
||||
|
||||
def test_the_config_can_point_the_chat_endpoint_somewhere_else(monkeypatch: pytest.MonkeyPatch, tmp_path: Any) -> None:
|
||||
from openultrasast.config import load_config
|
||||
from openultrasast.learning.endpoint import resolve_chat_endpoint, resolve_models
|
||||
|
||||
Reference in New Issue
Block a user