fix(rate-limit): fail the shared write ceiling open and skip reads over POST

The shared write bucket threw on any SQL error, so a lock on rate_limits
answered every authenticated write with 500. It is a loop cutter, not an
access check: when the bucket cannot be read the write now goes ahead with
a warn signal. The login and other auth-surface limits call the limiter
directly and still fail closed. requireAuth now passes readOverPost to the
meter, the draft-only document assist declares it, and the three chat
routes, which meter their turns with buckets of their own, declare that
instead of being counted twice.
This commit is contained in:
Marc-André Bombeck committed 2026-10-20 16:09:28 +02:00
1 parent 408ae35b7c
commit 5185edca74
12 files changed
+148 -19

No files matched your search

+1 -1
View File
@@ -546,7 +546,7 @@ export function isScopedCredential(auth: AuthContext): boolean {
*/
export async function requireAuth(
requiredPermission?: string,
options?: Pick<WriteMeterOptions, "writeBucket">,
options?: WriteMeterOptions,
): Promise<AuthContext> {
const auth = await authenticateCaller(requiredPermission);
const carrier = await readActingCarrier(auth);