fix(live): preserve channels after empty projection rebuild (#18)
Treat successful but empty live projections with existing live input as stale, reject them on the frontend, and keep the previous visible channel state during rebuild failures. Add DOM coverage for the Settings analysis flow and backend serialization coverage for empty projection state. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -3,6 +3,7 @@ const assert = require('node:assert/strict');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { isAdmin } = require('../server/authz');
|
||||
const { serializeState } = require('../server/routes/live');
|
||||
|
||||
const routeSource = fs.readFileSync(path.join(__dirname, '..', 'server', 'routes', 'live.js'), 'utf8');
|
||||
|
||||
@ -19,3 +20,19 @@ test('projection authorization distinguishes viewer and admin roles', () => {
|
||||
assert.equal(isAdmin({ role: 'admin' }), true);
|
||||
assert.equal(isAdmin(null), false);
|
||||
});
|
||||
|
||||
test('projection success with live input but zero projected channels is exposed as stale', () => {
|
||||
const state = serializeState({
|
||||
status: 'success',
|
||||
started_at: 100,
|
||||
completed_at: 200,
|
||||
input_hash: 'hash',
|
||||
projected_count: 0,
|
||||
processed_count: 3,
|
||||
total_count: 3,
|
||||
error: null
|
||||
});
|
||||
assert.equal(state.stale, true);
|
||||
assert.equal(state.projectedCount, 0);
|
||||
assert.equal(state.total, 3);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user