Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update sync logging (#2159)

Leendert de Borst896a1b1df461
diff --git a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
index 7f9ecd130..3d25c6a93 100644
--- a/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
+++ b/apps/browser-extension/src/entrypoints/background/VaultMessageHandler.ts
@@ -29,7 +29,7 @@ import { handleClearTwoFactorState } from '@/entrypoints/background/TwoFactorSta
import { syncResult, toFullVaultSyncResult, toSyncErrorDetail } from '@/entrypoints/background/VaultSyncResultMapper';
import { AUTH_STORAGE_KEYS, dirtyScopeStorageKey, SESSION_STORAGE_KEYS, StorageKeys, vaultDataStorageKeys, VAULT_LOCK_STORAGE_KEYS } from '@/utils/constants/storageKeys';
-import { devError, devLog, devWarn } from '@/utils/devLogger/DevLogger';
+import { devLog, devWarn } from '@/utils/devLogger/DevLogger';
import { LocalPreferencesService } from '@/utils/LocalPreferencesService';
import { sendMessage, type TotpSecret } from '@/utils/messaging/ExtensionMessaging';
import { RecentlySelectedItemService } from '@/utils/RecentlySelectedItemService';
@@ -251,7 +251,6 @@ export async function handleGetVault(
}
if (!encryptionKey) {
- console.info('Encryption key not available (vault locked)');
// E-202: No encryption key available (vault is locked)
return { success: false, error: formatErrorWithCode(await t('common.errors.vaultIsLocked'), AppErrorCode.VAULT_LOCKED) };
}
@@ -802,7 +801,7 @@ export async function handleGetVaultMigrationStatus(): Promise<VaultMigrationKin
const result = await runVaultMigrationStatus(syncEngineHost);
return result.kind as VaultMigrationKind;
} catch (error) {
- devWarn('[ManifestMigration] Could not classify the pending migration, assuming it crosses the storage format:', error);
+ console.warn('[ManifestMigration] Could not classify the pending migration, assuming it crosses the storage format:', error);
return VaultMigrationKind.StorageFormatUpgrade;
}
}
@@ -826,10 +825,12 @@ export async function handleMigrateVaultManifest(): Promise<VaultManifestMigrati
const result = await runVaultManifestMigration(syncEngineHost);
if (result.success) {
devLog(result.pushed ? '[ManifestMigration] Migration pushed to the server.' : '[ManifestMigration] Migration stored locally; the vault stays dirty for the next sync.');
+ } else {
+ console.error('[ManifestMigration] Manifest migration failed:', result);
}
return { success: result.success, pushed: result.pushed, ...toSyncErrorDetail(result) };
} catch (error) {
- devError('[ManifestMigration] Manifest migration failed:', error);
+ console.error('[ManifestMigration] Manifest migration threw:', error);
return { success: false, pushed: false, error: error instanceof Error ? error.message : undefined };
}
}
diff --git a/apps/browser-extension/src/entrypoints/background/VaultSyncResultMapper.ts b/apps/browser-extension/src/entrypoints/background/VaultSyncResultMapper.ts
index 0668ae264..21e9205d8 100644
--- a/apps/browser-extension/src/entrypoints/background/VaultSyncResultMapper.ts
+++ b/apps/browser-extension/src/entrypoints/background/VaultSyncResultMapper.ts
@@ -52,7 +52,7 @@ export function toSyncErrorDetail(result: Pick<VaultSyncEngineResult, 'error' |
return { errorKey: logoutErrorKey(result.errorKey) };
}
- return { errorCode: result.errorCode && isErrorCode(result.errorCode) ? result.errorCode : AppErrorCode.UNKNOWN_ERROR };
+ return { errorCode: result.errorCode && isErrorCode(result.errorCode) ? result.errorCode : AppErrorCode.UNKNOWN_ERROR, error: result.error };
}
/**
diff --git a/apps/browser-extension/src/entrypoints/popup/context/DbContext.tsx b/apps/browser-extension/src/entrypoints/popup/context/DbContext.tsx
index 18910e717..97a3bbeb5 100644
--- a/apps/browser-extension/src/entrypoints/popup/context/DbContext.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/context/DbContext.tsx
@@ -287,7 +287,6 @@ export const DbProvider: React.FC<{ children: React.ReactNode }> = ({ children }
const message = error instanceof Error ? error.message : String(error);
if (message.includes(AppErrorCode.VAULT_LOCKED)) {
// Vault is locked which is expected when the popup is opened after auto-lock timeout or browser restart.
- console.info('Vault is locked; popup will prompt for unlock');
} else {
console.error('Error retrieving vault from background:', error);
}
diff --git a/apps/browser-extension/src/entrypoints/popup/context/NavigationContext.tsx b/apps/browser-extension/src/entrypoints/popup/context/NavigationContext.tsx
index 03013375f..edf704595 100644
--- a/apps/browser-extension/src/entrypoints/popup/context/NavigationContext.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/context/NavigationContext.tsx
@@ -103,7 +103,6 @@ export const NavigationProvider: React.FC<{ children: React.ReactNode }> = ({ ch
*/
useEffect(() => {
if (isFullyInitialized && isLoggedIn && dbAvailable && (location.pathname === '/login' || location.pathname === '/unlock')) {
- console.info('[NavigationContext] cross-window session active — leaving auth page', { from: location.pathname });
navigate('/reinitialize', { replace: true });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
diff --git a/apps/browser-extension/src/entrypoints/popup/pages/auth/Upgrade.tsx b/apps/browser-extension/src/entrypoints/popup/pages/auth/Upgrade.tsx
index 15f7605d0..7116542ce 100644
--- a/apps/browser-extension/src/entrypoints/popup/pages/auth/Upgrade.tsx
+++ b/apps/browser-extension/src/entrypoints/popup/pages/auth/Upgrade.tsx
@@ -87,6 +87,7 @@ const Upgrade: React.FC = () => {
const [stage, setStage] = useState<Stage>('classifying');
const [kind, setKind] = useState<UpgradeKind | null>(null);
const [error, setError] = useState<string | null>(null);
+ const [errorDetail, setErrorDetail] = useState<string | null>(null);
const [currentVersion, setCurrentVersion] = useState<VaultVersion | null>(null);
const [latestVersion, setLatestVersion] = useState<VaultVersion | null>(null);
const [showSelfHostedWarning, setShowSelfHostedWarning] = useState(false);
@@ -156,6 +157,7 @@ const Upgrade: React.FC = () => {
*/
const runManifestMigration = useCallback(async (migrationKind: UpgradeKind): Promise<void> => {
setError(null);
+ setErrorDetail(null);
setKind(migrationKind);
setStage('upgrading');
@@ -163,7 +165,10 @@ const Upgrade: React.FC = () => {
if (!result.success) {
// Back to the consent screen, where the same button retries and the error says why it has to.
- setError(syncErrorMessage(result, t) ?? t('common.errors.unknownError'));
+ console.error('[Upgrade] Vault manifest migration failed:', result);
+ const message = syncErrorMessage(result, t) ?? t('common.errors.unknownError');
+ setError(message);
+ setErrorDetail(result.error && result.error !== message ? result.error : null);
setStage('consent');
setIsInitialLoading(false);
return;
@@ -264,6 +269,7 @@ const Upgrade: React.FC = () => {
}
setError(null);
+ setErrorDetail(null);
setStage('upgrading');
try {
@@ -437,6 +443,9 @@ const Upgrade: React.FC = () => {
{error && (
<div className="mb-4 text-red-500 dark:text-red-400 break-words">
{error}
+ {errorDetail && (
+ <div className="mt-1 text-xs text-gray-500 dark:text-gray-400 break-all">{errorDetail}</div>
+ )}
</div>
)}
diff --git a/apps/browser-extension/src/utils/types/messaging/SyncErrorDetail.ts b/apps/browser-extension/src/utils/types/messaging/SyncErrorDetail.ts
index 34e88dc7f..84c449b67 100644
--- a/apps/browser-extension/src/utils/types/messaging/SyncErrorDetail.ts
+++ b/apps/browser-extension/src/utils/types/messaging/SyncErrorDetail.ts
@@ -6,6 +6,6 @@ export type SyncErrorDetail = {
errorKey?: string;
/** Client error code (`E-xxx`) whose translation is shown, tagged with the code. */
errorCode?: string;
- /** Message shown as-is when neither a key nor a code applies. */
+ /** The failure detail: shown as-is when neither a key nor a code applies, otherwise kept for logs and diagnostics. */
error?: string;
};
diff --git a/core/rust/src/vault_sync/tests/mod.rs b/core/rust/src/vault_sync/tests/mod.rs
index fd942f72e..96f3ff071 100644
--- a/core/rust/src/vault_sync/tests/mod.rs
+++ b/core/rust/src/vault_sync/tests/mod.rs
@@ -667,3 +667,4 @@ fn dirty_legacy_account_probes_for_a_vault_key_once_per_run() {
assert_eq!(result["success"], true, "{}", result);
assert_eq!(host.requests_to("v2/VaultKey/Password").len(), 1);
}
+