This adds a new synchronous “track” and “set usage” API backed by Redis caching (via Lua scripts) and PostgreSQL stored procedures, updates test groups to cover balances/track scenarios, and introduces general and customer-level rate limiting middleware. It overhauls how feature consumption is recorded—shifting from async event routing to atomic, in-transaction balance deductions for better performance, consistency, and observability. Because it’s a very large change with dozens of new SQL functions, complex deduction logic and Redis dependencies (e.g. REDIS_URL, script loading), it risks untested edge cases, race conditions, missing cleanup of old routes, and potential environment-configuration gaps.



