qqeasonchen opened a new pull request, #5373:
URL: https://github.com/apache/eventmesh/pull/5373

   ## What this PR does
   
   Closes #5362 — Phase 2 of the production-HA plan (#5354), acceptance **B6**: 
**A2A operations stop being one flat rate.**
   
   ### 1. The gap this fixes
   
   `resourceFor(A2A) → THROUGHPUT` for *everything*. A tenant submitting 
long-running tasks was charged the same as a health probe: no cap on concurrent 
live tasks (BACKLOG was never charged on the A2A path), and no release 
semantics existed anyway — #5358 added `QuotaHandle` but no A2A call site used 
`acquire()`.
   
   ### 2. Classification (`RequestContext.A2aOperation`, new enum)
   
   | Sub-operation | Resource | Semantics |
   |---|---|---|
   | `SUBMIT` | **BACKLOG** | A task occupies agent capacity until it 
completes/cancels; the handle from `gate.acquire()` is the release |
   | `GET` / `CANCEL` / `STREAM` | **THROUGHPUT** | Per-request work; window 
counters self-expire (handle close is a no-op) |
   | `null` | THROUGHPUT | Backward-compatible fallback |
   
   ### 3. Wiring
   
   - `SecurityGate.resourceFor(ctx)` consults the A2A sub-operation on the A2A 
arm (signature `op → ctx`; PUBLISH / SUBSCRIBE / ACK unchanged).
   - `A2AGatewayHttpHandler.classify(method, uri)` derives the sub-operation 
from the **route shape** before the gate check — `POST /a2a/tasks` = SUBMIT, 
`DELETE /a2a/tasks/{id}` = CANCEL, `…/stream` = STREAM, GET/other = GET.
   
   ### 4. Tests (new `A2aOperationClassificationTest`, 5 cases)
   
   - SUBMIT charges BACKLOG and the handle releases it exactly once
   - GET / CANCEL / STREAM charge THROUGHPUT with zero release events
   - null sub-operation falls back to THROUGHPUT
   - non-A2A resources unchanged (SUBSCRIBE → SUBSCRIPTIONS)
   - exhausted SUBMIT throws `QuotaExceededException` without consuming
   
   Local verification (Temurin 21.0.11): runtime tests + checkstyle 
(maxWarnings=0) + architecture-guard tests all green.
   
   ### Relations
   
   - Closes #5362 (Phase 2, P1)
   - Parent: #5354 · Plan: `docs/architecture-review/production-ha-plan.md` (PR 
#5366)
   - Builds on #5358's `QuotaHandle` / `gate.acquire()` (merged `d5200c83e`)
   - Phase 2 companion #5363 (Testcontainers E2E) is deferred per plan-owner 
decision (local Docker unavailable under DLP)
   
   Co-authored-by: qqeasonchen <[email protected]>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to