fix(sync): honour readiness and suspension in Customisation Sync

(src/features/ConfigSync/CmdConfigSync.ts)
- Call the readiness predicate before accepting configuration file events.
- Stop the periodic sweep while settings are applied and let the resume lifecycle scan and restart it once.

(src/features/ConfigSync/CmdConfigSync.applySettings.unit.spec.ts)
- Exercise the ControlService settings path while active, suspended, and resumed.
- Verify that suspended settings application performs no scan and leaves the periodic sweep stopped.

(src/features/ConfigSync/CmdConfigSync.readiness.unit.spec.ts)
- Cover configuration file events before and after application readiness.

(updates.md)
- Document the readiness and suspension behaviour.
This commit is contained in:
Kim Jansheden committed 2026-10-03 15:05:17 +02:00
1 parent ea30ef7ebd
commit 893a0e26c3
4 files changed
+322 -14

No files matched your search

+5 -14
View File
@@ -1198,20 +1198,11 @@ export class ConfigSync extends LiveSyncCommands {
}
return true;
}
async _everyRealizeSettingSyncMode(): Promise<boolean> {
_everyRealizeSettingSyncMode(): Promise<boolean> {
// applySettings calls onResuming after this handler when synchronisation is active.
// That handler scans and restarts the sweep; doing so here would scan twice.
this.periodicPluginSweepProcessor?.disable();
if (!this._isMainReady) return true;
if (!this._isMainSuspended()) return true;
if (!this.isThisModuleEnabled()) return true;
if (this.settings.autoSweepPlugins) {
await this.scanAllConfigFiles(false);
}
this.periodicPluginSweepProcessor.enable(
this.settings.autoSweepPluginsPeriodic && !this.settings.watchInternalFileChanges
? PERIODIC_PLUGIN_SWEEP * 1000
: 0
);
return true;
return Promise.resolve(true);
}
recentProcessedInternalFiles = [] as string[];
@@ -1488,7 +1479,7 @@ export class ConfigSync extends LiveSyncCommands {
}
async watchVaultRawEventsAsync(path: FilePath) {
if (!this._isMainReady) return false;
if (!this._isMainReady()) return false;
if (this._isMainSuspended()) return false;
if (!this.isThisModuleEnabled()) return false;
// if (!this.isTargetPath(path)) return false;