fix(k1): keep live viewer on stream edge

This commit is contained in:
DCCONSTRUCTIONS
2026-08-14 18:20:25 +03:00
parent 3235ba7b1c
commit cd8a1045c4
2 changed files with 15 additions and 1 deletions
@@ -551,6 +551,12 @@ export function rerunViewerInitialSource(
return resolvedSourceUrl; return resolvedSourceUrl;
} }
export function rerunViewerOpenOptions(
followLive: boolean,
): { follow_if_http: true } | null {
return followLive ? { follow_if_http: true } : null;
}
export function resolveRecordedBlueprintUrl(sourceUrl: string, origin: string): string | null { export function resolveRecordedBlueprintUrl(sourceUrl: string, origin: string): string | null {
const normalized = sourceUrl.trim(); const normalized = sourceUrl.trim();
if (!RECORDED_RRD_PATH.test(normalized)) return null; if (!RECORDED_RRD_PATH.test(normalized)) return null;
@@ -1631,7 +1637,7 @@ export function RerunViewport({
rerunViewerInitialSource(resolvedSource), rerunViewerInitialSource(resolvedSource),
host, host,
viewerOptions, viewerOptions,
null, rerunViewerOpenOptions(followLive),
); );
if (disposed) { if (disposed) {
disposeViewer(); disposeViewer();
@@ -10,6 +10,7 @@ let createRecordedOpenWatchdog;
let createReentrantViewerDisposer; let createReentrantViewerDisposer;
let recordedOpenWatchdogTimeoutMs; let recordedOpenWatchdogTimeoutMs;
let rerunViewerInitialSource; let rerunViewerInitialSource;
let rerunViewerOpenOptions;
let resolveRecordedViewerSourceUrl; let resolveRecordedViewerSourceUrl;
before(async () => { before(async () => {
@@ -24,6 +25,7 @@ before(async () => {
createReentrantViewerDisposer, createReentrantViewerDisposer,
recordedOpenWatchdogTimeoutMs, recordedOpenWatchdogTimeoutMs,
rerunViewerInitialSource, rerunViewerInitialSource,
rerunViewerOpenOptions,
resolveRecordedViewerSourceUrl, resolveRecordedViewerSourceUrl,
} = await server.ssrLoadModule("/src/components/RerunViewport.tsx")); } = await server.ssrLoadModule("/src/components/RerunViewport.tsx"));
}); });
@@ -63,6 +65,11 @@ test("only the canonical digest-bound generation URL reaches the native Rerun re
} }
}); });
test("only the live receiver opens on the native following edge", () => {
assert.deepEqual(rerunViewerOpenOptions(true), { follow_if_http: true });
assert.equal(rerunViewerOpenOptions(false), null);
});
test("recorded admission watchdog is size-aware and exits an incomplete load", () => { test("recorded admission watchdog is size-aware and exits an incomplete load", () => {
const smallDelay = recordedOpenWatchdogTimeoutMs(4); const smallDelay = recordedOpenWatchdogTimeoutMs(4);
const currentDelay = recordedOpenWatchdogTimeoutMs(246_331_680); const currentDelay = recordedOpenWatchdogTimeoutMs(246_331_680);
@@ -170,6 +177,7 @@ test("recorded RRD bytes are never split across LogChannel.send_rrd calls", asyn
assert.doesNotMatch(source, /missioncore\/recorded-recording/); assert.doesNotMatch(source, /missioncore\/recorded-recording/);
assert.doesNotMatch(source, /recordedChannel/); assert.doesNotMatch(source, /recordedChannel/);
assert.match(source, /viewer\.start\(\s*rerunViewerInitialSource\(resolvedSource\)/s); assert.match(source, /viewer\.start\(\s*rerunViewerInitialSource\(resolvedSource\)/s);
assert.match(source, /rerunViewerOpenOptions\(followLive\)/);
assert.match( assert.match(
source, source,
/recordingOpened = true;[\s\S]*diagnosticLifecycle\.markAdmitted\(\);/, /recordingOpened = true;[\s\S]*diagnosticLifecycle\.markAdmitted\(\);/,