mirror of
https://github.com/HeyPuter/puter.git
synced 2026-10-02 18:08:13 +00:00
* fix: charge stat's return_shares against the share-listing budget `return_shares` on /fs/stat and the legacy /stat runs the same work as GET /share/shares, but was only metered under fs:stat's far more generous limit — and the two scopes stacked instead of sharing one counter. Adds consumeRouteRateLimit(req, spec), an imperative charge that resolves the key and per-subscription limit exactly as rateLimitGate does, so a handler can conditionally spend a second scope when a request flag makes the route expensive. Both stat handlers now charge share:list before doing the listing work; SHARE_LIST_LIMIT moves to a shared share/limits.ts so all callers pin the same spec. Closes PUT-1597. * feat: consumeRouteRateLimit takes the array spec form too Review follow-up on #3870: a multi-window spec passed whole would have read an undefined window and silently never pruned. Charge each window in order instead, refusing on the first refusal, matching the gate.