From 1a365b976b64b48553eae262a7d414c93a69d977 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Sep 2026 11:43:47 +0000 Subject: [PATCH] fix(test): stop asserting openai free-pool admission after #1587 Merged #1587 ("separate free-pool admission from global discovery") intentionally excluded OPENAI_API_KEY from FREE_POOL_CREDENTIAL_NAMES, but left two of its own tests unmigrated: test_build_catalog_applies_account_cap and test_build_catalog_respects_limit both built discovery reports with openai rows and asserted they were admitted to the free-pool catalog. Every full-suite/coverage-evidence run on protected main -- and every PR rebasing onto it -- inherited these two failures regardless of its own diff. Reproduced genuine RED against unmodified main (960b0845): both tests fail, one with PolicyError ("no free model route is available"), the other with a KeyError on the now-absent "openai" account count. Swapped the openai rows in both tests for bytez, which is also is_free-eligible but, unlike openai, remains in FREE_POOL_CREDENTIAL_NAMES. This preserves each test's original intent -- three distinct provider accounts each capped at 2, and a single provider's rows truncated to the configured limit -- without depending on the now-removed OpenAI free-pool admission. Verified: full suite 2273 passed, 1 skipped, 21 subtests; 100% coverage and docstrings maintained. No production code changed. --- CHANGELOG.md | 11 +++++++++++ tests/test_contextual_orchestrator_review_policy.py | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e8633515b..b842e16927 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ this file. The format follows Keep a Changelog, and versioned releases follow Semantic Versioning where the repository publishes a release. ## [Unreleased] +- Fix two `tests/test_contextual_orchestrator_review_policy.py` tests left broken by merged + `#1587` ("separate free-pool admission from global discovery"), which intentionally excluded + `OPENAI_API_KEY` from `FREE_POOL_CREDENTIAL_NAMES` but did not update + `test_build_catalog_applies_account_cap` and `test_build_catalog_respects_limit`, both of which + still built discovery reports using `openai` rows and asserted they were admitted to the free + pool. Every full-suite/coverage-evidence run on protected `main` (and every PR rebasing onto it) + inherited these two failures regardless of its own diff. Swapped the `openai` rows in both tests + for `bytez` (also `is_free`-eligible but, unlike `openai`, still in `FREE_POOL_CREDENTIAL_NAMES`), + preserving each test's original intent — three distinct provider accounts each capped at 2, and a + single provider's rows truncated to the configured limit — without depending on the now-removed + OpenAI free-pool admission. No production code changed. - **Fix a live crash: `noema-review` failed with an unhandled `HTTPError` instead of failing closed.** Live incident on `ContextualWisdomLab/naruon#1486`: `scripts/ci/noema_review_gate.py::call_llm`'s `opener.open(request)` call sat diff --git a/tests/test_contextual_orchestrator_review_policy.py b/tests/test_contextual_orchestrator_review_policy.py index b10fc4a0b9..089f73a574 100644 --- a/tests/test_contextual_orchestrator_review_policy.py +++ b/tests/test_contextual_orchestrator_review_policy.py @@ -354,7 +354,7 @@ def test_build_catalog_applies_account_cap() -> None: for i in range(6) ] + [ - {"provider": "openai", "model": f"o{i}", "agent_id": f"oa_{i}", "is_free": True, **FREE_PRICE} + {"provider": "bytez", "model": f"b{i}", "agent_id": f"bz_{i}", "is_free": True, **FREE_PRICE} for i in range(3) ] } @@ -367,14 +367,14 @@ def test_build_catalog_applies_account_cap() -> None: account_counts[account] = account_counts.get(account, 0) + 1 assert account_counts["nvidia_nim"] == 2 assert account_counts["nvidia_nim_sub"] == 2 - assert account_counts["openai"] == 2 + assert account_counts["bytez"] == 2 def test_build_catalog_respects_limit() -> None: """The catalog never exceeds the configured agent limit.""" report = { "models": [ - {"provider": "openai", "model": f"m{i}", "agent_id": f"oa_{i}", "is_free": True, **FREE_PRICE} + {"provider": "bytez", "model": f"m{i}", "agent_id": f"bz_{i}", "is_free": True, **FREE_PRICE} for i in range(20) ] }