feat(migration): add lock heartbeats, predictive dry-run planning, and stricter ledger option validation

This commit is contained in:
2026-04-14 12:31:34 +00:00
parent 19ebdee31a
commit 1b4358aca5
17 changed files with 695 additions and 180 deletions
+18
View File
@@ -65,6 +65,24 @@ tap.test('checkpoint: ctx.checkpoint is undefined for non-resumable steps', asyn
expect(observed).toBeTrue();
});
tap.test('checkpoint: successful resumable step clears stored progress', async () => {
const m1 = new SmartMigration({ targetVersion: '1.1.0', db, ledgerName: 'checkpoint_cleanup' });
m1.step('big-job').from('1.0.0').to('1.1.0').resumable().up(async (ctx) => {
await ctx.checkpoint!.write('processed', 5);
});
await m1.run();
const m2 = new SmartMigration({ targetVersion: '1.2.0', db, ledgerName: 'checkpoint_cleanup' });
let resumedFrom: number | undefined;
m2
.step('big-job').from('1.1.0').to('1.2.0').resumable().up(async (ctx) => {
resumedFrom = await ctx.checkpoint!.read<number>('processed');
});
await m2.run();
expect(resumedFrom).toBeUndefined();
});
tap.test('cleanup: close shared db', async () => {
await cleanup();
});