feat: show persisted sync errors

This commit is contained in:
mirivlad 2026-06-29 03:23:45 +08:00
parent f0c7b31c9e
commit a4d4e5ed0e
3 changed files with 26 additions and 0 deletions

View File

@ -193,6 +193,11 @@
{#if resultMsg && !errorMsg}
<div style="padding:0.5rem 0.75rem;margin-bottom:0.75rem;border-radius:6px;font-size:0.85rem;{resultKind === 'warning' ? 'background:rgba(245,158,11,0.1);border:1px solid rgba(245,158,11,0.3);color:#f59e0b;' : 'background:rgba(52,211,153,0.1);border:1px solid rgba(52,211,153,0.3);color:#34d399;'}">{resultMsg}</div>
{/if}
{#if settings && settings.lastError && !errorMsg}
<div style="padding:0.5rem 0.75rem;margin-bottom:0.75rem;background:rgba(255,107,107,0.1);border:1px solid rgba(255,107,107,0.3);border-radius:6px;color:#ff6b6b;font-size:0.85rem;">
Last sync error: {sanitizeError(settings.lastError)}
</div>
{/if}
<div style="background:#16213e;border:1px solid #0f3460;border-radius:8px;padding:1rem 1.25rem;margin-bottom:1rem;">
<h3 style="margin:0 0 0.75rem;color:#e0e0f0;font-size:0.95rem;">Server</h3>

View File

@ -223,6 +223,8 @@ if command -v node &>/dev/null; then
report "browser inbox frontend behavior" $?
node "$ROOT/scripts/smoke-search-plugin.js"
report "search frontend behavior" $?
node "$ROOT/scripts/smoke-sync-plugin.js"
report "sync frontend behavior" $?
else
echo " ⚠️ node not available — skipping frontend smoke"
fi

View File

@ -0,0 +1,19 @@
#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
const root = path.resolve(__dirname, '..');
const sourcePath = path.join(root, 'plugins', 'sync', 'frontend', 'src', 'SyncSettings.svelte');
const source = fs.readFileSync(sourcePath, 'utf8');
if (!source.includes('settings.lastError')) {
throw new Error('SyncSettings must render persisted settings.lastError');
}
if (!source.includes('sanitizeError(settings.lastError)')) {
throw new Error('SyncSettings must sanitize persisted sync errors before rendering');
}
if (!source.includes('Last sync error')) {
throw new Error('SyncSettings must label the persisted sync error');
}
console.log('sync plugin smoke passed');