Repository navigation
fix(events): stop mirroring streaming_url and overflow_streaming_url into each other #661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| <?php | ||
|
|
||
| namespace Tests\Unit\Entities; | ||
|
|
||
| /** | ||
| * Copyright 2026 OpenStack Foundation | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| **/ | ||
|
|
||
| use models\summit\SummitEvent; | ||
| use Tests\TestCase; | ||
|
|
||
| /** | ||
| * The primary stream and the overflow stream are two independent URLs on an event. | ||
| * Setting one must never overwrite the other: the overflow readers (the public ?k= door, | ||
| * occupancy/overflow) read overflow_streaming_url only, and the primary readers read | ||
| * streaming_url only. | ||
| */ | ||
| final class SummitEventStreamingUrlTest extends TestCase | ||
| { | ||
| private const PrimaryUrl = 'https://stream.mux.com/primary123.m3u8'; | ||
| private const OverflowUrl = 'https://stream.mux.com/overflow456.m3u8'; | ||
|
|
||
| private function eventWithSummit(): SummitEvent | ||
| { | ||
| $summit = TestUtils::mockSummit(); | ||
| $event = new SummitEvent(); | ||
| $summit->addEvent($event); | ||
| return $event; | ||
| } | ||
|
|
||
| public function testSetOverflowLeavesThePrimaryStreamUntouched(): void | ||
| { | ||
| $event = $this->eventWithSummit(); | ||
| $event->setStreamingUrl(self::PrimaryUrl); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| $event->setStreamIsSecure(false); | ||
|
|
||
| $event->setOverflow(self::OverflowUrl, true); | ||
|
|
||
| $this->assertEquals(self::OverflowUrl, $event->getOverflowStreamingUrl()); | ||
| $this->assertTrue($event->getOverflowStreamIsSecure()); | ||
| $this->assertEquals(SummitEvent::OccupancyOverflow, $event->getOccupancy()); | ||
|
|
||
| $this->assertEquals(self::PrimaryUrl, $event->getStreamingUrl(), 'setOverflow must not overwrite streaming_url'); | ||
| $this->assertFalse($event->IsSecureStream(), 'setOverflow must not overwrite stream_is_secure'); | ||
| } | ||
|
|
||
| public function testSetStreamingUrlLeavesTheOverflowStreamUntouched(): void | ||
| { | ||
| $event = $this->eventWithSummit(); | ||
| $event->setOverflow(self::OverflowUrl, true); | ||
|
|
||
| $event->setStreamingUrl(self::PrimaryUrl); | ||
|
|
||
| $this->assertEquals(self::PrimaryUrl, $event->getStreamingUrl()); | ||
| $this->assertEquals(self::OverflowUrl, $event->getOverflowStreamingUrl(), 'setStreamingUrl must not overwrite overflow_streaming_url'); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One mirror is still left:
setStreamIsSecure()also writesoverflow_stream_is_secure.summit-api/app/Models/Foundation/Summit/Events/SummitEvent.php
Lines 1870 to 1872 in bef0de3
So the secure flags still aren't independent. Two callers reach it:
SummitEventFactory(whenever an event update payload carriesstream_is_secure) and the event clone inSummitService.Repro: an event is in OVERFLOW with a secure overflow stream (
overflow_stream_is_secure = true). An admin edits the event and sendsstream_is_secure=falsefor the primary stream. The overflow flag flips tofalsetoo, soSummitEventOverflowStreamingSerializerserves the overflow URL without signed Mux tokens, and playback fails when the overflow playback ID is signed.The new test doesn't catch this. It calls
setStreamIsSecure(false)beforesetOverflow(..., true), never the other way round.Suggested fix: drop line 1871. Then add a test that calls
setOverflow($url, true)thensetStreamIsSecure(false)and asserts thatgetOverflowStreamIsSecure()is stilltrue.