refactor: clarify startup operation defaults

This commit is contained in:
vorotamoroz
2026-09-04 02:30:40 +00:00
parent 22a835519b
commit f70bdbbbe0
3 changed files with 73 additions and 58 deletions
@@ -93,6 +93,12 @@ describe("useStartupLifecycleFeature default operation wiring", () => {
log, log,
}); });
expect(operationMocks.checkCompromisedChunks).not.toHaveBeenCalled();
expect(operationMocks.checkIncompleteDocuments).not.toHaveBeenCalled();
expect(operationMocks.runConfigDoctor).not.toHaveBeenCalled();
expect(operationMocks.migrateBulkSendSetting).not.toHaveBeenCalled();
expect(waitForCompatibilityReview).not.toHaveBeenCalled();
const layoutAdmission = addLayoutHandler.mock.calls[0]?.[0] as () => Promise<boolean>; const layoutAdmission = addLayoutHandler.mock.calls[0]?.[0] as () => Promise<boolean>;
const firstInitialise = addFirstInitialiseHandler.mock.calls[0]?.[0] as () => Promise<boolean>; const firstInitialise = addFirstInitialiseHandler.mock.calls[0]?.[0] as () => Promise<boolean>;
await expect(layoutAdmission()).resolves.toBe(true); await expect(layoutAdmission()).resolves.toBe(true);
@@ -26,14 +26,10 @@ function createDefaultOperations(
log: ReturnType<typeof createInstanceLogFunction> log: ReturnType<typeof createInstanceLogFunction>
): ConfiguredStartupLifecycleOperations { ): ConfiguredStartupLifecycleOperations {
const { services } = host; const { services } = host;
return { const defaultOperations = {
databaseReady: options.databaseReady ?? (() => services.database.localDatabase.isReady), databaseReady: () => services.database.localDatabase.isReady,
reportDatabaseNotReady: reportDatabaseNotReady: () => log($msg("moduleMigration.logLocalDatabaseNotReady"), LOG_LEVEL_NOTICE),
options.reportDatabaseNotReady ?? hasCompromisedChunks: () =>
(() => log($msg("moduleMigration.logLocalDatabaseNotReady"), LOG_LEVEL_NOTICE)),
hasCompromisedChunks:
options.hasCompromisedChunks ??
(() =>
checkCompromisedChunks({ checkCompromisedChunks({
settings: services.setting.currentSettings(), settings: services.setting.currentSettings(),
localDatabase: services.database.localDatabase, localDatabase: services.database.localDatabase,
@@ -43,10 +39,8 @@ function createDefaultOperations(
rebuilder: host.serviceModules.rebuilder, rebuilder: host.serviceModules.rebuilder,
performRestart: () => services.appLifecycle.performRestart(), performRestart: () => services.appLifecycle.performRestart(),
log, log,
})), }),
hasIncompleteDocuments: hasIncompleteDocuments: (force = false) =>
options.hasIncompleteDocuments ??
((force = false) =>
checkIncompleteDocuments( checkIncompleteDocuments(
{ {
localDatabase: services.database.localDatabase, localDatabase: services.database.localDatabase,
@@ -60,11 +54,8 @@ function createDefaultOperations(
log, log,
}, },
force force
)), ),
waitForCompatibilityReview: options.waitForCompatibilityReview, runDoctor: (skipRebuild = false, activateReason = "updated", forceRescan = false) =>
runDoctor:
options.runDoctor ??
((skipRebuild = false, activateReason = "updated", forceRescan = false) =>
runConfigDoctor( runConfigDoctor(
{ {
confirm: services.UI.confirm, confirm: services.UI.confirm,
@@ -80,15 +71,23 @@ function createDefaultOperations(
skipRebuild, skipRebuild,
activateReason, activateReason,
forceRescan forceRescan
)), ),
migrateBulkSend: migrateBulkSend: () =>
options.migrateBulkSend ??
(() =>
migrateBulkSendSetting({ migrateBulkSendSetting({
settings: services.setting.currentSettings(), settings: services.setting.currentSettings(),
log, log,
saveSettings: () => services.setting.saveSettingData(), saveSettings: () => services.setting.saveSettingData(),
})), }),
} satisfies Omit<ConfiguredStartupLifecycleOperations, "waitForCompatibilityReview">;
return {
databaseReady: options.databaseReady ?? defaultOperations.databaseReady,
reportDatabaseNotReady: options.reportDatabaseNotReady ?? defaultOperations.reportDatabaseNotReady,
hasCompromisedChunks: options.hasCompromisedChunks ?? defaultOperations.hasCompromisedChunks,
hasIncompleteDocuments: options.hasIncompleteDocuments ?? defaultOperations.hasIncompleteDocuments,
waitForCompatibilityReview: options.waitForCompatibilityReview,
runDoctor: options.runDoctor ?? defaultOperations.runDoctor,
migrateBulkSend: options.migrateBulkSend ?? defaultOperations.migrateBulkSend,
}; };
} }
+10
View File
@@ -12,6 +12,16 @@ Earlier releases remain available in the 1.0 release history, the 1.0 preview hi
## Unreleased ## Unreleased
### Synchronisation and storage
#### Improved
- Start-up now keeps unconfigured Vaults on the onboarding path without running configured-only checks or accepting Config Doctor and incomplete-document repair requests. Returning a configured Vault to an unconfigured state also retires those requests for the current plug-in process, so completing setup admits them only after the requested restart.
### Testing
- Start-up migrations, integrity checks, Config Doctor, basic commands, and the Obsidian replication ribbon now have focused regression tests for their service composition. Real Obsidian checks cover unconfigured onboarding, configured start-up scanning, Config Doctor detection and layout, command registration, and the established ribbon icon.
## 1.0.24 ## 1.0.24
3rd September, 2026 3rd September, 2026