Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions quest/m0/interop-green/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ the fallback audio stall, which hit on
[41668668824](https://github.com/moq-dev/moq/actions/runs/41668668824); see
[the IETF22 fallback quest](/quest/m0/test-flakes-2/ietf22-fallback.md).

Every child has landed. Video passed its scheduled
Video passed its scheduled
[run 41497602703](https://github.com/moq-dev/moq/actions/runs/41497602703).
Interop runs
[41317901057](https://github.com/moq-dev/moq/actions/runs/41317901057),
Expand Down Expand Up @@ -68,4 +68,4 @@ Public API: none. Wire: none.

## Required

- [The open-GOP recovery fixture provides the broadcast name](/quest/m0/interop-green/open-gop-fixture.md) - the open-GOP browser fixture stubs `in.name`, and an exception in an effect fails the test at once instead of timing out
- [Confirm scheduled open-GOP recovery passes](/quest/m0/interop-green/open-gop-fixture.md) - a scheduled Interop run passes the open-GOP case with the typed fixture and direct effect/page error reporting
43 changes: 22 additions & 21 deletions quest/m0/interop-green/open-gop-fixture.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# [XS] The open-GOP recovery fixture provides the broadcast name
# [XS] Confirm scheduled open-GOP recovery passes

## Goal

The scheduled Interop run's "Harness regressions" step passes the
`open-gop.browser.ts` case "software video recovery trims orphan pictures
after join and later gap". The fixture's fake broadcast provides everything
`@moq/watch`'s decoder reads. From now on, an exception thrown inside a
fixture's effect fails the test immediately with that error, instead of
surfacing as a 60-second timeout.
after join and later gap" on `main` with the typed fixture and direct
reporting of effect/page exceptions.

## Waiting

- moq-dev/moq: a scheduled Interop run on `main` including
[moq-dev/moq#7814](https://github.com/moq-dev/moq/pull/7814) passes the
open-GOP recovery case. Check with
`gh run list --repo moq-dev/moq --workflow interop.yml --event schedule`,
then inspect its "Harness regressions" step. Delete this quest once that
case passes; the parent epic owns the whole-workflow pass.

## Plan

Expand All @@ -16,21 +23,15 @@ Decided 2026-11-03 (maintainer, /quest-plan of the follow-ups from
[moq-dev/moq#7716](https://github.com/moq-dev/moq/pull/7716)): milestone m0,
a child of the Interop epic, since it breaks the scheduled run.

- Cause: [moq-dev/moq#7222](https://github.com/moq-dev/moq/pull/7222)
(`2738588cfc`) made `js/watch/src/video/decoder.ts` read
`broadcast.in.name.peek()` for stats. The fake broadcast in
`test/interop/clients/js/open-gop/main.ts` provides only `out: { catalog,
active }` and `relativeBroadcast`, so the read throws inside an effect.
The scheduled run
[41668668824](https://github.com/moq-dev/moq/actions/runs/41668668824)
fails with `TypeError: Cannot read properties of undefined (reading
'name')` at `window.runRecovery`.
- Add `in: { name }` to the stub, typed against the real broadcast's shape
where the fixture allows it, so the next field the decoder reads fails
type-checking instead of at run time.
- Fail fast: route page errors and effect exceptions to a test failure.
[moq-dev/moq#7716](https://github.com/moq-dev/moq/pull/7716) adds
page-error collection to `harness.browser.ts`. Reuse it if it has landed,
or add the same collection here and let #7716 merge onto it.
[moq-dev/moq#7672](https://github.com/moq-dev/moq/pull/7672) supplied the
missing broadcast name. [moq-dev/moq#7814](https://github.com/moq-dev/moq/pull/7814)
replaces the unchecked broadcast stub with a real local origin and a
manual-catalog `Broadcast`. It reuses the browser harness's existing page
and console error collection while polling recovery, so an effect exception
fails directly even when the recovery promise never settles. The recovery
assertions and 60-second deadline remain unchanged.

Only scheduled evidence remains. Do not dispatch Nightly manually or treat
a local pass as scheduled evidence. Triage a remaining failure at its cause.

Public API: none. Wire: none.
39 changes: 28 additions & 11 deletions test/interop/clients/js/open-gop.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ import { tmpdir } from "node:os";
import { join } from "node:path";
import { build } from "vite";
import { worklet } from "../../../../js/common/vite-plugin-worklet";
import { launch } from "./harness";
import { launch, open, throwPageErrors, waitFor } from "./harness";
import type { Packet } from "./open-gop/main";

declare global {
interface Window {
recoveryResult?: Awaited<ReturnType<Window["runRecovery"]>>;
}
}

test("software video recovery trims orphan pictures after join and later gap", async () => {
const deadline = Date.now() + 60_000;
const run = mkdtempSync(join(tmpdir(), "moq-open-gop-"));
const file = join(run, "fixture.ts");
const command = (cmd: string[]) => {
Expand Down Expand Up @@ -104,17 +111,27 @@ test("software video recovery trims orphan pictures after join and later gap", a
return (await file.exists()) ? new Response(file) : new Response("not found", { status: 404 });
},
});
const page = await browser.newPage();
page.on("pageerror", (error) => console.error(error));
page.on("console", (message) => {
if (message.type() === "error") console.error(message.text());
const [page, errors] = await open(browser, `http://127.0.0.1:${server.port}`, "open-gop");
await waitFor(page, errors, (page) => page.evaluate(() => typeof window.runRecovery === "function"), {
deadline,
description: "the recovery fixture to load",
predicate: (ready) => ready,
});
await page.evaluate((packets) => {
// Keep page reads responsive while recovery runs, so an effect error can end the wait.
void window.runRecovery(packets).then((result) => {
window.recoveryResult = result;
});
}, packets);
const result = await waitFor(page, errors, (page) => page.evaluate(() => window.recoveryResult), {
deadline,
description: "open-GOP recovery",
predicate: (result) => result !== undefined,
});
await page.goto(`http://127.0.0.1:${server.port}`);
await page.waitForFunction(() => typeof window.runRecovery === "function");
const result = await page.evaluate((packets) => window.runRecovery(packets), packets);
expect(result.software).toBe(true);
expect(result.submitted).toEqual(expected);
expect(result.decoded).toBeGreaterThan(0);
throwPageErrors(errors);
expect(result?.software).toBe(true);
expect(result?.submitted).toEqual(expected);
expect(result?.decoded).toBeGreaterThan(0);
} finally {
await browser.close();
server?.stop();
Expand Down
26 changes: 14 additions & 12 deletions test/interop/clients/js/open-gop/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { Micro, Milli } from "@moq/clock";
import * as Catalog from "@moq/hang/catalog";
import * as Container from "@moq/hang/container";
import * as Moq from "@moq/net";
import { Signal } from "@moq/signals";
import type { Broadcast } from "../../../../../js/watch/src/broadcast";
import { Broadcast } from "../../../../../js/watch/src/broadcast";
import { Sync } from "../../../../../js/watch/src/sync";
import { Decoder } from "../../../../../js/watch/src/video/decoder";
import { Source } from "../../../../../js/watch/src/video/source";
Expand Down Expand Up @@ -59,7 +58,11 @@ window.runRecovery = async (packets) => {
super.decode(chunk);
}
};
const producer = new Moq.Broadcast.Producer();
const origin = new Moq.Origin.Producer();
const name = Moq.Path.from("open-gop");
const publication = origin.createBroadcast(name);
publication.announce();
const producer = publication.broadcast;
const track = producer.createTrack("video", { timescale: Moq.Time.Timescale.MICRO });
let group: Moq.Group.Producer | undefined;
for (const packet of packets) {
Expand All @@ -77,19 +80,18 @@ window.runRecovery = async (packets) => {
group?.finish();
track.finish();
track.close();
const media = producer.consume();
const config = Catalog.VideoConfigSchema.parse({
codec: "avc1.64001f",
container: { kind: "legacy" },
codedWidth: 160,
codedHeight: 96,
});
const catalog = new Signal<Catalog.Root>({ video: { renditions: { video: config } } });
const broadcast = new Signal<Broadcast | undefined>({
in: { name: new Signal(Moq.Path.from("open-gop")) },
out: { catalog, active: new Signal(media) },
relativeBroadcast: () => media,
} as unknown as Broadcast);
const broadcast = new Broadcast({
origin,
name,
catalogFormat: "manual",
catalog: { video: { renditions: { video: config } } },
});
const source = new Source({ broadcast, supported: async () => true });
const sync = new Sync({ delay: Milli(0), buffer: Milli(10_000) });
const decoder = new Decoder({ source, sync });
Expand All @@ -103,8 +105,8 @@ window.runRecovery = async (packets) => {
decoder.close();
source.close();
sync.close();
media.close();
producer.close();
broadcast.close();
origin.close();
window.VideoDecoder = Native;
Container.Consumer.prototype.next = next;
}
Expand Down