Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: bind default-exclusion switch to the user override, not the effective state (#3788)

[._.]/ Adam Eivy9d660c4d1c1b
diff --git a/client/src/components/settings/BackupTab.jsx b/client/src/components/settings/BackupTab.jsx
index f3bb3f6350..ae596ff9c9 100644
--- a/client/src/components/settings/BackupTab.jsx
+++ b/client/src/components/settings/BackupTab.jsx
@@ -40,6 +40,7 @@ export function BackupTab() {
const destPathId = useId();
const cronId = useId();
const additionalExcludeId = useId();
+ const defaultExcludesPanelId = useId();
const [loading, setLoading] = useState(true);
const [saving, setSaving] = useState(false);
const [destPath, setDestPath] = useState('');
@@ -193,12 +194,19 @@ export function BackupTab() {
// broader pattern (`loras/`, `loras/**`, `/cos/`). The broader check is
// necessary because rsync still applies the custom pattern even when the
// default toggle says "included".
+ // `defaultActive` (is this default still switched on?) is what the row's
+ // ToggleSwitch binds to, NOT the effective `isExcluded` — a shadowing custom
+ // exclude keeps the path out of the backup while the user's override is on,
+ // and binding the switch to the effective state made such a row look
+ // untoggled and silently dropped the override on the next click. The
+ // "(still excluded via …)" note carries the effective state instead.
const defaultExcludeRows = defaultExcludes.map((d) => {
const shadowingCustom = excludePaths.find(p => shadowsDefault(p, d.path));
const defaultActive = !(d.overridable && disabledDefaultExcludes.includes(d.path));
return {
...d,
shadowingCustom,
+ defaultActive,
isExcluded: defaultActive || !!shadowingCustom,
shadowedByCustom: !defaultActive && !!shadowingCustom,
};
@@ -314,6 +322,7 @@ export function BackupTab() {
type="button"
onClick={() => setShowDefaultExcludes(v => !v)}
aria-expanded={showDefaultExcludes}
+ aria-controls={defaultExcludesPanelId}
className="flex items-center gap-2 w-full text-left text-sm text-gray-400 hover:text-white transition-colors"
>
{showDefaultExcludes ? <ChevronDown size={14} className="shrink-0" /> : <ChevronRight size={14} className="shrink-0" />}
@@ -322,17 +331,17 @@ export function BackupTab() {
{includedCount > 0 && <span className="text-xs text-port-success/80">({includedCount} re-included)</span>}
</button>
{showDefaultExcludes && (
- <>
+ <div id={defaultExcludesPanelId} className="space-y-2">
<p className="text-xs text-gray-500">Built-in paths skipped by default to keep snapshots small. Overridable entries (large re-downloadable assets) can be re-enabled below; fixed entries hold ephemeral data and stay off.</p>
<ul className="space-y-1.5 mt-1">
{defaultExcludeRows.map((d, i) => (
<li key={i} className="flex items-start gap-2 text-xs">
{d.overridable ? (
<ToggleSwitch
- enabled={!d.isExcluded}
+ enabled={!d.defaultActive}
onChange={() => toggleDefaultExclude(d.path)}
size="sm"
- ariaLabel={d.isExcluded ? `Include ${d.path} in backups` : `Exclude ${d.path} from backups`}
+ ariaLabel={`Include ${d.path} in backups`}
className="mt-0.5"
/>
) : (
@@ -349,7 +358,7 @@ export function BackupTab() {
</li>
))}
</ul>
- </>
+ </div>
)}
</div>
)}
diff --git a/client/src/components/settings/BackupTab.test.jsx b/client/src/components/settings/BackupTab.test.jsx
index ded30dec04..63a1affbe3 100644
--- a/client/src/components/settings/BackupTab.test.jsx
+++ b/client/src/components/settings/BackupTab.test.jsx
@@ -329,6 +329,23 @@ describe('BackupTab', () => {
expect(disclosure.textContent).toMatch(/1 path skipped/);
expect(disclosure.textContent).toMatch(/1 re-included/);
});
+
+ // The switch reports the user's own override, not the effective rsync
+ // outcome: a custom exclude that shadows a re-included default still keeps
+ // the path out of the backup, but the toggle must stay ON so clicking it
+ // doesn't silently drop the override while appearing to do nothing.
+ it('keeps a re-included default toggled on even when a custom exclude shadows it', async () => {
+ getSettings.mockResolvedValue({ backup: { destPath: '/backups', enabled: false, cronExpression: '0 2 * * *', excludePaths: ['models/'], disabledDefaultExcludes: ['/models'] } });
+ getBackupStatus.mockResolvedValue({ status: 'never', defaultExcludes: EXCLUDES, pgBackup: null });
+ await renderTab();
+
+ fireEvent.click(screen.getByRole('button', { name: /Default exclusions/i }));
+
+ const toggle = screen.getByRole('switch', { name: /Include \/models in backups/i });
+ expect(toggle.getAttribute('aria-checked')).toBe('true');
+ // The effective state is surfaced in prose instead.
+ expect(screen.getByText(/still excluded via Additional Exclude Paths/i)).toBeTruthy();
+ });
});
describe('Run Now — backup-already-running skip path', () => {