Repository navigation
test(gateway): a module's ordinary pool runs 8, holds 24 and refuses the 33rd at once through the real ASGI path (ANYM-393) - #1066
Merged
Conversation
…the 33rd at once through the real ASGI path (ANYM-393) One new test file. Requests go through the gateway's ASGI app (lifespan, REST route, dispatch, Clients) into an in-memory calendar backend that holds each operation on an event: - 8 operations run; the next 24 hold a pool place without reaching the backend (they queue at the capabilities read, which uses the same ordinary pool); - with 32 pending, the 33rd is answered 503 backend_busy while the 24 are still pending, so it was refused at once, not after the 0.25 s queue wait, and it never reached the backend; - after the release all 32 answer 200, each reached the backend exactly once, the pool is empty and accepts more. Bounds are the spec's, written out; event-driven with bounded supervision, no sleeps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: egerev <egor@gosync.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (DK-85, group B audit): ANYM-393 criterion 1 says each module's ordinary pool runs 8 requests at once with up to 24 waiting, and refuses a new request at once with
backend_busy(503) when 32 are pending. The audit was right that this exact shape was not asserted.The existing
test_backend_isolation.py::test_saturated_module_and_file_pool_do_not_block_other_metadata:Clients.calldirectly;It does not show 8 running vs 24 waiting, that waiters stay out of the backend, that the refusal is immediate rather than the 0.25 s queue timeout, or what happens after release. Cross-module isolation and the 0.25 s timeout and cancellation are covered there and in
test_queue_timeout_and_cancellation_release_capacity, and are not repeated.What the code does (verified, no defect):
Budget(8, 24)(http_clients.py:83) refuses whenpending >= 32before any await. Otherwise it counts the request as pending and waits up to 0.25 s for one of 8 semaphore slots./v1/capabilitiesthrough the same ordinary pool, then runs the operation.Change: one new test file only,
services/gateway/tests/test_backend_pool_bounds.py(1 test). No production, CI or existing-test change.Clients) into an in-memory calendar backend that holds each operation on an event.pending == 32) but reach neither the operation nor the capabilities read.503 {"error": "backend_busy"}and never reaches the backend.Proof:
Budget/Clientsare all killed: active 7, active 9, waiting 23, waiting 25, capacity of active only, refusal at>(33 pending), slot never released, pending never returned, ordinary and file pools swapped.Not claimed: live or production performance (ANYM-212). The stale 1024-credential text of criterion 8 stays with root.
Signal grep: no path hit. The text hit is only the word "permissions" in the synthetic capabilities reply.
Spec: ANYM-393
Change path: AUTO (test-only)
Review record: none (owner 11-11: no reviews)
🤖 Generated with Claude Code