Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

docs(identity): say what lid_mappings.sessionId decides

Yudhi Armyndharisf7f87f267fb0
diff --git a/src/engine/adapters/baileys-session-store.ts b/src/engine/adapters/baileys-session-store.ts
index 8a6436399..271a95b8e 100644
--- a/src/engine/adapters/baileys-session-store.ts
+++ b/src/engine/adapters/baileys-session-store.ts
@@ -214,7 +214,7 @@ export class BaileysSessionStore {
/**
* @param lidStore optional persisted, cross-session lid->phone table that backs resolution beyond
* this session's in-memory map (survives restarts, shared across sessions).
- * @param sessionId provenance recorded on rows this session writes to the persisted tables.
+ * @param sessionId recorded on rows this session writes to the persisted tables (a lid row's owner).
* @param chatStateStore optional persisted per-session mute/archive/pin, so those chat fields survive a
* reconnect Baileys cannot resync (it only re-emits mutations newer than the
* persisted app-state version, never an already-applied one).
diff --git a/src/modules/infra/export-tables.ts b/src/modules/infra/export-tables.ts
index ef387b1b6..0bb1452b8 100644
--- a/src/modules/infra/export-tables.ts
+++ b/src/modules/infra/export-tables.ts
@@ -284,7 +284,8 @@ export const EXPORT_TABLES: AnyExportTable[] = [
sessionFk: true,
}),
- // The persisted lid->phone resolution cache. Not a FK to sessions (provenance only), so the
+ // The persisted lid->phone resolution cache. sessionId names the session whose negative may clear the
+ // phone; it is not a FK to sessions, so the
// import's `DELETE FROM sessions` never clears it — it must be exported + re-inserted explicitly
// or a backup→restore into a fresh DB loses the whole cache (it self-heals, but lossily).
defineExportTable({ key: 'lidMappings', table: 'lid_mappings', optional: true }),
diff --git a/src/modules/infra/migration-tables.types.ts b/src/modules/infra/migration-tables.types.ts
index 61656c532..28ae97518 100644
--- a/src/modules/infra/migration-tables.types.ts
+++ b/src/modules/infra/migration-tables.types.ts
@@ -107,7 +107,8 @@ export interface BaileysStoredMessageRow {
createdAt: string;
}
-// The persisted lid->phone resolution cache. Not a FK to sessions (provenance only), so the import's
+// The persisted lid->phone resolution cache. sessionId names the session whose negative may clear the
+// phone; it is not a FK to sessions, so the import's
// `DELETE FROM sessions` never clears it — it must be exported + re-inserted explicitly or a
// backup→restore into a fresh DB loses the whole cache (it self-heals via re-lookup, but lossily).
export interface LidMappingRow {