Skip to content

Commit 468dc55

Browse files
authored
fix(matrix): silence empty inbound dedupe migration receipt on fresh installs (#122808)
On a pristine profile, onboarding/doctor printed "Auto-migrated legacy state: Recorded Matrix inbound dedupe migration completion (0 SQLite roots, 0 JSON roots scanned)" even though nothing was migrated. Keep the durable empty-scan receipt (it still prevents later historical databases from being opened) but only emit the user-visible change line when at least one SQLite/JSON root was scanned.
1 parent 391b8ae commit 468dc55

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎extensions/matrix/doctor-contract-api.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -765,18 +765,18 @@ describe("matrix doctor contract state migrations", () => {
765765
await expect(migration.detectLegacyState(createMigrationParams(stateDir))).resolves.toBeNull();
766766
});
767767

768-
it("records an empty legacy scan and then skips historical databases", async () => {
768+
it("records an empty legacy scan silently and then skips historical databases", async () => {
769769
const stateDir = tempDirs.make("openclaw-matrix-doctor-");
770770
const migration = migrationById("matrix-inbound-dedupe-to-claimable-dedupe");
771771
const params = createMigrationParams(stateDir);
772772

773773
await expect(migration.detectLegacyState(params)).resolves.toEqual({
774774
preview: ["Matrix inbound dedupe legacy sources need a one-time migration scan"],
775775
});
776+
// Fresh installs scan nothing: the durable receipt is recorded (proven by
777+
// the historical-database skip below) without a user-visible change line.
776778
await expect(migration.migrateLegacyState(params)).resolves.toEqual({
777-
changes: [
778-
"Recorded Matrix inbound dedupe migration completion (0 SQLite roots, 0 JSON roots scanned)",
779-
],
779+
changes: [],
780780
warnings: [],
781781
});
782782
const lateDatabasePath = path.join(

‎extensions/matrix/doctor-contract-api.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,13 @@ export const stateMigrations: PluginDoctorStateMigration[] = [
346346
}
347347
try {
348348
await recordMatrixInboundDedupeMigrationCompletion(params.context, params.env);
349-
changes.push(
350-
`Recorded Matrix inbound dedupe migration completion (${sources.sqliteRoots.length} SQLite roots, ${sources.jsonRoots.length} JSON roots scanned)`,
351-
);
349+
// Fresh installs scan zero roots; keep the durable receipt silent
350+
// there so onboarding doesn't report a migration that touched nothing.
351+
if (sources.sqliteRoots.length + sources.jsonRoots.length > 0) {
352+
changes.push(
353+
`Recorded Matrix inbound dedupe migration completion (${sources.sqliteRoots.length} SQLite roots, ${sources.jsonRoots.length} JSON roots scanned)`,
354+
);
355+
}
352356
} catch (err) {
353357
warnings.push(
354358
`Failed recording Matrix inbound dedupe migration completion: ${String(err)}`,

0 commit comments

Comments
 (0)