From 982830a3aea0e7c952696e7c69ce93bd2de11483 Mon Sep 17 00:00:00 2001 From: Juan Castro Date: Fri, 14 Aug 2026 14:34:23 -0400 Subject: [PATCH] fix(permissions): keep a failed remote flat-invalidation from crashing the process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The outer.permission.flatInvalidated applier was fire-and-forget with no catch, and it awaits a KV delete — one transient KV error while applying a peer region's revoke became an unhandled rejection, which is process-fatal under default Node. Its sibling appliers were already guarded; this one now logs and moves on, leaving the entry to the next invalidation or its TTL, same as a lost event. Co-Authored-By: Claude Fable 5 --- src/backend/stores/permission/PermissionStore.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/backend/stores/permission/PermissionStore.ts b/src/backend/stores/permission/PermissionStore.ts index 2c99be15e..d8ed38f59 100644 --- a/src/backend/stores/permission/PermissionStore.ts +++ b/src/backend/stores/permission/PermissionStore.ts @@ -119,7 +119,17 @@ export class PermissionStore extends PuterStore { }; if (typeof holderUserId !== 'number') return; if (typeof permission !== 'string' || permission === '') return; - void this.#applyFlatUserPermDelete(holderUserId, permission); + // Guarded: a transient KV error applying a peer's delete must + // not become an unhandled rejection. The entry stays until the + // next invalidation or its TTL — same as a lost event. + this.#applyFlatUserPermDelete(holderUserId, permission).catch( + (err) => { + console.warn( + '[PermissionStore] failed to apply remote flat-perm delete:', + err, + ); + }, + ); }, ); }