fix(k1): admit live rerun only after real data

This commit is contained in:
DCCONSTRUCTIONS
2026-08-20 12:54:55 +03:00
parent 321cde70e8
commit aee60f12b9
5 changed files with 150 additions and 31 deletions
@@ -8,6 +8,8 @@ let server;
let claimExclusiveLiveViewer;
let createRecordedOpenWatchdog;
let createReentrantViewerDisposer;
let isLiveRerunPresentationReady;
let liveRerunReceiverBindingIdentity;
let recordedOpenWatchdogTimeoutMs;
let rerunViewerInitialSource;
let rerunViewerOpenOptions;
@@ -23,6 +25,8 @@ before(async () => {
claimExclusiveLiveViewer,
createRecordedOpenWatchdog,
createReentrantViewerDisposer,
isLiveRerunPresentationReady,
liveRerunReceiverBindingIdentity,
recordedOpenWatchdogTimeoutMs,
rerunViewerInitialSource,
rerunViewerOpenOptions,
@@ -70,6 +74,31 @@ test("only the live receiver opens on the native following edge", () => {
assert.equal(rerunViewerOpenOptions(false), null);
});
test("live presentation waits for the exact receiver to expose a usable range", () => {
assert.equal(isLiveRerunPresentationReady(false, { min: 1, max: 2 }, 1), false);
assert.equal(isLiveRerunPresentationReady(true, null, 1), false);
assert.equal(isLiveRerunPresentationReady(true, { min: 2, max: 1 }, 1), false);
assert.equal(isLiveRerunPresentationReady(true, { min: 1, max: 2 }, 0), false);
assert.equal(isLiveRerunPresentationReady(true, { min: 1, max: 1 }, 1), true);
});
test("live receiver binding stays stable across recovery authority projections", () => {
const sourceUrl = "rerun+http://127.0.0.1:9877/proxy";
const streamId = "acq-001";
assert.equal(
liveRerunReceiverBindingIdentity(sourceUrl, streamId, true),
liveRerunReceiverBindingIdentity(` ${sourceUrl} `, streamId, true),
);
assert.notEqual(
liveRerunReceiverBindingIdentity(sourceUrl, streamId, true),
liveRerunReceiverBindingIdentity(sourceUrl, "acq-002", true),
);
assert.notEqual(
liveRerunReceiverBindingIdentity(sourceUrl, streamId, true),
liveRerunReceiverBindingIdentity(sourceUrl, streamId, false),
);
});
test("recorded admission watchdog is size-aware and exits an incomplete load", () => {
const smallDelay = recordedOpenWatchdogTimeoutMs(4);
const currentDelay = recordedOpenWatchdogTimeoutMs(246_331_680);
@@ -184,7 +213,19 @@ test("recorded RRD bytes are never split across LogChannel.send_rrd calls", asyn
);
assert.match(
source,
/viewer\.get_active_recording_id\(\)[\s\S]*eventCode: "live_receiver_active_store_admitted"[\s\S]*admitRecording\(\{[\s\S]*application_id: "nodedc_mission_core_spatial"/,
/viewer\.get_active_recording_id\(\)[\s\S]*admitRecording\(\{[\s\S]*application_id: "nodedc_mission_core_spatial"/,
);
assert.match(
source,
/const readyToRender = followLive\s*\? isLiveRerunPresentationReady\(/,
);
assert.match(
source,
/if \(readyToRender && !readyPublished\)[\s\S]*eventCode: "live_receiver_active_store_admitted"[\s\S]*diagnosticLifecycle\.markAdmitted\(\)/,
);
assert.doesNotMatch(
source,
/\], \[followLive, liveRecoveryAuthorityIdentity, liveStreamId, sourceUrl\]\);/,
);
assert.match(
source,
@@ -221,6 +262,25 @@ test("raw replay exercises the same streaming receiver lifecycle as a live scan"
source,
/sourceUrl\.trim\(\) && pointCloudVisible && !intentionalSourceEnd/,
);
assert.match(
source,
/const recordedSource = Boolean\(recordedReplay\) \|\| \/\\\.rrd/,
);
assert.doesNotMatch(
source,
/recordedSource = state\?\.sourceMode === ["']replay["']/,
);
});
test("the spatial header reports raw replay as an active source", async () => {
const source = await readFile(
new URL("../src/App.tsx", import.meta.url),
"utf8",
);
assert.match(
source,
/sourceMode === "replay"[\s\S]*\? "Повтор записи"[\s\S]*: "Ожидание эфира"/,
);
});
test("the complete vendor canvas host is hidden during partial and failed admission", async () => {