This change refactors the usage‐tracking logic to run synchronously within a transaction (using PostgreSQL advisory locks) instead of queuing, adds full ACID‐style balance and usage_limit validation (including rollover, free/capped, and pay-per-use scenarios), and expands the test suite with concurrent‐request cases to enforce correctness. It impacts the project by improving consistency and error reporting for feature usage updates but introduces significant complexity and potential performance overhead from locking and heavy in‐code validation. Key concerns include the crude 32-bit hash for advisory locks (risking collisions), the increased maintenance burden of complex validation logic, and the large surface area for subtle concurrency bugs despite added tests.



