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",
"productName": "ChatApp",
"version": "0.4.2",
"version": "0.4.3",
"identifier": "com.meinname.chatapp",
"build": {
"beforeDevCommand": "pnpm vite:dev",
+14 -3
View File
@@ -164,9 +164,19 @@ async function syncOneConversationGaps(ctx: SyncCtx, convId: string): Promise<vo
try {
await shareConvKeyToDevice(supabase, convId, dev.id, pgHexToBytes(dev.public_key), ownCtx);
} catch (err: unknown) {
// Most common: this device hasn't been wrapped for us yet either, so
// tryGetConvKey couldn't unwrap. Another peer with the key will fill
// the gap when they hit syncAllExistingGaps.
// Backfill is best-effort. Common silent failures:
// - This device hasn't been wrapped for us yet either, so
// tryGetConvKey couldn't unwrap (another peer will fill the gap).
// - RLS rejects because the recipient's owner is a pending (not-yet
// accepted) DM member, or has been removed from the conv.
// Any of these are recoverable — log only at debug level.
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,
@@ -175,6 +185,7 @@ async function syncOneConversationGaps(ctx: SyncCtx, convId: string): Promise<vo
}
}
}
}
async function wrapForOneDevice(
ctx: SyncCtx,