fix: bootstrap user preferences without invalidating DWH cache

This commit is contained in:
User
2026-07-16 20:32:20 +02:00
parent ccb3cf4aa9
commit 5cacf70a0d
6 changed files with 242 additions and 3 deletions
+7 -1
View File
@@ -64,7 +64,13 @@ export function buildApp(config: AppConfig, deps?: BuildAppDeps): FastifyInstanc
// The real runner persists preferences through the harness repository. The file fallback
// only keeps older isolated route tests and externally injected runners compatible.
if (typeof runner.preferencesGet === "function") {
return effectiveSettings(config, await runner.preferencesGet());
const stored = await runner.preferencesGet() as Settings;
if (Object.keys(stored).length === 0) {
const seeded = effectiveSettings(config, loadSettings(config));
await runner.preferencesSet(seeded);
return seeded;
}
return effectiveSettings(config, stored);
}
return effectiveSettings(config, loadSettings(config));
};