fix(live): expose full refresh busy and phase progress

Ensure full refresh marks the live projection as building before source refresh awaits, and expose phase-specific counters so language detection progress is determinate.

Covers #40 and #41.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
blomios
2026-10-08 16:20:36 +02:00
parent 09bdaa3ec1
commit ddd7a3f295
7 changed files with 139 additions and 25 deletions

View File

@ -26,12 +26,14 @@ test('presents Laya identity progress using AI batch counters', () => {
assert.equal(view.progressText, 'AI batch 3 of 8 · 38%');
});
test('presents local Laya language batch progress after projection', () => {
test('presents local Laya language batch progress from generic phase counters', () => {
const view = present({
status: 'building',
phase: 'laya_language',
languageProcessed: 5,
languageTotal: 10
phaseProcessed: 5,
phaseTotal: 10,
layaProcessed: 2,
layaTotal: 20
});
assert.equal(view.statusLabel, 'Detecting stream languages…');
assert.equal(view.progressIndeterminate, false);
@ -39,12 +41,24 @@ test('presents local Laya language batch progress after projection', () => {
assert.equal(view.progressText, 'Language batch 5 of 10 · 50%');
});
test('falls back to Laya counters for language batch progress', () => {
const view = present({
status: 'building',
phase: 'laya_language',
layaProcessed: 5,
layaTotal: 10
});
assert.equal(view.progressIndeterminate, false);
assert.equal(view.progressPercent, 50);
assert.equal(view.progressText, 'Language batch 5 of 10 · 50%');
});
test('presents indeterminate progress when totals are unavailable', () => {
const view = present({ status: 'queued', processed: null, total: null });
assert.equal(view.busy, true);
assert.equal(view.progressIndeterminate, true);
assert.equal(view.progressPercent, null);
assert.equal(view.progressText, 'In progress…');
assert.equal(view.progressText, 'In progress — this step may take several minutes.');
assert.equal(view.buttonLabel, 'Analyze channels');
assert.equal(present({ status: 'running', processed: null, total: 100 }).progressIndeterminate, true);
});