From 59855b5417df3d254f0bf3c86285987662d0c784 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Sat, 20 Jun 2026 06:01:53 +0000 Subject: [PATCH] test(e2e): assert budget-isolation invariant before success check On the should-still-succeed path of the per-model and tag isolation tests, check is_budget_block before require_successful_call. If the isolation bug fires the unaffected model/tag is blocked, so asserting the specific 'blocked by X' invariant first yields the diagnostic message instead of a generic upstream-failure. Matches the ordering in test_soft_budget_e2e.py. --- tests/e2e/budgets/test_model_max_budget_e2e.py | 2 +- tests/e2e/budgets/test_tag_budget_e2e.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/budgets/test_model_max_budget_e2e.py b/tests/e2e/budgets/test_model_max_budget_e2e.py index c11e50f679c..44e6a333ef0 100644 --- a/tests/e2e/budgets/test_model_max_budget_e2e.py +++ b/tests/e2e/budgets/test_model_max_budget_e2e.py @@ -51,7 +51,7 @@ def test_model_max_budget_isolates_per_model( # The other model shares the key but has its own (large) cap -> still works. other = _call(client, key, FREE_MODEL) - require_successful_call(other) # its own large cap -> must succeed, never a budget block assert not is_budget_block(other), ( f"{FREE_MODEL} was blocked by {CAPPED_MODEL}'s budget; per-model caps not isolated" ) + require_successful_call(other) diff --git a/tests/e2e/budgets/test_tag_budget_e2e.py b/tests/e2e/budgets/test_tag_budget_e2e.py index 492aa89b528..7cec5bc96c1 100644 --- a/tests/e2e/budgets/test_tag_budget_e2e.py +++ b/tests/e2e/budgets/test_tag_budget_e2e.py @@ -53,7 +53,7 @@ def test_tag_budget_blocks_tagged_requests( # A request with an unbudgeted tag on the same key is unaffected. free_tag = f"e2e-free-tag-{unique_marker()}" other = _tagged_call(client, scoped_key, free_tag) - require_successful_call(other) assert not is_budget_block(other), ( f"unbudgeted tag {free_tag!r} was blocked by {budgeted_tag!r}'s budget" ) + require_successful_call(other)