Files
XC_VM/tests/Unit/ParchesRuntimeRowFallbackTest.php
T
obscuremindandClaude Opus 4.8 bc8b2d22fe fix(cluster): read the node's stream row from MAIN when its store is unseeded
On a node whose replica owns the stream but whose local state store is not
seeded, StreamSource::serverRow() returned the replica's bare row -- no pid,
cc_info or current_source. On the huge-catalogue node the store never seeds
(cluster_runtime_seed_memory_guard refuses it), so StreamProcess::startStream()
built the created-channel resume list without cc_info durations, discarded the
resume and restarted every created channel from episode 1; source rotation and
movie encoding lost their pid/current_source too.

Add mainServerRow(): when the replica owns the stream but the store is not
seeded, read the row from MAIN's database (the same query serverRow()'s legacy
branch runs, via remembered()), falling back to the bare replica row only when
MAIN is out of reach (mode 2 / no database / failed query). A stream the replica
does not own is still null. Load-balancer scoped. From Parches 1.16.118.

Regression lock in ParchesRuntimeRowFallbackTest; 105 StreamSource tests pass.
Full suite 5469/0, gates 5/5.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-15 04:29:06 +00:00

22 lines
1.1 KiB
PHP

<?php
use PHPUnit\Framework\TestCase;
/**
* 1.16.118 — on a node whose replica owns the stream but whose local state store
* is not seeded (e.g. the huge-catalogue node that refuses to seed), serverRow()
* returned the replica's bare row (no cc_info / pid / current_source), so created
* channels replayed from episode 1 and source rotation lost its current source.
* It now falls back to MAIN's streams_servers row (mainServerRow) when the store
* is not seeded, before the bare row. Load-balancer scoped.
*/
final class ParchesRuntimeRowFallbackTest extends TestCase {
public function testServerRowFallsBackToMainWhenUnseeded(): void {
$rSrc = (string) file_get_contents(MAIN_HOME . 'Domain/Stream/StreamSource.php');
$this->assertStringContainsString("self::mainServerRow(\$rStreamID, \$rServerID) ?? (\$rEntry['server'] ?? null)", $rSrc, 'unseeded: MAIN row, then the bare row as before');
$this->assertIsInt(strpos($rSrc, 'private static function mainServerRow('), 'the MAIN-row fallback helper exists');
$this->assertStringContainsString('if (NodeRole::refusesConnects()) {', $rSrc, 'mode 2 reads no MAIN database');
}
}