nic-6443 opened a new pull request, #13212:
URL: https://github.com/apache/apisix/pull/13212

   ### Description
   
   Upgrade `apisix-runtime` from 1.3.3 to 1.3.4 which includes 
`lua-resty-limit-traffic` v1.2.0 (from `api7/lua-resty-limit-traffic`). The 
library changed its counter semantics from counting down (returning 
`remaining`) to counting up (returning `consumed`).
   
   ### Changes
   
   **`.requirements`**
   - `APISIX_RUNTIME=1.3.3` → `APISIX_RUNTIME=1.3.4`
   
   **`limit-count-local.lua`** — consumed→remaining conversion:
   - The v1.2.0 library returns `consumed` count instead of `remaining`. The 
wrapper converts it back to `remaining` via `self.limit - consumed`, preserving 
the existing API contract.
   - Error strings (e.g. `"rejected"`) pass through unchanged via a `type()` 
check.
   
   **`limit-count/init.lua`** — improved dry_run peek:
   - For local policy with `dry_run=true`: uses `cost=0` with `commit=false` 
for a side-effect-free peek. `dict:get` reads the counter without creating or 
incrementing the key.
   - Adds manual rejection check: if `remaining - cost < 0` after peek, 
converts to standard "rejected" flow.
   - Redis/redis-cluster path: unchanged (no dry_run support).
   
   **`ai-rate-limiting-expression.t`** — fix remaining header values:
   - The dry_run peek in access phase no longer deducts `cost=1` from 
remaining, fixing off-by-1 in `X-AI-RateLimit-Remaining` header (e.g., 499→500, 
319→320).
   
   **`limit-count5.t`** — new TEST 8:
   - Validates that `cost=0` peek does not consume quota: multiple peeks return 
stable remaining, interleaved with real commits that correctly decrement.
   


-- 
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]

Reply via email to