fix: prevent background Laya rebuilds during playback

Ensure automatic live projection rebuilds use the algorithmic path so Laya identity batches are not launched during live list playback or background sync.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
blomios
2026-10-07 22:44:05 +02:00
parent 281a47124e
commit ba5b1b37a1
4 changed files with 188 additions and 6 deletions

View File

@ -121,6 +121,28 @@ test('manual rebuild scheduling coalesces concurrent requests', async () => {
assert.equal(runs, 1);
});
test('startRebuild passes business options to the runner without infrastructure options', async () => {
let runnerOptions;
const result = startRebuild({}, {
mode: 'algo',
layaClient: { identityHintBatch: async () => [] },
mark: () => ({ status: 'building' }),
runner: async (_database, options) => {
runnerOptions = options;
return { status: 'success' };
},
schedule: callback => callback()
});
await result.promise;
assert.equal(runnerOptions.mode, 'algo');
assert.equal(typeof runnerOptions.layaClient.identityHintBatch, 'function');
assert.equal(runnerOptions.stateAlreadyBuilding, true);
assert.equal('mark' in runnerOptions, false);
assert.equal('runner' in runnerOptions, false);
assert.equal('schedule' in runnerOptions, false);
});
test('Laya rebuild progress advances after a successful identity batch while analysis is still running', async () => {
const db = createProjectionDb();
for (let index = 0; index < 12; index++) {