fix(keysync): silence expected RLS rejections during best-effort backfill
Release desktop app / build (, windows-latest) (push) Has been cancelled
Release desktop app / build (--target universal-apple-darwin --bundles app,updater, macos-14) (push) Has been cancelled

This commit is contained in:
2026-04-19 22:03:49 +02:00
parent 961ac2dde5
commit b0f9f1dada
2 changed files with 20 additions and 9 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "ChatApp", "productName": "ChatApp",
"version": "0.4.2", "version": "0.4.3",
"identifier": "com.meinname.chatapp", "identifier": "com.meinname.chatapp",
"build": { "build": {
"beforeDevCommand": "pnpm vite:dev", "beforeDevCommand": "pnpm vite:dev",
+19 -8
View File
@@ -164,14 +164,25 @@ async function syncOneConversationGaps(ctx: SyncCtx, convId: string): Promise<vo
try { try {
await shareConvKeyToDevice(supabase, convId, dev.id, pgHexToBytes(dev.public_key), ownCtx); await shareConvKeyToDevice(supabase, convId, dev.id, pgHexToBytes(dev.public_key), ownCtx);
} catch (err: unknown) { } catch (err: unknown) {
// Most common: this device hasn't been wrapped for us yet either, so // Backfill is best-effort. Common silent failures:
// tryGetConvKey couldn't unwrap. Another peer with the key will fill // - This device hasn't been wrapped for us yet either, so
// the gap when they hit syncAllExistingGaps. // tryGetConvKey couldn't unwrap (another peer will fill the gap).
console.warn('keySync: shareConvKeyToDevice gap-fill failed', { // - RLS rejects because the recipient's owner is a pending (not-yet
convId, // accepted) DM member, or has been removed from the conv.
recipient: dev.id, // Any of these are recoverable — log only at debug level.
err, const msg = err instanceof Error ? err.message : String(err);
}); const isExpected =
msg.includes('does not have it yet') ||
msg.includes('row-level security') ||
msg.includes('403') ||
msg.includes('Forbidden');
if (!isExpected) {
console.warn('keySync: shareConvKeyToDevice gap-fill failed', {
convId,
recipient: dev.id,
err,
});
}
} }
} }
} }