diff --git a/.agents/skills/which-tier/SKILL.md b/.agents/skills/which-tier/SKILL.md index b49b6ba989..901383dbb2 100644 --- a/.agents/skills/which-tier/SKILL.md +++ b/.agents/skills/which-tier/SKILL.md @@ -80,7 +80,7 @@ but a photograph could show it (`gfx.rs`, at the `glBlendFuncSeparate` call). ### Tier 1 — `make check` -`cargo +$(RUST_TOOLCHAIN) test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens`, preceded by `make lint` (three **named** clippy lints — +`cargo +$(RUST_TOOLCHAIN) test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp`, preceded by `make lint` (three **named** clippy lints — `ifs_same_cond`, `same_functions_in_if_condition`, `if_same_then_else` — the shadowed-branch gate), and followed by **three** host checks that are easy to forget are in here: `python3 ci/flavor.py --selftest` (the flavour transform, whose central assertion is that the STABLE transform is the @@ -108,7 +108,7 @@ lock.) Do not write a new number here: measure it if you need one — this file Count it yourself if you need the number: ```sh -cd rust-modules && cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -- --list | grep -c ': test' +cd rust-modules && cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp -- --list | grep -c ': test' ``` **Run it on the pinned toolchain.** `make check` uses `cargo +$(RUST_TOOLCHAIN)`, the `channel` of diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3389a59845..ed2aa61fc5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -259,7 +259,7 @@ jobs: # (`cargo metadata` resolves; it compiles nothing), plus an informational line count. # The binary-size budget runs in cross-build, where the binary exists. Limits and how to # raise one deliberately: ci/build-budgets.json, docs/agent-reference.md. - run: python3 ci/check-build-budgets.py --graph --src rust-modules/src --src rust-modules/base/src --src rust-modules/machine/src --src rust-modules/net/src --src rust-modules/platform/src --src rust-modules/gfx/src --src rust-modules/ui/src --src rust-modules/plex/src --src rust-modules/telemetry/src --src rust-modules/data/src --src rust-modules/session/src --src rust-modules/media/src --src rust-modules/playback-contract/src --src rust-modules/media-codecs/src --src rust-modules/play-feed/src --src rust-modules/play-uri/src --src rust-modules/appkit/src --src rust-modules/screens/src + run: python3 ci/check-build-budgets.py --graph --src rust-modules/src --src rust-modules/base/src --src rust-modules/machine/src --src rust-modules/net/src --src rust-modules/platform/src --src rust-modules/gfx/src --src rust-modules/ui/src --src rust-modules/plex/src --src rust-modules/telemetry/src --src rust-modules/data/src --src rust-modules/session/src --src rust-modules/media/src --src rust-modules/playback-contract/src --src rust-modules/media-codecs/src --src rust-modules/play-feed/src --src rust-modules/play-uri/src --src rust-modules/appkit/src --src rust-modules/screens/src --src rust-modules/owp/src - name: Third-party notices vs the ARM runtime graph # `make check` runs only the OFFLINE half of this (ci/gen-third-party-notices.py --check), which @@ -309,7 +309,7 @@ jobs: # for plxnative-modules both ways), so the `cargo test --lib` below finds everything built # and this step is where the compile happens, not an extra one. The upload below carries it. shell: bash - run: cd rust-modules && cargo "+$RUST_TOOLCHAIN" test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens --no-run --timings + run: cd rust-modules && cargo "+$RUST_TOOLCHAIN" test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp --no-run --timings - name: make check-cargo-unit-default # Teed to a file so the size step below can read the `test result:` lines this run already diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index 7bd59fdbdc..c79233d7a5 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -1,7 +1,8 @@ name: Fuzz the HUD parsers # The `cargo fuzz` package in `fuzz/` (docs/hud-plugins.md, "Fuzzing"): one libFuzzer target over each parser -# a HUD package or the registry reaches, and one over the WebSocket codec (`plx_net::ws`). It is not part of +# a HUD package or the registry reaches, one over the WebSocket codec (`plx_net::ws`) and one over the Open +# Watch Party reader (`plx_owp::json`). It is not part of # the rust-modules workspace, so nothing in `ci.yml` # compiles it; this workflow is what keeps it from rotting, and the only place it is fuzzed for longer than # a smoke test. @@ -50,6 +51,8 @@ on: - 'rust-modules/net/src/ws/**' - 'rust-modules/base/src/sha1.rs' - 'rust-modules/base/src/b64.rs' + - 'rust-modules/owp/src/**' + - 'rust-modules/owp/fixtures/**' - 'rust-modules/build_support/host_link.rs' - 'rust-modules/Cargo.lock' - 'site/hud/schema/**' @@ -59,11 +62,11 @@ on: workflow_dispatch: inputs: secs: - description: 'Seconds per target (9 targets run one after another; the step stops at 100 minutes)' + description: 'Seconds per target (10 targets run one after another; the step stops at 100 minutes)' type: string default: '300' target: - description: 'One target (admit, bundle_read, archive_read, svg_check, address_parse, catalog_parse, catalog_verify, catalog_cache, ws_frame); empty runs all' + description: 'One target (admit, bundle_read, archive_read, svg_check, address_parse, catalog_parse, catalog_verify, catalog_cache, ws_frame, owp_json); empty runs all' type: string default: '' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7990a1a8fb..c922ee1021 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,7 +1,7 @@ # Contributing New contributions to PlxNative's own code are offered under GPL-3.0-or-later, without copyright -assignment. Retain existing third-party notices and identify external code, its source revision, +assignment; to `rust-modules/owp/` (`plx_owp`), under Apache-2.0, as `LICENSING.md` says. Retain existing third-party notices and identify external code, its source revision, license and modifications. Do not submit code whose redistribution rights you cannot establish. Please include a `Signed-off-by: Your Name ` trailer certifying the diff --git a/LICENSING.md b/LICENSING.md index efa7d8b33b..7217d8dfeb 100644 --- a/LICENSING.md +++ b/LICENSING.md @@ -3,6 +3,8 @@ Copyright (c) 2026 Gleb Linnik and contributors. PlxNative's own code is licensed under the GNU General Public License, version 3 or (at your option) any later version: **GPL-3.0-or-later**. The complete license is in `LICENSE`. +The `plx_owp` crate (`rust-modules/owp/`) is the exception: it is licensed under **Apache-2.0**, like +Open Watch Party, so it can be used on its own. That license is in `licenses/Apache-2.0.txt`. There is no warranty, to the extent permitted by applicable law. You may use, modify and redistribute this software, including selling copies, under those terms. diff --git a/Makefile b/Makefile index 34e5d14898..16a3d6b7e5 100644 --- a/Makefile +++ b/Makefile @@ -1555,8 +1555,9 @@ DISK_TREE = $(if $(CARGO_TARGET_DIR),$(if $(filter /%,$(CARGO_TARGET_DIR)),$(CAR DISK_NEED = test-fast test-crate: DISK_TREE = $(CURDIR)/rust-modules/$(TEST_FAST_TDIR) test-hostsim: DISK_TREE = $(CURDIR)/rust-modules/$(TEST_HOSTSIM_TDIR) -# The fuzz tree (ASan + coverage, release with debuginfo, nine binaries): 3.1 GiB measured after a cold build -# of the first eight; the ninth, `ws_frame`, adds 83 MiB (measured on Linux x86_64). +# The fuzz tree (ASan + coverage, release with debuginfo, ten binaries): 3.1 GiB measured after a cold build +# of the first eight; the ninth, `ws_frame`, adds 83 MiB, and the tenth, `owp_json`, 49 MiB with `plx_owp` +# (measured on Linux x86_64). fuzz-hud: DISK_TREE = $(CURDIR)/rust-modules/$(FUZZ_TDIR) fuzz-hud: DISK_NEED = 3.3 check-replay sim-macos: DISK_TREE = $(abspath $(SIM_TDIR)$(if $(LAB),-lab,)) @@ -1679,7 +1680,7 @@ check-cargo-lint: lint @# gate has nothing to reuse a cache for. No `pkg/lab.json` is involved — that file is `make @# LAB=1`'s requirement (a live session secret), not the compiler's. @set -e; cd rust-modules && CARGO_INCREMENTAL=0 PATH="$$HOME/.cargo/bin:$$PATH" \ - cargo +$(RUST_TOOLCHAIN) check --lib --tests -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens --features lab-diagnostics + cargo +$(RUST_TOOLCHAIN) check --lib --tests -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp --features lab-diagnostics @# And the demo-video dump build's pixel oracle, `placeholder-sentinel`: in no default set and @# built only by `make site-video-sim`, which no gate runs and which compiles no `plx_ui` tests, so @# this line is what keeps it compiling (its code AND its tests, `--tests`). `plx_ui` is the only @@ -1698,11 +1699,11 @@ check-cargo-lint: lint # `-p` lists in the recipes below (those stay literal because ci/test_ci_split.py greps for them); # ci/test_test_crate.py pins the two equal. UNIT_RUN = python3 ../tools/cargo-test-parallel.py -UNIT_SUITE = plxnative-modules plx_base plx_machine plx_platform plx_gfx plx_net plx_ui plx_plex plx_telemetry plx_data plx_session plx_media plx_playback_contract plx_play_uri plx_play_feed plx_media_codecs plx_appkit plx_screens +UNIT_SUITE = plxnative-modules plx_base plx_machine plx_platform plx_gfx plx_net plx_ui plx_plex plx_telemetry plx_data plx_session plx_media plx_playback_contract plx_play_uri plx_play_feed plx_media_codecs plx_appkit plx_screens plx_owp # The `hostsim` pass runs only the crates that DECLARE a `hostsim` feature (HOSTSIM_SUITE, a subset of -# UNIT_SUITE in the same order; ci/test_test_crate.py pins both the subset and the recipe). The seven that -# do not (plx_net, plx_ui, plx_appkit, plx_screens, plx_media_codecs, plx_play_uri, plx_playback_contract) -# have no `feature = "hostsim"` in their source and the same test names in both passes (14 crates did in +# UNIT_SUITE in the same order; ci/test_test_crate.py pins both the subset and the recipe). The eight that +# do not (plx_net, plx_ui, plx_appkit, plx_screens, plx_media_codecs, plx_play_uri, plx_playback_contract, +# plx_owp) have no `feature = "hostsim"` in their source and the same test names in both passes (14 crates did in # CI run 43528579834; the three that differ are `plxnative-modules`, `plx_media` and `plx_play_feed`, # all kept). Their own test set is therefore identical in the two passes. The old second run did link # their test binaries against hostsim-built `plx_base`, `plx_gfx`, `plx_platform`, `plx_media` and @@ -1739,7 +1740,7 @@ check-cargo-unit-default: cd rust-modules && PATH="$$HOME/.cargo/bin:$$PATH" PLXNATIVE_RUNTIME_DIR="$$d" \ $(TELEMETRY_ENV) \ $(HOST_ENV) \ - $(UNIT_RUN) -- cargo +$(RUST_TOOLCHAIN) test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens + $(UNIT_RUN) -- cargo +$(RUST_TOOLCHAIN) test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp RUST_TOOLCHAIN=$(RUST_TOOLCHAIN) python3 ci/test_storage_service_package.py cd rust-modules && PATH="$$HOME/.cargo/bin:$$PATH" cargo +$(RUST_TOOLCHAIN) test -p plxnative-storage --bin plxnative-storage @# The helper is its own package, so building it compiles no copy of the app library; this reads @@ -1797,7 +1798,7 @@ test-fast: PATH="$$HOME/.cargo/bin:$$PATH" PLXNATIVE_RUNTIME_DIR="$$d" \ $(TELEMETRY_ENV) \ $(HOST_ENV) \ - $(UNIT_RUN) $(if $(T),--filter '$(T)') -- cargo +$(RUST_TOOLCHAIN) test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens + $(UNIT_RUN) $(if $(T),--filter '$(T)') -- cargo +$(RUST_TOOLCHAIN) test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp # `make test-crate C=plx_ui [T=filter] [DEPS=1]` -- build and run ONLY the named crate's lib tests, in # the same incremental `$(TEST_FAST_TDIR)` tree and with the same flags as `test-fast`, so the two diff --git a/README.md b/README.md index 07f94ec440..0cb3a0ec9e 100644 --- a/README.md +++ b/README.md @@ -218,7 +218,7 @@ Error monitoring for PlxNative is sponsored by [Sentry](https://sentry.io/for/go ## Licence -[GPL-3.0-or-later](LICENSE), © 2026 Gleb Linnik. The PlxNative name and its brand artwork are excluded — see +[GPL-3.0-or-later](LICENSE), © 2026 Gleb Linnik; `rust-modules/owp/` is Apache-2.0 ([`LICENSING.md`](LICENSING.md)). The PlxNative name and its brand artwork are excluded — see [`TRADEMARKS.md`](TRADEMARKS.md), which also carries the Plex and LG non-affiliation statements. Third-party components and their licences are in [`THIRD-PARTY-NOTICES.md`](THIRD-PARTY-NOTICES.md) and `licenses/` — notably the app ships its own diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md index ba3b6bfba3..c12cd6b672 100644 --- a/THIRD-PARTY-NOTICES.md +++ b/THIRD-PARTY-NOTICES.md @@ -630,11 +630,20 @@ the GPL-3.0-or-later election. Also retain `licenses/GCC-exception-3.1.txt` and ## 6. Deliberately not listed -Two third-party components exist in the PlxNative source repository but are **not** part of this +Three third-party components exist in the PlxNative source repository but are **not** part of this package, and therefore carry no obligation discharged here: **libjpeg-turbo** -(`libturbojpeg.so.0`, copied to developer televisions by the development deploy step only) and +(`libturbojpeg.so.0`, copied to developer televisions by the development deploy step only), **jsmpeg** (a host-side development tool; `tools/stream-screen.py` downloads it at the upstream commit -`ci/dependencies.json` pins, so no copy of it is in the repository; its licence is `licenses/jsmpeg.txt`). Neither is present in the installed application. +`ci/dependencies.json` pins, so no copy of it is in the repository; its licence is `licenses/jsmpeg.txt`), and +the **Open Watch Party** conformance data described below. None of the three is present in the installed application. + +The Open Watch Party data in `rust-modules/owp/fixtures/` holds test vectors, +descriptor and `setMedia` examples and the public relay list, copied unchanged from +[edde746/openwatchparty](https://github.com/edde746/openwatchparty) at revision `d8c3c2abc753` +(Apache-2.0, its text in `rust-modules/owp/fixtures/LICENSE`, the file list and hashes in that +directory's `README.md`). The `plx_owp` tests read them; the application does not link `plx_owp`, so +none of it is installed. The relay list `relays.json` is compiled into `plx_owp` and moves to §2 when +the application links it. ## Source-only attribution diff --git a/TRADEMARKS.md b/TRADEMARKS.md index 44a5e27cd9..3e3fa431e1 100644 --- a/TRADEMARKS.md +++ b/TRADEMARKS.md @@ -1,6 +1,7 @@ # Trademarks, brand assets, and non-affiliation -The [GPL-3.0-or-later grant](LICENSE) covers this project's own source code. This file covers the things a +The [GPL-3.0-or-later grant](LICENSE) covers this project's own source code, except the `plx_owp` crate, +which is Apache-2.0 ([`LICENSING.md`](LICENSING.md)). This file covers the things a licence grant does not: the marks that identify the project, and whose software this interoperates with. diff --git a/ci/build-budgets.json b/ci/build-budgets.json index aecdf6c91b..096c91fde5 100644 --- a/ci/build-budgets.json +++ b/ci/build-budgets.json @@ -48,7 +48,7 @@ "headroom": "+3" }, "source_lines": { - "what": "Lines of Rust under rust-modules/src, rust-modules/base/src, rust-modules/machine/src, rust-modules/net/src, rust-modules/platform/src, rust-modules/gfx/src, rust-modules/ui/src, rust-modules/plex/src, rust-modules/telemetry/src, rust-modules/data/src, rust-modules/session/src, rust-modules/media/src, rust-modules/playback-contract/src, rust-modules/media-codecs/src, rust-modules/play-feed/src, rust-modules/play-uri/src, rust-modules/appkit/src and rust-modules/screens/src (every .rs file). Informational: exceeding it warns and never fails, because a growing feature is not a build-health defect by itself.", + "what": "Lines of Rust under rust-modules/src, rust-modules/base/src, rust-modules/machine/src, rust-modules/net/src, rust-modules/platform/src, rust-modules/gfx/src, rust-modules/ui/src, rust-modules/plex/src, rust-modules/telemetry/src, rust-modules/data/src, rust-modules/session/src, rust-modules/media/src, rust-modules/playback-contract/src, rust-modules/media-codecs/src, rust-modules/play-feed/src, rust-modules/play-uri/src, rust-modules/appkit/src, rust-modules/screens/src and rust-modules/owp/src (every .rs file). Informational: exceeding it warns and never fails, because a growing feature is not a build-health defect by itself.", "unit": "lines", "mode": "warn", "limit": 485000, diff --git a/ci/check-build-budgets.py b/ci/check-build-budgets.py index c69eb95491..e0b932678b 100755 --- a/ci/check-build-budgets.py +++ b/ci/check-build-budgets.py @@ -15,7 +15,7 @@ * binary_bytes the stripped binary `make ipk` stages (measured in the cross-build job) * packages_* third-party packages the app crate compiles for the ARM target * duplicate_versions_* crate names in more than one version on the normal-edge graph -* source_lines lines of Rust in rust-modules/src and every split-out layer crate (rust-modules/base/src, rust-modules/machine/src, rust-modules/net/src, rust-modules/platform/src, rust-modules/gfx/src, rust-modules/ui/src, rust-modules/plex/src, rust-modules/telemetry/src, rust-modules/data/src, rust-modules/session/src, rust-modules/media/src, rust-modules/playback-contract/src, rust-modules/media-codecs/src, rust-modules/play-feed/src, rust-modules/play-uri/src, rust-modules/appkit/src, rust-modules/screens/src); mode "warn", never fails +* source_lines lines of Rust in rust-modules/src and every split-out layer crate (rust-modules/base/src, rust-modules/machine/src, rust-modules/net/src, rust-modules/platform/src, rust-modules/gfx/src, rust-modules/ui/src, rust-modules/plex/src, rust-modules/telemetry/src, rust-modules/data/src, rust-modules/session/src, rust-modules/media/src, rust-modules/playback-contract/src, rust-modules/media-codecs/src, rust-modules/play-feed/src, rust-modules/play-uri/src, rust-modules/appkit/src, rust-modules/screens/src, rust-modules/owp/src); mode "warn", never fails Exit status: 0 all within budget (warn-mode overruns print ::warning::), 1 a fail-mode budget is exceeded, 2 the budgets file or an input is unusable. @@ -243,7 +243,7 @@ def main(argv=None) -> int: ap.add_argument("--graph", action="store_true") ap.add_argument("--tree-default") ap.add_argument("--tree-no-default") - ap.add_argument("--src", action="append", help="a source directory to count; repeat for each crate (rust-modules/src, rust-modules/base/src, rust-modules/machine/src, rust-modules/net/src, rust-modules/platform/src, rust-modules/gfx/src, rust-modules/ui/src, rust-modules/plex/src, rust-modules/telemetry/src, rust-modules/data/src, rust-modules/session/src, rust-modules/media/src, rust-modules/playback-contract/src, rust-modules/media-codecs/src, rust-modules/play-feed/src, rust-modules/play-uri/src, rust-modules/appkit/src, rust-modules/screens/src)") + ap.add_argument("--src", action="append", help="a source directory to count; repeat for each crate (rust-modules/src, rust-modules/base/src, rust-modules/machine/src, rust-modules/net/src, rust-modules/platform/src, rust-modules/gfx/src, rust-modules/ui/src, rust-modules/plex/src, rust-modules/telemetry/src, rust-modules/data/src, rust-modules/session/src, rust-modules/media/src, rust-modules/playback-contract/src, rust-modules/media-codecs/src, rust-modules/play-feed/src, rust-modules/play-uri/src, rust-modules/appkit/src, rust-modules/screens/src, rust-modules/owp/src)") args = ap.parse_args(argv) try: budgets = load_budgets(Path(args.budgets)) diff --git a/ci/check-deps.sh b/ci/check-deps.sh index f40ff7436b..73f8aa5796 100755 --- a/ci/check-deps.sh +++ b/ci/check-deps.sh @@ -151,6 +151,7 @@ SRC_PLAY_FEED=rust-modules/play-feed/src SRC_MEDIA_CODECS=rust-modules/media-codecs/src SRC_APPKIT=rust-modules/appkit/src SRC_SCREENS=rust-modules/screens/src +SRC_OWP=rust-modules/owp/src fails=0 fail() { echo "::error::check-deps: $*"; fails=$((fails+1)); } ok() { echo " ok — $*"; } @@ -351,6 +352,7 @@ wholly_test_files() { python3 ci/rust_test_modules.py "$SRC_MEDIA_CODECS" python3 ci/rust_test_modules.py "$SRC_APPKIT" python3 ci/rust_test_modules.py "$SRC_SCREENS" + python3 ci/rust_test_modules.py "$SRC_OWP" } # is_wholly_test : the `wholly_test` list as a builtin lookup. Three gates below asked this @@ -718,7 +720,7 @@ fi # metadata-owner # Wholly-test files (see `wholly_test_files`) are skipped like inline `#[cfg(test)]` blocks: a # test's reference colour maths is not logical state. if want libm; then -libm_lines=$(grep_code '\.(exp|ln|log|powf|powi|cbrt|sin|cos|tan|atan2|hypot|mul_add|sin_cos)\(' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" \ +libm_lines=$(grep_code '\.(exp|ln|log|powf|powi|cbrt|sin|cos|tan|atan2|hypot|mul_add|sin_cos)\(' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP" \ | grep -vE '\.log\((&|")' | grep -v "^$SRC_MACHINE/motion.rs:") libm_bad=0 while IFS= read -r line; do @@ -730,7 +732,7 @@ done <<< "$libm_lines" if [ "$libm_bad" -eq 0 ]; then ok "libm"; else fail "libm: $libm_bad line(s) outside ci/allow/libm.txt"; fi fi # libm -want ticks && gate ticks 'SDL_GetTicks\(' "$SRC" "$SRC_BASE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" +want ticks && gate ticks 'SDL_GetTicks\(' "$SRC" "$SRC_BASE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP" # Every data/session module is logic unless its exact reviewed IO/instrument file is in ports.ini. if want wall; then if python3 ci/check-ports.py; then ok "wall"; else fail "wall: outside exact ci/ports.ini files"; fi @@ -748,7 +750,7 @@ if [ "$n" -eq 1 ] && [ "$d" -eq 1 ]; then ok "present: one worker door"; else fa fi # present if want effect; then -if [ -n "$(grep_code '\bEffect::' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS")" ]; then fail "effect: \`Effect::\` is spelled (use Fx:: / AppFx::)"; else ok "effect"; fi +if [ -n "$(grep_code '\bEffect::' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP")" ]; then fail "effect: \`Effect::\` is spelled (use Fx:: / AppFx::)"; else ok "effect"; fi fi # effect # mutators: production lines of ui/, screens/ and app/ (everything before the file's first @@ -860,7 +862,7 @@ want nav && gate nav '(crate::ui|plx_ui)::nav::' "$SRC" "$SRC_UI" "$SRC_APPKIT" # Completed ownership migration: legacy publications and the old gate cannot return. if want ui-owner-legacy; then -ui_owner_hits=$(grep_code '(plx_ui|crate::ui)::press::|(plx_machine|crate)::idle::' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS") +ui_owner_hits=$(grep_code '(plx_ui|crate::ui)::press::|(plx_machine|crate)::idle::' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP") if [ -z "$ui_owner_hits" ]; then ok "ui-owner-legacy"; else printf '%s\n' "$ui_owner_hits" fail "ui-owner-legacy: retired global readers must not return" @@ -960,7 +962,7 @@ want uistorage && gate uistorage '(crate|super|plx_platform)::storage::' "$SRC_U # legacypage: the word itself, anywhere under src — a doc that still describes the type is as much # a hit as a declaration, which is the point (nothing compiles the prose either). if want legacypage; then -legacy_hits=$(grep -rn --include='*.rs' 'LegacyPage' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" 2>/dev/null || true) +legacy_hits=$(grep -rn --include='*.rs' 'LegacyPage' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP" 2>/dev/null || true) if [ -z "$legacy_hits" ]; then ok "legacypage"; else echo "$legacy_hits" | sed 's/^/ /' fail "legacypage: $(echo "$legacy_hits" | wc -l | tr -d ' ') mention(s) — the type is retired (§15.2)" @@ -1054,7 +1056,7 @@ fi # textmeasure # the documented intent (spec §4.2: the ONLY file licensed to touch a raw per-frame delta), not a # live carve-out. if want dt; then -dt_hits=$(grep_code 'idle::dt\(\)|(\+=|-=)\s*dt\b' "$SRC" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" | grep -v "^$SRC_MACHINE/motion.rs:") +dt_hits=$(grep_code 'idle::dt\(\)|(\+=|-=)\s*dt\b' "$SRC" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP" | grep -v "^$SRC_MACHINE/motion.rs:") if [ -z "$dt_hits" ]; then ok "dt"; else echo "$dt_hits" | sed 's/^/ /' fail "dt: $(echo "$dt_hits" | wc -l | tr -d ' ') line(s) — see rule comment above" @@ -1111,7 +1113,7 @@ while IFS= read -r f; do # REMOVES matches, so a file with no raw hit cannot fail this gate — and running its `awk` plus a # `grep` over all 420 files, to reach the two that mention the shape, was the single most expensive # rule in this script (4.8 s of its 17 s). -done < <(grep -rlE --include='*.rs' "$frame_pat" "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" 2>/dev/null | sort) +done < <(grep -rlE --include='*.rs' "$frame_pat" "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP" 2>/dev/null | sort) if [ "$frame_bad" -eq 0 ]; then ok "frame" else fail "frame: $frame_bad line(s) of a privileged OS-primitive call outside app/run.rs"; fi fi # frame @@ -1136,7 +1138,7 @@ while IFS= read -r line; do case "$p" in "$SRC_MEDIA"/player/*|"$SRC_PLATFORM"/tv/*|"$SRC_PLATFORM"/tv.rs|"$SRC_PLATFORM"/webos/*|"$SRC"/port.rs|"$SRC"/app/adapters/backends.rs) continue ;; esac if is_wholly_test "$p"; then continue; fi echo " $line"; sink_bad=$((sink_bad+1)) -done < <(grep_code 'tv::sink::(installed|display_installed)|\b(VideoSink|DisplaySink)\b' "$SRC" "$SRC_PLATFORM" "$SRC_UI" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS") +done < <(grep_code 'tv::sink::(installed|display_installed)|\b(VideoSink|DisplaySink)\b' "$SRC" "$SRC_PLATFORM" "$SRC_UI" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP") if [ "$sink_bad" -eq 0 ]; then ok "sink" else fail "sink: $sink_bad line(s) naming the video sink outside playback execution, port.rs, tv.rs and tv/"; fi fi # sink @@ -1229,7 +1231,7 @@ while IFS= read -r f; do { print NR":"$0; prev=$0 }' "$f" | grep -E "$pat" | grep -vE '^[0-9]+:\s*//' || true) # ...over the files that spell `spawn(` at all — a superset of both matched spellings, and the `awk` # below only drops `#[cfg(test)] mod` blocks, so the count is unchanged. -done < <(grep -rlE --include='*.rs' '\bspawn\(' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" 2>/dev/null | grep -v "^$SRC_BASE/task.rs\$" | sort) +done < <(grep -rlE --include='*.rs' '\bspawn\(' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP" 2>/dev/null | grep -v "^$SRC_BASE/task.rs\$" | sort) threads_declared=$(sed -n 's/^# count: *//p' ci/allow/threads.txt | head -1) if [ "$threads_bad" -eq "${threads_declared:-0}" ]; then ok "threads" else fail "threads: $threads_bad line(s) outside ci/allow/threads.txt (declared count is exactly ${threads_declared:-0}, not a ceiling)"; fi @@ -1374,7 +1376,7 @@ EOF_STALE # `ci/ledger.awk` (the ledger machinery above). if want blocking; then blocking_sites=$( - grep -rlE --include='*.rs' 'allow_blocking' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" 2>/dev/null \ + grep -rlE --include='*.rs' 'allow_blocking' "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP" 2>/dev/null \ | grep -v "^$SRC_BASE/task/blocking.rs\$" | sort \ | LG_MODE=call LG_SITE='(^|[^A-Za-z0-9_])allow_blocking\(' LG_DEF='fn[[:space:]]+allow_blocking\(' \ LG_REF='(^|[^A-Za-z0-9_])allow_blocking([^A-Za-z0-9_(]|$)' LG_REEXPORT_FILE="$SRC_BASE/task.rs" \ @@ -1403,9 +1405,9 @@ fi # blocking # pure `Plane`, in the file of its runner `PlaneOwner`): platform holds forks of its own (i18n, # keymanager, storage, toast, webos, ...) that no ledger lists, so that one file is scanned for workers # and globals and the crate is not in FORK_SCOPE: -MACHINES=("$SRC_DATA" "$SRC_SESSION" rust-modules/plex/src/plex/session.rs "$SRC_MEDIA/player/lifecycle.rs" +MACHINES=("$SRC_DATA" "$SRC_SESSION" "$SRC_OWP" rust-modules/plex/src/plex/session.rs "$SRC_MEDIA/player/lifecycle.rs" "$SRC_MEDIA/player/attempt_metrics.rs" "$SRC_MEDIA/player/attempt_view.rs" "$SRC_MEDIA/player/readout.rs" "$SRC_MEDIA/player/backend_startup.rs" "$SRC_MEDIA/player/backend_metrics.rs" "$SRC_MEDIA/player/recovery.rs" "$SRC_MEDIA/player/release.rs" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI/uriprobe.rs" "$SRC_PLAY_URI/uri_protocol.rs" "$SRC_PLAY_URI/uri_lifecycle.rs" "$SRC_PLAY_URI/register_ladder.rs" "$SRC_PLAY_URI/acb_bind.rs" "$SRC_PLAY_URI/picture_gate.rs" "$SRC_PLATFORM/tv/plane.rs" "$SRC_MEDIA/route/backend_policy.rs" "$SRC_MEDIA/route/plan.rs" "$SRC_MEDIA/route/plan_memory.rs" "$SRC_SCREENS" "$SRC_UI" "$SRC_APPKIT" "$SRC_MACHINE") -FORK_SCOPE=("$SRC_DATA" "$SRC_PLEX" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_SESSION" "$SRC_SCREENS" "$SRC_UI" "$SRC_APPKIT" "$SRC_MACHINE") +FORK_SCOPE=("$SRC_DATA" "$SRC_PLEX" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_SESSION" "$SRC_SCREENS" "$SRC_OWP" "$SRC_UI" "$SRC_APPKIT" "$SRC_MACHINE") # scope_re ...: an ERE over repo-relative file paths that matches those paths (a `.rs` file # exactly, anything else as a directory prefix) @@ -1436,7 +1438,7 @@ forks_plain_re='^[[:space:]]*#\[cfg\((test|any\(test, feature = "test-support"\) # PRELUDE 3 of 3: computed only when workers, globals or forks is selected. if any_wanted workers globals forks; then ledger_hits=$( - find "$SRC_DATA" "$SRC_SESSION" "$SRC_PLEX" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_SCREENS" "$SRC_UI" "$SRC_APPKIT" "$SRC_MACHINE" "$SRC_PLATFORM/tv/plane.rs" \ + find "$SRC_DATA" "$SRC_SESSION" "$SRC_PLEX" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_SCREENS" "$SRC_OWP" "$SRC_UI" "$SRC_APPKIT" "$SRC_MACHINE" "$SRC_PLATFORM/tv/plane.rs" \ -name '*.rs' -type f 2>/dev/null \ | W_PAT="$workers_pat" G_PAT="$globals_pat" F_PAT="$forks_pat" F_PLAIN="$forks_plain_re" \ M_RE="$machines_re" K_RE="$fork_scope_re" \ @@ -1626,7 +1628,7 @@ fi # fxlanes # neither one is a `/tmp/plxnative-` literal in the first place and there is no second file to # name here (re-verify this if a log sink is ever given a hardcoded `/tmp/` path). if want tmppath; then -tmp_hits=$(python3 - "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" <<'PY' +tmp_hits=$(python3 - "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP" <<'PY' import os, sys src = sys.argv[1] @@ -1727,7 +1729,7 @@ fi # tmppath # classification above) and `#[cfg(test)]` items, found from tokens so a literal inside a string is # never mistaken for a comment. Zero, no allowlist. Scans every crate root, not only plex's. if want paging; then -paging_hits=$(WHOLLY_TEST="$wholly_test" python3 - "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" <<'PY' +paging_hits=$(WHOLLY_TEST="$wholly_test" python3 - "$SRC" "$SRC_BASE" "$SRC_MACHINE" "$SRC_PLATFORM" "$SRC_GFX" "$SRC_NET" "$SRC_UI" "$SRC_PLEX" "$SRC_TELEMETRY" "$SRC_DATA" "$SRC_SESSION" "$SRC_MEDIA" "$SRC_PLAYBACK_CONTRACT" "$SRC_PLAY_URI" "$SRC_PLAY_FEED" "$SRC_MEDIA_CODECS" "$SRC_APPKIT" "$SRC_SCREENS" "$SRC_OWP" <<'PY' import os, sys sys.path.insert(0, "ci") from rust_test_modules import close, lex diff --git a/ci/list-caps.ini b/ci/list-caps.ini index db53aeafad..66965b7ce0 100644 --- a/ci/list-caps.ini +++ b/ci/list-caps.ini @@ -1501,3 +1501,59 @@ reason = Bounds allocation of one complete signed catalog response (header line, [data/src/hudpacks/catalog.rs::CACHE_BYTE_LIMIT] class = work reason = Bounds a complete catalog cache read including JSON escaping of the bounded UTF-8 response; invalid or oversized caches never become partial catalogs. + +[owp/src/clock.rs::CLOCK_WINDOW] +class = format +reason = The Open Watch Party clock keeps its 8 newest round-trip samples (SDK.md §5); a protocol constant over pings, not a list anyone browses. + +[owp/src/code.rs::format] +class = not-a-list +reason = Splits a valid six-symbol room code into two groups of three for display (SDK.md §4.1); every symbol is kept. + +[owp/src/json.rs::MAX_SAFE_INT] +class = format +reason = The largest integer an Open Watch Party message may carry, ±(2^53 − 1) (SPEC.md §2); a numeric bound, not a list. + +[owp/src/media.rs::MAX_DURATION_MS] +class = format +reason = The protocol's longest media duration, 7 days (SPEC.md §10, §13.1); a numeric bound on one field. + +[owp/src/media.rs::MAX_EXT_BYTES] +class = format +reason = The protocol limit on a descriptor's app-private `ext`, 1024 bytes (SPEC.md §10, §13.1), checked before sending. + +[owp/src/media.rs::MAX_MEDIA_BYTES] +class = format +reason = The protocol limit on a media descriptor, 4096 bytes (SPEC.md §10, §13.1), checked before sending. + +[owp/src/message.rs::MAX_MESSAGE_BYTES] +class = format +reason = The relay's largest inbound message, 8192 bytes (SPEC.md §3.1, §13.1), checked before sending; MAX_RELAY_MESSAGE_BYTES caps what the relay sends. + +[owp/src/message.rs::MAX_RELAY_MESSAGE_BYTES] +class = not-a-list +reason = The longest relay message decode reads, 65536 bytes, checked before the scan; clients must accept at least 32768 (SPEC.md §3.1), and a longer one is TooLarge. + +[owp/src/relays.rs::MAX_RELAY_ID_LENGTH] +class = format +reason = The relay list's longest relay id, 32 characters (SPEC.md §5.2); a text length. + +[owp/src/relays.rs::MAX_RELAY_NAME_LENGTH] +class = format +reason = The relay list's longest relay name, 64 code points (SPEC.md §5.2); a text length. + +[owp/src/room.rs::MAX_OFFSET_MS] +class = format +reason = The protocol's widest participant offset, ±7 days (SPEC.md §7.5, §13.1); a numeric bound on one field. + +[owp/src/room.rs::MAX_PEER_ID_LENGTH] +class = format +reason = The peer ID pattern's longest id, 16 characters (SPEC.md §11.1); a text length. + +[owp/src/text.rs::MAX_CLIENT_LENGTH] +class = format +reason = The protocol's longest `client`, 64 code points (SPEC.md §6.3, §13.1); a text length. + +[owp/src/text.rs::MAX_NAME_LENGTH] +class = format +reason = The protocol's longest display `name`, 32 code points (SPEC.md §6.3, §13.1); a text length. diff --git a/ci/machines.ini b/ci/machines.ini index 99e071b7c1..76ad5eff23 100644 --- a/ci/machines.ini +++ b/ci/machines.ini @@ -154,3 +154,15 @@ state_reads = immutable [module session/src/auth/owner.rs] wildcard_enum_match_arm = deny + +[owp/src/clock.rs::ClockSync] +event = ClockEvent +effect = PongOutcome +step = inherent (`ClockSync::step`); one clock per relay connection (SDK.md section 5); not yet owned by a session, the caller hands it local monotonic times in the events +writer_policy = strict +state_field = window +transition = transition +constructor = new + +[module owp/src/clock.rs] +wildcard_enum_match_arm = deny diff --git a/ci/module-layers.ini b/ci/module-layers.ini index f0a76d44c4..ce52e1ccfb 100644 --- a/ci/module-layers.ini +++ b/ci/module-layers.ini @@ -148,6 +148,10 @@ members = media_codecs uses = base platform playback_contract members = play_uri +[owp] +uses = +members = owp + [play_feed] uses = base platform net playback_contract media_codecs members = play_feed diff --git a/ci/proofs/platform-generated-enums.json b/ci/proofs/platform-generated-enums.json index eaf184414c..ac42fc6433 100644 --- a/ci/proofs/platform-generated-enums.json +++ b/ci/proofs/platform-generated-enums.json @@ -30,7 +30,7 @@ }, "text_hashing": "sha256-utf8-bytes-crlf-to-lf-local-root-version-v1", "manifests": { - "Cargo.toml": "c57b1c2d662d460a6d71f6de158397f1cb2f2fecb167bfa738631d77b661248b", + "Cargo.toml": "bc1d99641ae550b5ea510bb5364c971fed278358019073e5cf8fb7759ab71218", "appkit/Cargo.toml": "1e3a33f392110f269537b12f12879c6bc15309aca304b189d6b0346edf8a1186", "base/Cargo.toml": "ebe0b95553bd44f33f422f7d8e22b75ddeb53c7ee81bbe738f675690694568f7", "data/Cargo.toml": "90a763a8a9e22bda7e95f8ede4dc10ec6e92a62b90bd0fd2e622c617d75ec6c7", @@ -39,6 +39,7 @@ "media/Cargo.toml": "2b3bb41264db9b9f30869015dfe0dd6656147c432728c9ea9301988c710a4202", "media-codecs/Cargo.toml": "503c8681289314b5c8a63195aad6796cbad93fcb3eedd8d7cba9e8ed0233783f", "net/Cargo.toml": "bfdb3a08200642eeeafc9762733718c407529f26dce8a7b90665bc77ac928171", + "owp/Cargo.toml": "2c1354bce16b34f0d006fc04cd4c8eb22ef91f00063b53a1113e32f475ecae33", "platform/Cargo.toml": "4181b79fa53a7ff6e8b0157f4d1ffe258737896603d267b4802551dee0812472", "play-feed/Cargo.toml": "b85320257da74a1affd81238b8fb6caa7f28960181d5ea0e07704ceef4800515", "play-uri/Cargo.toml": "107832fa33c96b7d2a4150c294aea9cd40954c3aabf66f809fc771bb52f5c280", @@ -56,7 +57,7 @@ "../.cargo/config": null, "../.cargo/config.toml": null }, - "lock": "c56af60124266be5ee0b7dfa7ae81b4f0ff38b047fe672f40a009f6e1c22d3d3", + "lock": "fae665206e8c713c34753e06eaca52d43e0eb9b7b5d10e2420e7ec33152dfe78", "grammar": { "Preference": { "prefix": [ diff --git a/ci/proofs/serde-json-immutable.json b/ci/proofs/serde-json-immutable.json index b84b7d7881..1892afbed6 100644 --- a/ci/proofs/serde-json-immutable.json +++ b/ci/proofs/serde-json-immutable.json @@ -371,9 +371,9 @@ ".cargo/config": null, ".cargo/config.toml": "82f061c716740e16cfee63a74d87159e0e0dc253e1092b87c54190c603515b14" }, - "lock_sha256": "c56af60124266be5ee0b7dfa7ae81b4f0ff38b047fe672f40a009f6e1c22d3d3", + "lock_sha256": "fae665206e8c713c34753e06eaca52d43e0eb9b7b5d10e2420e7ec33152dfe78", "manifests": { - "Cargo.toml": "c57b1c2d662d460a6d71f6de158397f1cb2f2fecb167bfa738631d77b661248b", + "Cargo.toml": "bc1d99641ae550b5ea510bb5364c971fed278358019073e5cf8fb7759ab71218", "appkit/Cargo.toml": "1e3a33f392110f269537b12f12879c6bc15309aca304b189d6b0346edf8a1186", "base/Cargo.toml": "ebe0b95553bd44f33f422f7d8e22b75ddeb53c7ee81bbe738f675690694568f7", "data/Cargo.toml": "90a763a8a9e22bda7e95f8ede4dc10ec6e92a62b90bd0fd2e622c617d75ec6c7", @@ -382,6 +382,7 @@ "media-codecs/Cargo.toml": "503c8681289314b5c8a63195aad6796cbad93fcb3eedd8d7cba9e8ed0233783f", "media/Cargo.toml": "2b3bb41264db9b9f30869015dfe0dd6656147c432728c9ea9301988c710a4202", "net/Cargo.toml": "bfdb3a08200642eeeafc9762733718c407529f26dce8a7b90665bc77ac928171", + "owp/Cargo.toml": "2c1354bce16b34f0d006fc04cd4c8eb22ef91f00063b53a1113e32f475ecae33", "platform/Cargo.toml": "4181b79fa53a7ff6e8b0157f4d1ffe258737896603d267b4802551dee0812472", "play-feed/Cargo.toml": "b85320257da74a1affd81238b8fb6caa7f28960181d5ea0e07704ceef4800515", "play-uri/Cargo.toml": "107832fa33c96b7d2a4150c294aea9cd40954c3aabf66f809fc771bb52f5c280", @@ -463,6 +464,21 @@ "lib": "net/src/lib.rs", "lib_sha256": "d9f24001852917fb61bb790e2b3276b7d7bd589a0646fb7bf10e01bbd8324755" }, + "owp/Cargo.toml": { + "dependency": [ + { + "default-features": false, + "features": [ + "alloc", + "std" + ], + "version": "1" + } + ], + "edition": "2021", + "lib": "owp/src/lib.rs", + "lib_sha256": "78e104e61b5cf3052f18139f5e922576fd7b17890c4b1e7ee0ec71f29d557e72" + }, "platform/Cargo.toml": { "dependency": [ { @@ -494,7 +510,7 @@ ], "edition": "2021", "lib": "play-feed/src/lib.rs", - "lib_sha256": "0696be5d9415fe4e8139470340ed9d92371a5bb90517baeac2ccee90eefd90f3" + "lib_sha256": "7a9ee30908c1e60048fbeba9568b4c3b32c83480b266fe9f8840a695ce215f3f" }, "play-uri/Cargo.toml": { "dependency": [ @@ -602,7 +618,7 @@ ], "edition": "2021", "lib": "ui/src/lib.rs", - "lib_sha256": "616bd784cbf479441275a483f83ed2d88df05db406731bb2ead7a8d70845e557" + "lib_sha256": "f971a02f6b5864b6858772b3c9abc1a758b119f712ca077d6dcce3a66a872017" } }, "text_hashing": "sha256-utf8-bytes-crlf-to-lf-local-root-version-v1" diff --git a/ci/readonly_dependencies.py b/ci/readonly_dependencies.py index 70f0661c9e..267d1a863e 100644 --- a/ci/readonly_dependencies.py +++ b/ci/readonly_dependencies.py @@ -18,7 +18,7 @@ import tarfile CERTIFICATE_PATH = Path(__file__).with_name('proofs') / 'serde-json-immutable.json' -CERTIFICATE_SHA256 = '29e62dc168d2691cebe44a1ce21b59d186002fed59df18bdb2c2b86d76f0497d' +CERTIFICATE_SHA256 = '915ab64bde4c59b8218471f4560136450414d8dd5e9cd671233ab79130766540' SCHEMA = 'plx.readonly.locked-json.v1' REGISTRY = 'registry+https://github.com/rust-lang/crates.io-index' SUPPORTED = ['alloc', 'arbitrary_precision', 'default', 'float_roundtrip', 'raw_value', 'std', 'unbounded_depth'] diff --git a/ci/readonly_generated.py b/ci/readonly_generated.py index 366038e9ac..d10d5c7a0b 100644 --- a/ci/readonly_generated.py +++ b/ci/readonly_generated.py @@ -13,7 +13,7 @@ from readonly_dependencies import _local_sha, _sha, _json, _manifest_paths, _configs, _workspace_hashes, WORKSPACE_HASHING CERTIFICATE_PATH = Path(__file__).with_name('proofs') / 'platform-generated-enums.json' -CERTIFICATE_SHA256 = '541c1582de8d0f1a5f575d150fb01e2c103b71916b710738f43490c0d24f3b0b' +CERTIFICATE_SHA256 = '1b3b34fa9b71d1850b8b9d569025e992440e29e2ce77d39f34d4e0b8d52c6503' SOURCES = ['platform/Cargo.toml', 'platform/src/lib.rs', 'platform/src/i18n/mod.rs', 'platform/build.rs', 'platform/build_support/catalog.rs', 'build_support/install_identities.rs', 'machine/src/lib.rs', 'machine/src/machine.rs'] diff --git a/ci/test_build_bench.py b/ci/test_build_bench.py index 9f81557d68..153089b4b3 100644 --- a/ci/test_build_bench.py +++ b/ci/test_build_bench.py @@ -108,6 +108,7 @@ def art(pkg_path, name, version): art('/media-codecs', 'plx_media_codecs', '0.0.0') art('/appkit', 'plx_appkit', '0.0.0') art('/screens', 'plx_screens', '0.0.0') + art('/owp', 'plx_owp', '0.0.0') art('', 'plxnative-modules', '0.7.0') elif args[0] == "rustc": tgt = args[args.index("--target") + 1] diff --git a/ci/test_build_not_always_dirty.py b/ci/test_build_not_always_dirty.py index cf40c440f8..416a395f5f 100644 --- a/ci/test_build_not_always_dirty.py +++ b/ci/test_build_not_always_dirty.py @@ -67,9 +67,9 @@ NIGHTLY = pinned() # the repo's one toolchain (historic name) -# The invocation `make check`'s lab line runs (Makefile, "cargo check --lib --tests -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens --features +# The invocation `make check`'s lab line runs (Makefile, "cargo check --lib --tests -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp --features # lab-diagnostics"); identical arguments and CARGO_INCREMENTAL make the first run here a reuse. -LIB_ARGS = ["check", "--lib", "--tests", "-p", "plxnative-modules", "-p", "plx_base", "-p", "plx_machine", "-p", "plx_platform", "-p", "plx_gfx", "-p", "plx_net", "-p", "plx_ui", "-p", "plx_plex", "-p", "plx_telemetry", "-p", "plx_data", "-p", "plx_session", "-p", "plx_media", "-p", "plx_playback_contract", "-p", "plx_play_uri", "-p", "plx_play_feed", "-p", "plx_media_codecs", "-p", "plx_appkit", "-p", "plx_screens", "--features", "lab-diagnostics"] +LIB_ARGS = ["check", "--lib", "--tests", "-p", "plxnative-modules", "-p", "plx_base", "-p", "plx_machine", "-p", "plx_platform", "-p", "plx_gfx", "-p", "plx_net", "-p", "plx_ui", "-p", "plx_plex", "-p", "plx_telemetry", "-p", "plx_data", "-p", "plx_session", "-p", "plx_media", "-p", "plx_playback_contract", "-p", "plx_play_uri", "-p", "plx_play_feed", "-p", "plx_media_codecs", "-p", "plx_appkit", "-p", "plx_screens", "-p", "plx_owp", "--features", "lab-diagnostics"] def cargo_env(): diff --git a/ci/test_ci_split.py b/ci/test_ci_split.py index f6e04d180c..27a4339606 100644 --- a/ci/test_ci_split.py +++ b/ci/test_ci_split.py @@ -55,9 +55,9 @@ def rule(target): # Each cargo gate, as a regex over a target's whole (comment-free) recipe, and the one target that # owns it. `lint` is a prerequisite rather than a recipe line, handled separately. GATES = { - "check-cargo-lint": [r"cargo \+\$\(RUST_TOOLCHAIN\) check --lib --tests -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens --features lab-diagnostics"], + "check-cargo-lint": [r"cargo \+\$\(RUST_TOOLCHAIN\) check --lib --tests -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp --features lab-diagnostics"], "check-cargo-unit-default": [ - r"cargo \+\$\(RUST_TOOLCHAIN\) test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens\n", + r"cargo \+\$\(RUST_TOOLCHAIN\) test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp\n", r"ci/test_storage_service_package\.py", r"test -p plxnative-storage --bin plxnative-storage", r"ci/test_storage_package_isolated\.py", diff --git a/ci/test_no_host_staticlib.py b/ci/test_no_host_staticlib.py index 14848514dc..14cbafb6b4 100644 --- a/ci/test_no_host_staticlib.py +++ b/ci/test_no_host_staticlib.py @@ -42,7 +42,7 @@ # What the workspace needs for cargo to resolve (not compile) the app package: the manifest and # lockfile, the `.cargo/config.toml` that cargo finds from the working directory, and the sources # the manifest names. A mutated copy replaces `Cargo.toml` only. -WORKSPACE_FILES = (".cargo", "Cargo.lock", "build.rs", "build_support", "src", "storage", "base", "machine", "net", "platform", "gfx", "ui", "plex", "telemetry", "data", "session", "media", "playback-contract", "play-uri", "play-feed", "media-codecs", "appkit", "screens") +WORKSPACE_FILES = (".cargo", "Cargo.lock", "build.rs", "build_support", "src", "storage", "base", "machine", "net", "platform", "gfx", "ui", "plex", "telemetry", "data", "session", "media", "playback-contract", "play-uri", "play-feed", "media-codecs", "appkit", "screens", "owp") def offences(unit_graph=None, metadata=None): diff --git a/ci/test_test_fast.py b/ci/test_test_fast.py index a9722e5955..55df29c71d 100644 --- a/ci/test_test_fast.py +++ b/ci/test_test_fast.py @@ -162,7 +162,7 @@ def test_incremental_in_its_own_target_dir_and_forwards_the_filter(self): self.assertEqual(call["target_dir"], TDIR) self.assertTrue(call["cwd"].endswith("rust-modules"), call["cwd"]) self.assertEqual(call["runtime_dir_set"], "yes") - self.assertRegex(call["args"], r"^\+\S+ test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens --no-run --message-format=json-render-diagnostics$") + self.assertRegex(call["args"], r"^\+\S+ test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp --no-run --message-format=json-render-diagnostics$") # The filter goes to each test binary (the runner builds first, then runs), not to cargo. self.assertEqual(len(fake.bin_calls()), call["args"].split().count("-p")) self.assertTrue(all(line.endswith("args=route::") for line in fake.bin_calls()), fake.bin_calls()) @@ -171,7 +171,7 @@ def test_no_filter_runs_the_whole_default_feature_suite(self): with FakeCargoHome() as fake: self.assertEqual(fake.run("test-fast").returncode, 0) (call,) = fake.calls() - self.assertRegex(call["args"], r"^\+\S+ test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens --no-run --message-format=json-render-diagnostics$") + self.assertRegex(call["args"], r"^\+\S+ test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp --no-run --message-format=json-render-diagnostics$") self.assertNotIn("--features", call["args"]) self.assertEqual(len(fake.bin_calls()), call["args"].split().count("-p")) self.assertTrue(all(line.endswith("args=") for line in fake.bin_calls()), fake.bin_calls()) diff --git a/ci/test_transition_arguments.py b/ci/test_transition_arguments.py index 59c3a83ec2..f0710b543a 100644 --- a/ci/test_transition_arguments.py +++ b/ci/test_transition_arguments.py @@ -96,11 +96,11 @@ def read(path, *args, **kwargs): return source if path.resolve() == target else old(path, *args, **kwargs) with patch.object(Path, 'read_text', read): problems, report = gate.check(ROOT / 'rust-modules', ROOT / 'ci/machines.ini') - self.assertEqual(sum(line.startswith('machine ') for line in report), 10) + self.assertEqual(sum(line.startswith('machine ') for line in report), 11) self.assertTrue(any('unbound transition argument' in p for p in problems), problems) def test_every_cohort_machine_rejects_unbound_arguments(self): - self.assertEqual(len(ENTRIES), 10) + self.assertEqual(len(ENTRIES), 11) for section in ENTRIES: for extra in ('next: RawState', 'renamed: RawAlias', 'ctx: Context', 'extra: u64', 'next: &RawState', 'next: &mut RawState', 'cb: fn(RawState)', @@ -200,7 +200,7 @@ def test_actual_session_tick_and_entire_cohort(self): source = (ROOT / 'rust-modules/session/src/auth/owner.rs').read_text(encoding='utf-8') self.assertIn('tick_ms: u32', source) problems, report = gate.check(ROOT / 'rust-modules', ROOT / 'ci/machines.ini') - self.assertEqual(sum(line.startswith('machine ') for line in report), 10) + self.assertEqual(sum(line.startswith('machine ') for line in report), 11) self.assertEqual(problems, []) diff --git a/docs/agent-reference.md b/docs/agent-reference.md index 12e8e5edf8..2b349f596b 100644 --- a/docs/agent-reference.md +++ b/docs/agent-reference.md @@ -221,10 +221,10 @@ the pinned Sentry Native cross-build), and `sshpass` (Homebrew; deploy/run use y what the user can reach, which is the only class that is tracked rather than accepted; `--sites` lists every hit with its class. CI runs the three cargo targets plus those two as five parallel jobs (`host-lint`, `host-unit-default`, `host-unit-hostsim`, `host-python`, `host-python-harness`) behind an aggregator named - `host checks (NOT a device gate)`; `ci/test_ci_split.py` pins that no gate falls between them. The cargo half runs `cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens` + `host checks (NOT a device gate)`; `ci/test_ci_split.py` pins that no gate falls between them. The cargo half runs `cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp` **on the default feature set, and again with `--features hostsim` for the crates that declare it (`HOSTSIM_SUITE`: all of `UNIT_SUITE` except `plx_net`, `plx_ui`, `plx_appkit`, `plx_screens`, - `plx_media_codecs`, `plx_play_uri` and `plx_playback_contract`, which have no `hostsim` cfg and run the + `plx_media_codecs`, `plx_play_uri`, `plx_playback_contract` and `plx_owp`, which have no `hostsim` cfg and run the same test names in both passes; `ci/test_test_crate.py` fails if one gains the feature or a cfg)**, which is not a duplicate run. The host feed seam (`play-feed/src/ffi_host.rs`) exists ONLY in the hostsim configuration, so every test that drives an access unit through `sf_feed` is compiled out of the @@ -267,7 +267,7 @@ the pinned Sentry Native cross-build), and `sshpass` (Homebrew; deploy/run use y SDL event loop where no host test can see it. Needs the **clippy component of the pinned toolchain** (`make setup-rust` installs it with `--profile minimal --component clippy`). - `make test-fast [T=filter]` — **opt-in** incremental inner loop: the same default-feature - `cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens` as `check-cargo-unit-default` (throwaway runtime root, telemetry env), but + `cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp` as `check-cargo-unit-default` (throwaway runtime root, telemetry env), but with `CARGO_INCREMENTAL=1` in its own `rust-modules/target-fast` (gitignored). `T=route::` is the test-name filter, handed to every one of the per-crate test binaries; each prints its own libtest `test result:` line (the counts are per crate, never one total), followed by the wrapper's summary line. Use it for a long series of @@ -338,8 +338,10 @@ the pinned Sentry Native cross-build), and `sshpass` (Homebrew; deploy/run use y `bundle_read`, `archive_read` (the 1.0 ZIP container), `svg_check` (the SVG gate in front of nanosvg), `address_parse`, `catalog_parse` (the registry index), `catalog_verify` (the signed index: no input is accepted under the shipped keys; the fuzzer's bytes are also signed with the data layer's TEST ONLY keys to reach what - follows the signature check), `catalog_cache` (its cache record, verified again) and `ws_frame` (the - WebSocket codec, `plx_net::ws`: the server's upgrade answer and frames, split at any byte). Each target + follows the signature check), `catalog_cache` (its cache record, verified again), `ws_frame` (the + WebSocket codec, `plx_net::ws`: the server's upgrade answer and frames, split at any byte) and `owp_json` + (the Open Watch Party reader, `plx_owp::json`: the scan keeps the length, and the visitor marks the same strings + and numbers as the scan). Each target asserts only what its code promises (no panic, the documented bounds, round trips) and a crash fails the run, with the input in `fuzz/artifacts//`. The package is a top-level `fuzz/` with its own `[workspace]`, so no shipped `Cargo.toml` names it and no shipped build changes; it depends on the layer @@ -349,7 +351,7 @@ the pinned Sentry Native cross-build), and `sshpass` (Homebrew; deploy/run use y (the shared crates are exactly the shipped versions), builds with the nightly named by `FUZZ_TOOLCHAIN` (default `nightly`; CI names a dated one; `cargo install cargo-fuzz --locked` once) in `rust-modules/target-fuzz` (3.1 GiB after a cold build of the first eight targets, plus 83 MiB for - `ws_frame`; `make disk` lists it), generates the seeds from + `ws_frame` and 49 MiB for `owp_json`; `make disk` lists it), generates the seeds from the fixtures, the examples and the icons the repository already has plus a dictionary from the published schemas, and runs the targets one after another. A corpus is thousands of tiny files read and written all run long: on a slow or shared disk (the external one a lane may sit on) set `FUZZ_WORK=` to move seeds, @@ -381,12 +383,12 @@ the pinned Sentry Native cross-build), and `sshpass` (Homebrew; deploy/run use y - **CI build health** — four tools keep the build from growing unnoticed, and none of them is a device gate. - *Timings artifact.* `host-unit-default` compiles the test binary in its own step with - `cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens --no-run --timings`, then `make check-cargo-unit-default` runs against what that + `cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp --no-run --timings`, then `make check-cargo-unit-default` runs against what that built (`--timings` is not part of cargo's fingerprint: checked 2026-10-02 by building with and without it and getting `Fresh` for `plxnative-modules` both ways, so the step moves the compile rather than adding one). Download `cargo-timings-host-unit-default` from the run page ("Artifacts", kept 14 days) and open `cargo-timing.html`: it names the crates on the critical - path. Locally: `cd rust-modules && cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens --no-run --timings` writes + path. Locally: `cd rust-modules && cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp --no-run --timings` writes `target/cargo-timings/cargo-timing.html`. - *Trends.* `tools/ci-durations.py [--runs 30] [--recent 5] [--json]` reads the last 30 successful `main` runs of CI and Simulator CI through `gh api` and prints, per job, the median and p90 and @@ -462,7 +464,7 @@ the pinned Sentry Native cross-build), and `sshpass` (Homebrew; deploy/run use y before/after table instead of an ad-hoc scratch-script number. It prints a Markdown table (median / min / max over `--runs`, default 3, the scenarios interleaved round by round) and, with `--json`, a machine-readable document (git sha, `rustc -V` of the pinned toolchain, host, per-run load and swap). Rows: - a **no-op** host test build (`cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens --no-run`; it reports from cargo's JSON `fresh` + a **no-op** host test build (`cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp --no-run`; it reports from cargo's JSON `fresh` flag whether the app crate was rebuilt and flags a recompile as UNEXPECTED, the `ci/test_build_not_always_dirty.py` hazard); an **edit-rebuild** after appending a comment to a leaf file of each crate (`plx_base`'s `cbuf.rs`, `plx_machine`'s `landgate.rs`, `plx_platform`'s `devcaps.rs`, `plx_gfx`'s `overdraw.rs`, `plx_net`'s `stream_redirect.rs`, `plx_ui`'s `dwell.rs`, `plx_plex`'s `retry.rs`, `plx_telemetry`'s `window.rs`, `plx_data`'s `tape.rs`, `plx_session`'s `scripted.rs`, `plx_media`'s `units.rs`, `plx_appkit`'s `skip_pill.rs`, `plx_screens`'s `clock_readout.rs`, the application's `coldstart.rs`) and to a hub (`plx_ui`'s `lib.rs`), non-incremental (`CARGO_INCREMENTAL=0`, the @@ -942,7 +944,7 @@ the pinned Sentry Native cross-build), and `sshpass` (Homebrew; deploy/run use y else's checkout. It type-checks the bare `--no-default-features` set, which drops `play-uri` and `play-feed` too (a build with no playback backend), so it does not replace `make check-nodef`, which passes the Makefile's `RUST_BACKEND_FEATURES`. It type-checks after every edit to a `rust-modules/src/**.rs` or one of the thirteen layer crates it lists (it does not watch `playback-contract`, `media-codecs`, - `play-feed` or `play-uri`; `make check-nodef` is the only gate that compiles them in the shipping set); it costs well under a second warm, because cargo keys + `play-feed` or `play-uri`, for which `make check-nodef` is the only gate that compiles them in the shipping set, nor `owp`, which the application does not link yet); it costs well under a second warm, because cargo keys fingerprints by feature set and the two configurations coexist in one `target/`. The hazard it guards is hand-written `#[cfg(feature = "devtriggers")]` PAIRS, where a spliced-in function swallows a neighbour's attribute — `devtrig::latched_flag!` exists to avoid most of them. @@ -1948,7 +1950,7 @@ behaviour; real GL copies, glyphs and presentation still need a device capture w There **is** a host unit suite, and it is not the real gate — both halves matter, and conflating them is how this section used to be wrong in three files at once. -**Tier 1 — `make check` (host).** `cd rust-modules && cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens` (a bare `cargo test --lib` runs the application crate only and skips every layer crate: `plx_base`, `plx_machine`, `plx_platform`, `plx_gfx`, `plx_net`, `plx_ui`, `plx_plex`, `plx_telemetry`, `plx_data`, `plx_session`, `plx_media`, `plx_appkit`, `plx_screens`) runs the whole +**Tier 1 — `make check` (host).** `cd rust-modules && cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp` (a bare `cargo test --lib` runs the application crate only and skips every layer crate: `plx_base`, `plx_machine`, `plx_platform`, `plx_gfx`, `plx_net`, `plx_ui`, `plx_plex`, `plx_telemetry`, `plx_data`, `plx_session`, `plx_media`, `plx_appkit`, `plx_screens`) runs the whole host suite on the dev Mac, no TV involved — and `make check` runs the crates that declare `hostsim` (`HOSTSIM_SUITE`, a subset of that list) a SECOND time under `--features hostsim`, because the host feed seam only exists there and the tests that need it are compiled out of the first pass (the build @@ -1958,7 +1960,7 @@ documented 59 before that, which was five times stale before anyone noticed — of this paragraph was stale within one *commit*, because two agents were adding tests to the same batch that documented it. Three numbers have now rotted here, so do not add a fourth: the only count worth having is the one you take yourself, with -`cd rust-modules && cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -- --list | grep -c ': test'`. **The per-module counts +`cd rust-modules && cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp -- --list | grep -c ': test'`. **The per-module counts below have the same disease and are worse**, because a stale one reads as precise rather than round — several were written when the module was a third its present size, and two bullets have now outlived the file they named: `ui/home.rs` (retired to `screens/home/`) and `route.rs` (split in diff --git a/docs/lab-diagnostics.md b/docs/lab-diagnostics.md index 3228f7a1c2..0153875b59 100644 --- a/docs/lab-diagnostics.md +++ b/docs/lab-diagnostics.md @@ -441,7 +441,7 @@ not pretending the old filesystem contract exists. * `make check` is green in both configurations. **Take the counts yourself** — this repository has rotted four written test counts already and the fifth is not going to be this one: - `cd rust-modules && cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -- --list | grep -c ': test'`, with and without + `cd rust-modules && cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp -- --list | grep -c ': test'`, with and without `--features lab-diagnostics`. What the feature's own tests cover: the ring's two caps and its `dropped` delta, the `lab.json` parse and each refusal it names, the five scrub rewrites and the outright refusal (including the bare address and the household name the device test found), the diff --git a/docs/module-layers.md b/docs/module-layers.md index 7acababeac..29b45aa876 100644 --- a/docs/module-layers.md +++ b/docs/module-layers.md @@ -108,6 +108,7 @@ play_feed net playback_contract media_codecs + plat play_uri playback_contract + platform base media_codecs playback_contract + base playback_contract + base +owp platform machine base machine base base @@ -181,6 +182,14 @@ Experimental: `media::route::uri_preflight::ProductQualifier` answers `Unknown` Standard would not direct-play (the plan's own `StandardDirectPlay` verdicts for the video, Dolby Vision, audio and container, not the server's decision, which the offer precedes), and for a converted PMS output. `ci/check-deps.sh` reads the whole crate for the same IO and clock gates as every other layer. +`owp` is a nineteenth layer, declared the same way. Its crate is `plx_owp` (`rust-modules/owp/`); it +names no other layer and no `plx_*` crate, so it can be used on its own: the Open Watch Party client protocol, sans-IO. It holds the JSON reader that keeps +unpaired surrogate escapes visible to the checks, the message codec, the checks on names, room codes, the +relay list, descriptors and room snapshots, the clock sync and the room timeline, each run against the +vendored conformance vectors in `rust-modules/owp/fixtures/`. The WebSocket under it is `plx_net::ws`; the +application does not name the crate yet. `ci/check-deps.sh` reads the whole crate for the same IO and clock +gates as every other layer, and as machine code. + The Watchlist adds two data modules and no new edge. `watchlist` (rows, match table, `TileState`, intent ledger, comparator; with `stores::watchlist`) and `catalog` (the Discover-only item page; with `stores::catalog`) name only layers below data, chiefly `plx_plex`: `plex::watchlist`, `Client::find_by_guids`, `plex::session` diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 6ce57a3605..75bb12169e 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -1,6 +1,6 @@ # The `cargo fuzz` package over every parser a HUD package or the registry reaches (PR16 of the -# player-HUD plugin series; docs/hud-plugins.md, "Trust and safety"), and over the WebSocket codec -# (`plx_net::ws`). It ships nothing and changes no +# player-HUD plugin series; docs/hud-plugins.md, "Trust and safety"), over the WebSocket codec +# (`plx_net::ws`) and over the Open Watch Party reader (`plx_owp::json`). It ships nothing and changes no # shipped build. # # WHERE IT LIVES. A top-level `fuzz/`, with a `[workspace]` of its own: it is not a member of the @@ -10,7 +10,7 @@ # tree (`ci/check-module-layers.py`, `ci/check-deps.sh`, `ci/check-list-caps.py`) and its binaries # would need an `exclude`; here they cannot see it. # -# WHAT IT FUZZES. The parsers of `plx_appkit` (`hud_format`), `plx_data` (`hudpacks`) and `plx_net` (`ws`), +# WHAT IT FUZZES. The parsers of `plx_appkit` (`hud_format`), `plx_data` (`hudpacks`), `plx_net` (`ws`) and `plx_owp` (`json`), # built in the host-simulator configuration: `hostsim`, the only one a host executable can link (the television build # declares the LS2, glib and ACB symbols only the TV's own libraries define). The parsers have no `cfg` # on that feature (`rust-modules/Cargo.toml`, "What it changes, and nothing else"), and nothing here @@ -25,7 +25,7 @@ name = "plxnative-fuzz" version = "0.0.0" edition = "2021" license = "GPL-3.0-or-later" -description = "Fuzz targets over the HUD package, bundle, SVG, address and registry-index parsers and the WebSocket codec. Not shipped." +description = "Fuzz targets over the HUD package, bundle, SVG, address and registry-index parsers, the WebSocket codec and the Open Watch Party reader. Not shipped." repository = "https://github.com/GLinnik21/plx-native" publish = false build = "build.rs" @@ -41,6 +41,7 @@ plx_base = { path = "../rust-modules/base" } plx_appkit = { path = "../rust-modules/appkit" } plx_data = { path = "../rust-modules/data" } plx_net = { path = "../rust-modules/net" } +plx_owp = { path = "../rust-modules/owp" } # The registry-index targets sign with TEST ONLY keys (`src/signing.rs`) to reach what follows the signature # check. The same version and features as `plx_data`, so the lock gains nothing. ed25519-compact = { version = "=2.6.1", default-features = false, features = ["opt_size"] } @@ -114,3 +115,10 @@ path = "fuzz_targets/ws_frame.rs" test = false doc = false bench = false + +[[bin]] +name = "owp_json" +path = "fuzz_targets/owp_json.rs" +test = false +doc = false +bench = false diff --git a/fuzz/fuzz_targets/owp_json.rs b/fuzz/fuzz_targets/owp_json.rs new file mode 100644 index 0000000000..862850d68a --- /dev/null +++ b/fuzz/fuzz_targets/owp_json.rs @@ -0,0 +1,63 @@ +#![no_main] +use libfuzzer_sys::fuzz_target; +use plx_owp::json::{read, scanned, Json, DISAGREEMENT}; +use plx_owp::message::decode; +use plxnative_fuzz as _; + +#[derive(Default)] +struct Seen { + strings: usize, + marked: Vec, + numbers: usize, + overflowing: Vec, +} + +impl Seen { + fn string(&mut self, unpaired: bool) { + if unpaired { + self.marked.push(self.strings); + } + self.strings += 1; + } + + fn number(&mut self, infinite: bool) { + if infinite { + self.overflowing.push(self.numbers); + } + self.numbers += 1; + } + + fn walk(&mut self, value: &Json) { + match value { + Json::Str(text) => self.string(text.unpaired), + Json::Int(_) => self.number(false), + Json::Float(number) => self.number(number.is_infinite()), + Json::Array(items) => items.iter().for_each(|item| self.walk(item)), + Json::Object(members) => members.iter().for_each(|(key, value)| { + self.string(key.unpaired); + self.walk(value); + }), + Json::Null | Json::Bool(_) => {} + } + } +} + +fuzz_target!(|data: &[u8]| { + let Ok(input) = std::str::from_utf8(data) else { return }; + let scan = scanned(input).expect("the scan broke the UTF-8 of its input"); + assert_eq!(scan.length, input.len(), "the scan changed the length"); + let _ = decode(input); + let read = read(input); + if let Err(error) = &read { + assert_ne!(error.to_string(), DISAGREEMENT, "the scan and the visitor disagree on {input:?}"); + } + if serde_json::from_str::(input).is_ok() { + assert!(read.is_ok(), "serde_json reads {input:?} and the reader does not"); + assert!(scan.marked.is_empty(), "marks on {input:?}, which serde_json reads"); + } + let Ok(read) = read else { return }; + let mut seen = Seen::default(); + seen.walk(&read.value); + assert_eq!(seen.marked, scan.marked, "the visitor marked other strings than the scan"); + assert_eq!(seen.overflowing, scan.overflowing, "the visitor made other numbers infinite than the scan"); +}); diff --git a/rust-modules/Cargo.lock b/rust-modules/Cargo.lock index 565efd4d00..636b27a366 100644 --- a/rust-modules/Cargo.lock +++ b/rust-modules/Cargo.lock @@ -860,6 +860,14 @@ dependencies = [ "serde_json", ] +[[package]] +name = "plx_owp" +version = "0.0.0" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "plx_platform" version = "0.0.0" diff --git a/rust-modules/Cargo.toml b/rust-modules/Cargo.toml index a9912a2090..f80fd1bece 100644 --- a/rust-modules/Cargo.toml +++ b/rust-modules/Cargo.toml @@ -1,5 +1,5 @@ # A cargo workspace with this package as its ROOT; the other members are the storage helper and the -# layer crates split out of the application (everything under `rust-modules/*/` with a `[package.metadata.plx] mount`: base/, machine/, net/, platform/, gfx/, ui/, plex/, telemetry/, data/, session/, media/, play-feed/, appkit/, screens/ and the contract and codec crates; +# layer crates split out of the application (everything under `rust-modules/*/` with a `[package.metadata.plx] mount`: base/, machine/, net/, platform/, gfx/, ui/, plex/, telemetry/, data/, session/, media/, play-feed/, appkit/, screens/, owp/ and the contract and codec crates; # docs/module-layers.md). # The root keeps the literal `version` below (release tooling reads it), `make`/CI run their usual # commands from this directory against this package (a bare `cargo test`/`check`/`build` here still @@ -25,6 +25,7 @@ members = [ "media-codecs", "appkit", "screens", + "owp", "storage", ] resolver = "2" diff --git a/rust-modules/owp/Cargo.toml b/rust-modules/owp/Cargo.toml new file mode 100644 index 0000000000..71de1785d4 --- /dev/null +++ b/rust-modules/owp/Cargo.toml @@ -0,0 +1,22 @@ +[package] +name = "plx_owp" +version = "0.0.0" +edition = "2021" +license = "Apache-2.0" +description = "Open Watch Party client protocol for PlxNative, sans-IO: the JSON reader, messages, checks, clock sync and the room timeline." +repository = "https://github.com/GLinnik21/plx-native" +publish = false + +[package.metadata.plx] +mount = "owp" + +[lib] +name = "plx_owp" +crate-type = ["rlib"] + +[dependencies] +serde = { version = "1", default-features = false, features = ["alloc"] } +serde_json = { version = "1", default-features = false, features = ["alloc", "std"] } + +[lints] +workspace = true diff --git a/rust-modules/owp/fixtures/LICENSE b/rust-modules/owp/fixtures/LICENSE new file mode 100644 index 0000000000..57bc88a15a --- /dev/null +++ b/rust-modules/owp/fixtures/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. + diff --git a/rust-modules/owp/fixtures/README.md b/rust-modules/owp/fixtures/README.md new file mode 100644 index 0000000000..b193727902 --- /dev/null +++ b/rust-modules/owp/fixtures/README.md @@ -0,0 +1,64 @@ +# Open Watch Party fixtures + +Copied unchanged from [edde746/openwatchparty](https://github.com/edde746/openwatchparty) at revision +`d8c3c2abc753c0486c955f39e020258c166b93d8`, under the Apache License 2.0 in `LICENSE`. The tests in `src/vectors.rs` read them; +`relays.json` is also the public relay list the crate embeds. + +| file | upstream path | sha256 | +|---|---|---| +| `LICENSE` | `LICENSE` | `c95bae1d1ce0235ecccd3560b772ec1efb97f348a79f0fbe0a634f0c2ccefe2c` | +| `examples/invalid/descriptor.duplicate-key-in-ext.json` | `spec/examples/invalid/descriptor.duplicate-key-in-ext.json` | `d2d6cf226b3d3c64af3726bda357dfbab01ec12a2f0e4864afd5192ed1144bd8` | +| `examples/invalid/descriptor.duration-past-max.json` | `spec/examples/invalid/descriptor.duration-past-max.json` | `76f6f152c90625f5c983195026abfadd6a08435180dcee2c4bf14c42e8e6c02d` | +| `examples/invalid/descriptor.duration-zero.json` | `spec/examples/invalid/descriptor.duration-zero.json` | `d6324ae05e763d8834ef7162d84a57642de261d654f52837b6bcb80f4a31eeb5` | +| `examples/invalid/descriptor.ext-key-lone-surrogate.json` | `spec/examples/invalid/descriptor.ext-key-lone-surrogate.json` | `4f4ad891884bb556daafb8bebfa4d87e395700d3afc7e0d13d0d3369bfcfdaac` | +| `examples/invalid/descriptor.ext-key-not-reverse-dns.json` | `spec/examples/invalid/descriptor.ext-key-not-reverse-dns.json` | `1564bc07ba18ec92c49473d511d93bd02084d390ea604fbbd84bf8ccc19967e1` | +| `examples/invalid/descriptor.ext-too-large.json` | `spec/examples/invalid/descriptor.ext-too-large.json` | `20405b9643727bf1673f1ef2209ee46f5f9ecd9f442180cf5513369c1e445188` | +| `examples/invalid/descriptor.file-name-backslash.json` | `spec/examples/invalid/descriptor.file-name-backslash.json` | `0a1e6dc3134297a85df440e5eaa54af0affde1c9fce1ff07f902612f6810d7d5` | +| `examples/invalid/descriptor.file-name-dot.json` | `spec/examples/invalid/descriptor.file-name-dot.json` | `490999a5ae8b6f0af0a51a0d488be849a4a1e3761bfab6f8094a5dc2e6205258` | +| `examples/invalid/descriptor.file-name-dotdot.json` | `spec/examples/invalid/descriptor.file-name-dotdot.json` | `640a360b5fb63f0a902c24ab9932597f2b419214466d7693c6ef7bf704bada7e` | +| `examples/invalid/descriptor.file-name-nul.json` | `spec/examples/invalid/descriptor.file-name-nul.json` | `9582a9157529f4700a3a5776d91a224a4d9c9a10e7f44417343fc74f6ed4e94e` | +| `examples/invalid/descriptor.file-name-rlo.json` | `spec/examples/invalid/descriptor.file-name-rlo.json` | `4a72899dbe4c2f14002869503522ee83675cfb1d3939a226adb924bd42cc9fd5` | +| `examples/invalid/descriptor.file-name-slash.json` | `spec/examples/invalid/descriptor.file-name-slash.json` | `fa143a5eac23548733cec83a32da6ebcac5fd1a2c1557dc7ce36762d186a32b4` | +| `examples/invalid/descriptor.id-number.json` | `spec/examples/invalid/descriptor.id-number.json` | `6013045aea7808b7cb3c42b8bcb72bdb5fd05516438bad7757e85c1ca064a467` | +| `examples/invalid/descriptor.kind-unknown.json` | `spec/examples/invalid/descriptor.kind-unknown.json` | `0aa87033e3ea8f78aceae43a29d6265551baf220ad975a3466c2023b9f0386e3` | +| `examples/invalid/descriptor.oshash-uppercase.json` | `spec/examples/invalid/descriptor.oshash-uppercase.json` | `d33efd0c332b444c80333f043451a328014682b99fccdacb5a09c0cb8887839a` | +| `examples/invalid/descriptor.series-title-left-to-right-mark.json` | `spec/examples/invalid/descriptor.series-title-left-to-right-mark.json` | `4549a27f8cbbb8a3c14b109763023499ac02c69ab6c1d6b5efe43b9db5c4c948` | +| `examples/invalid/descriptor.series-without-title.json` | `spec/examples/invalid/descriptor.series-without-title.json` | `79078c631e6ccf93d04e09901ef58503732e50b38374b23a5bf75cca44555124` | +| `examples/invalid/descriptor.title-bidi-isolate.json` | `spec/examples/invalid/descriptor.title-bidi-isolate.json` | `1792a9ab863650f93179f19abb9b62c4ed08a234b3467216b61da3cd04c70e2d` | +| `examples/invalid/descriptor.title-c1-control.json` | `spec/examples/invalid/descriptor.title-c1-control.json` | `2bc257118427e0e2e2576cc272f17b4e83a3fdbfb648dca476a8e422cf3e03e3` | +| `examples/invalid/descriptor.title-empty.json` | `spec/examples/invalid/descriptor.title-empty.json` | `ef113cc8c8ef5ef9cf77a177886b519c4a39e009dbfca177fb1cf068ad576f9a` | +| `examples/invalid/descriptor.title-newline.json` | `spec/examples/invalid/descriptor.title-newline.json` | `28dbdf1969040cc1a2d8640b592302f77a4216079915186ae763f660e1e67927` | +| `examples/invalid/descriptor.too-large.json` | `spec/examples/invalid/descriptor.too-large.json` | `8862a3dff370a2fe23f353d444e6b22f6c3397436e466ca4ed5101d30bd01057` | +| `examples/invalid/setMedia.duplicate-escaped-key.json` | `spec/examples/invalid/setMedia.duplicate-escaped-key.json` | `eb6417a0a43cc00dfb4e4a2ddabda0e214530448e06b74557cc2dafb5cc5da46` | +| `examples/invalid/setMedia.duplicate-key-in-media.json` | `spec/examples/invalid/setMedia.duplicate-key-in-media.json` | `7049622eec4de619744cd8539e0d9fc5763b987d3e2db01ae8c43235227b2614` | +| `examples/invalid/setMedia.duration-past-max.json` | `spec/examples/invalid/setMedia.duration-past-max.json` | `326e7c1fffac16fde6d748d76ff6ab237559cb7f5bea2a661807e251966ab984` | +| `examples/invalid/setMedia.episode-without-series.json` | `spec/examples/invalid/setMedia.episode-without-series.json` | `0c6461cff87b63ba02ed0e113b784d9c8c3bea62efbcd7335860e38e2053a050` | +| `examples/invalid/setMedia.file-name-traversal.json` | `spec/examples/invalid/setMedia.file-name-traversal.json` | `07089335ea3e7d9f128bb4c408e0f9d7cdf6fab1f8c8d1a76774d648792b10c9` | +| `examples/invalid/setMedia.media-half-emoji.json` | `spec/examples/invalid/setMedia.media-half-emoji.json` | `2697ee65e7d9aadf3bd90b59cf44317c0e463808737bb884d8940233bbcbb888` | +| `examples/invalid/setMedia.media-invalid-utf8.json` | `spec/examples/invalid/setMedia.media-invalid-utf8.json` | `65b65e8530de6a2bc89f50c7d1d54e65fb7d772aaff3bb5d9d577cc7244feeb8` | +| `examples/invalid/setMedia.media-null.json` | `spec/examples/invalid/setMedia.media-null.json` | `5cfce2d53f6f219b31a3b437126caaa7a38e7bd1e24604cc545d44cbd32f0b9d` | +| `examples/invalid/setMedia.media-too-large.json` | `spec/examples/invalid/setMedia.media-too-large.json` | `64cfe9f47273f44dd053a751b0834fb1e54b4030ac3dffe0019fae7b6c07f4f9` | +| `examples/invalid/setMedia.media-without-duration.json` | `spec/examples/invalid/setMedia.media-without-duration.json` | `21fb22618d092894b49adc6f37fd8bfac9184942ab94d3a87b36dbb2620ec954` | +| `examples/invalid/setMedia.missing-media.json` | `spec/examples/invalid/setMedia.missing-media.json` | `0ff4a7b50094446287770cb64a2c8e27e4f90e3086acca4f464ab735419556c2` | +| `examples/valid/descriptor.duration-max.json` | `spec/examples/valid/descriptor.duration-max.json` | `d0270a2eb5ef659754cdef91b9c86ad7d41799d9d20e3992b43aab194c0bd18f` | +| `examples/valid/descriptor.episode-app-ids.json` | `spec/examples/valid/descriptor.episode-app-ids.json` | `c858f11e0a8bdb130f131ec19b327f82239f1153993daacdf8c38bb1c4339d7d` | +| `examples/valid/descriptor.episode.json` | `spec/examples/valid/descriptor.episode.json` | `0a005cfc39ecc6a1173c428a2eff94c89d6d1dbb2ed6b4ea2fbee4ac16919426` | +| `examples/valid/descriptor.file-name-hidden.json` | `spec/examples/valid/descriptor.file-name-hidden.json` | `b5a48276ee7d158f3458d7e92793027488bfdfa0863dee5c0f87b66c60b63989` | +| `examples/valid/descriptor.file-name-leading-dots.json` | `spec/examples/valid/descriptor.file-name-leading-dots.json` | `d19fdff0de81718c6ca5d615b70c6cf90c533eb2f26aa5edf0062464468da4d7` | +| `examples/valid/descriptor.minimal.json` | `spec/examples/valid/descriptor.minimal.json` | `3b5b251f9e3aabd19577dc286daa7bb78b20d015bce4b6e418db4a66effd1120` | +| `examples/valid/descriptor.movie.json` | `spec/examples/valid/descriptor.movie.json` | `2faaed302935c6448213c30adfcc60a47124b4525ebb5f3038234b78bf8756c4` | +| `examples/valid/descriptor.title-emoji-zwj.json` | `spec/examples/valid/descriptor.title-emoji-zwj.json` | `34a6744cbd0901b950fc2d5ff0123ee3ce43360905f25c6be95ebb530fd2f30e` | +| `examples/valid/descriptor.title-rtl-script.json` | `spec/examples/valid/descriptor.title-rtl-script.json` | `bb084aafc878e2b21de9a345d6bd43b7f6782ddb08b4ad593d00ebfff5d23279` | +| `examples/valid/descriptor.unknown-namespace.json` | `spec/examples/valid/descriptor.unknown-namespace.json` | `a6e9ba3eaa859f531809403a53a5999853b50c46eb81066ea84a1150f92385da` | +| `examples/valid/descriptor.video.json` | `spec/examples/valid/descriptor.video.json` | `60eca50283e82c98b7a118764b7235ebdc6a26964791226375c2b81b4796f0ac` | +| `examples/valid/setMedia.episode.json` | `spec/examples/valid/setMedia.episode.json` | `6a99452e366525d3226e14b28f3df4325a7d1232312b515dfa33f44c1d41e82b` | +| `examples/valid/setMedia.movie-at-position.json` | `spec/examples/valid/setMedia.movie-at-position.json` | `d6130b2928ccf0137e40d2764d846f1c88f964e19291e8a7cd094f4cca35e702` | +| `relays.json` | `relays.json` | `755585e878bb9290b0461ecd9e863e79e85cb09d962bd00e37ada9e201e6a1a3` | +| `vectors/clock-sync.json` | `conformance/vectors/clock-sync.json` | `3bd79ab3481c268322def5940137258c8e9a2e2788a12f176d6d04ed36d52991` | +| `vectors/code-routing.json` | `conformance/vectors/code-routing.json` | `11192c267fe46165d7939afd089a140c069232149a77e3d90afdd55da3cb78e1` | +| `vectors/media-check.json` | `conformance/vectors/media-check.json` | `c20ac0be6676e073f2b88f0475e0335862db88ee4361961ff0f4e746842f2a11` | +| `vectors/names.json` | `conformance/vectors/names.json` | `9193de5a447f3cba67f2aaffb48efbe1932df17030f14bce1bf2b8dd72eb7bf2` | +| `vectors/relay-list.json` | `conformance/vectors/relay-list.json` | `d8f962bbb6e129ce2a71dcc2e893090c0a913475e04a877a276bbc77e930686e` | +| `vectors/room-check.json` | `conformance/vectors/room-check.json` | `6b903bc22e8f861d924e57b8508e79b3924a1d72050f65867617308537498b70` | +| `vectors/same-title.json` | `conformance/vectors/same-title.json` | `2b449084b1a459a0bdc1ef20bddec4302597bd3bf552d37cf6ca08fff47be658` | +| `vectors/timeline.json` | `conformance/vectors/timeline.json` | `82095be784247d104cc2cc845a17ddaa937e0270723af3e0aab977e2545566cd` | diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.duplicate-key-in-ext.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.duplicate-key-in-ext.json new file mode 100644 index 0000000000..861ab57e41 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.duplicate-key-in-ext.json @@ -0,0 +1,11 @@ +{ + "kind": "movie", + "title": "Arrival", + "durationMs": 6960000, + "ext": { + "com.example": { + "server": "1a2b3c", + "server": "9z8y7x" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.duration-past-max.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.duration-past-max.json new file mode 100644 index 0000000000..b56727543a --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.duration-past-max.json @@ -0,0 +1,6 @@ +{ + "kind": "movie", + "title": "Shoah", + "year": 1985, + "durationMs": 604800001 +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.duration-zero.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.duration-zero.json new file mode 100644 index 0000000000..23fb2b847b --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.duration-zero.json @@ -0,0 +1,15 @@ +{ + "kind": "movie", + "title": "Arrival", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "durationMs": 0, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.ext-key-lone-surrogate.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.ext-key-lone-surrogate.json new file mode 100644 index 0000000000..45db5ca257 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.ext-key-lone-surrogate.json @@ -0,0 +1,10 @@ +{ + "kind": "movie", + "title": "Arrival", + "durationMs": 6960000, + "ext": { + "com.example": { + "it\uDBFFem": "4711" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.ext-key-not-reverse-dns.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.ext-key-not-reverse-dns.json new file mode 100644 index 0000000000..7697fe57e0 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.ext-key-not-reverse-dns.json @@ -0,0 +1,20 @@ +{ + "kind": "movie", + "title": "Arrival", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "durationMs": 6960000, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + }, + "ext": { + "example": { + "server": "1a2b3c" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.ext-too-large.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.ext-too-large.json new file mode 100644 index 0000000000..2ebbb334bc --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.ext-too-large.json @@ -0,0 +1,20 @@ +{ + "kind": "movie", + "title": "Arrival", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "durationMs": 6960000, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + }, + "ext": { + "com.example": { + "note": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-backslash.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-backslash.json new file mode 100644 index 0000000000..8867d9272b --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-backslash.json @@ -0,0 +1,9 @@ +{ + "kind": "video", + "title": "Beach day", + "durationMs": 754000, + "file": { + "sizeBytes": 812345678, + "name": "C:\\Movies\\Beach.Day.mp4" + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-dot.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-dot.json new file mode 100644 index 0000000000..3d511f827a --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-dot.json @@ -0,0 +1,9 @@ +{ + "kind": "video", + "title": "Beach day", + "durationMs": 754000, + "file": { + "sizeBytes": 812345678, + "name": "." + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-dotdot.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-dotdot.json new file mode 100644 index 0000000000..46d8be677c --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-dotdot.json @@ -0,0 +1,9 @@ +{ + "kind": "video", + "title": "Beach day", + "durationMs": 754000, + "file": { + "sizeBytes": 812345678, + "name": ".." + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-nul.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-nul.json new file mode 100644 index 0000000000..443d20f34a --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-nul.json @@ -0,0 +1,9 @@ +{ + "kind": "video", + "title": "Beach day", + "durationMs": 754000, + "file": { + "sizeBytes": 812345678, + "name": "Beach.Day.mp4\u0000.txt" + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-rlo.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-rlo.json new file mode 100644 index 0000000000..9b90010ac9 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-rlo.json @@ -0,0 +1,9 @@ +{ + "kind": "video", + "title": "Beach day", + "durationMs": 754000, + "file": { + "sizeBytes": 812345678, + "name": "Beach‮4pm.exe" + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-slash.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-slash.json new file mode 100644 index 0000000000..7d8c2cfecc --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.file-name-slash.json @@ -0,0 +1,9 @@ +{ + "kind": "video", + "title": "Beach day", + "durationMs": 754000, + "file": { + "sizeBytes": 812345678, + "name": "Movies/Beach.Day.mp4" + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.id-number.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.id-number.json new file mode 100644 index 0000000000..c70bb4e7cc --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.id-number.json @@ -0,0 +1,15 @@ +{ + "kind": "movie", + "title": "Arrival", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": 329865 + }, + "durationMs": 6960000, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.kind-unknown.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.kind-unknown.json new file mode 100644 index 0000000000..0cefa7aee5 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.kind-unknown.json @@ -0,0 +1,15 @@ +{ + "kind": "clip", + "title": "Arrival", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "durationMs": 6960000, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.oshash-uppercase.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.oshash-uppercase.json new file mode 100644 index 0000000000..d3148b6e8a --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.oshash-uppercase.json @@ -0,0 +1,13 @@ +{ + "kind": "movie", + "title": "Arrival", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "durationMs": 6960000, + "file": { + "oshash": "0F1E2D3C4B5A6978" + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.series-title-left-to-right-mark.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.series-title-left-to-right-mark.json new file mode 100644 index 0000000000..d2489aad51 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.series-title-left-to-right-mark.json @@ -0,0 +1,10 @@ +{ + "kind": "episode", + "title": "Pilot", + "series": { + "title": "Breaking Bad‎" + }, + "season": 1, + "episode": 1, + "durationMs": 3480000 +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.series-without-title.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.series-without-title.json new file mode 100644 index 0000000000..14018cdd58 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.series-without-title.json @@ -0,0 +1,25 @@ +{ + "kind": "episode", + "title": "Pilot", + "ids": { + "imdb": "tt0959621", + "tvdb": "349232" + }, + "series": { + "year": 2008 + }, + "season": 1, + "episode": 1, + "durationMs": 3487000, + "file": { + "sizeBytes": 2147483648, + "oshash": "8e245d9679d31e12", + "name": "Breaking.Bad.S01E01.1080p.mkv" + }, + "ext": { + "com.example": { + "server": "1a2b3c", + "item": "4711" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.title-bidi-isolate.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.title-bidi-isolate.json new file mode 100644 index 0000000000..53f5f0e6d6 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.title-bidi-isolate.json @@ -0,0 +1,6 @@ +{ + "kind": "movie", + "title": "Arrival⁧", + "year": 2016, + "durationMs": 6960000 +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.title-c1-control.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.title-c1-control.json new file mode 100644 index 0000000000..fa362e8029 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.title-c1-control.json @@ -0,0 +1,6 @@ +{ + "kind": "movie", + "title": "Arrival…", + "year": 2016, + "durationMs": 6960000 +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.title-empty.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.title-empty.json new file mode 100644 index 0000000000..2a50b48a23 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.title-empty.json @@ -0,0 +1,15 @@ +{ + "kind": "movie", + "title": "", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "durationMs": 6960000, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.title-newline.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.title-newline.json new file mode 100644 index 0000000000..90d421b3a3 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.title-newline.json @@ -0,0 +1,6 @@ +{ + "kind": "movie", + "title": "Arrival\nNow playing: nothing", + "year": 2016, + "durationMs": 6960000 +} diff --git a/rust-modules/owp/fixtures/examples/invalid/descriptor.too-large.json b/rust-modules/owp/fixtures/examples/invalid/descriptor.too-large.json new file mode 100644 index 0000000000..b65f8790a2 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/descriptor.too-large.json @@ -0,0 +1,15 @@ +{ + "kind": "movie", + "title": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "durationMs": 6960000, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.duplicate-escaped-key.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.duplicate-escaped-key.json new file mode 100644 index 0000000000..c6bd108f75 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.duplicate-escaped-key.json @@ -0,0 +1,9 @@ +{ + "type": "setMedia", + "media": { + "kind": "movie", + "title": "Arrival", + "durationMs": 6960000, + "\u0064urationMs": 1 + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.duplicate-key-in-media.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.duplicate-key-in-media.json new file mode 100644 index 0000000000..05f61a2ac1 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.duplicate-key-in-media.json @@ -0,0 +1,9 @@ +{ + "type": "setMedia", + "media": { + "kind": "movie", + "title": "Arrival", + "durationMs": "x", + "durationMs": 6960000 + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.duration-past-max.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.duration-past-max.json new file mode 100644 index 0000000000..1dbc0ec274 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.duration-past-max.json @@ -0,0 +1,9 @@ +{ + "type": "setMedia", + "media": { + "kind": "movie", + "title": "Shoah", + "year": 1985, + "durationMs": 604800001 + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.episode-without-series.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.episode-without-series.json new file mode 100644 index 0000000000..5edca19009 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.episode-without-series.json @@ -0,0 +1,25 @@ +{ + "type": "setMedia", + "media": { + "kind": "episode", + "title": "Pilot", + "ids": { + "imdb": "tt0959621", + "tvdb": "349232" + }, + "season": 1, + "episode": 1, + "durationMs": 3487000, + "file": { + "sizeBytes": 2147483648, + "oshash": "8e245d9679d31e12", + "name": "Breaking.Bad.S01E01.1080p.mkv" + }, + "ext": { + "com.example": { + "server": "1a2b3c", + "item": "4711" + } + } + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.file-name-traversal.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.file-name-traversal.json new file mode 100644 index 0000000000..dbe040b1b8 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.file-name-traversal.json @@ -0,0 +1,12 @@ +{ + "type": "setMedia", + "media": { + "kind": "video", + "title": "Beach day", + "durationMs": 754000, + "file": { + "sizeBytes": 812345678, + "name": "../../.ssh/id_rsa" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.media-half-emoji.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.media-half-emoji.json new file mode 100644 index 0000000000..406c8f9c99 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.media-half-emoji.json @@ -0,0 +1,8 @@ +{ + "type": "setMedia", + "media": { + "kind": "movie", + "title": "Arrival \uD83C", + "durationMs": 6960000 + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.media-invalid-utf8.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.media-invalid-utf8.json new file mode 100644 index 0000000000..2ba45c0ed1 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.media-invalid-utf8.json @@ -0,0 +1,8 @@ +{ + "type": "setMedia", + "media": { + "kind": "movie", + "title": "ÿ", + "durationMs": 6960000 + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.media-null.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.media-null.json new file mode 100644 index 0000000000..0114aa85fe --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.media-null.json @@ -0,0 +1,4 @@ +{ + "type": "setMedia", + "media": null +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.media-too-large.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.media-too-large.json new file mode 100644 index 0000000000..7d5414009b --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.media-too-large.json @@ -0,0 +1,18 @@ +{ + "type": "setMedia", + "media": { + "kind": "movie", + "title": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "durationMs": 6960000, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.media-without-duration.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.media-without-duration.json new file mode 100644 index 0000000000..a5de9da2e5 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.media-without-duration.json @@ -0,0 +1,17 @@ +{ + "type": "setMedia", + "media": { + "kind": "movie", + "title": "Arrival", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/invalid/setMedia.missing-media.json b/rust-modules/owp/fixtures/examples/invalid/setMedia.missing-media.json new file mode 100644 index 0000000000..dd49b55f68 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/invalid/setMedia.missing-media.json @@ -0,0 +1,4 @@ +{ + "type": "setMedia", + "positionMs": 0 +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.duration-max.json b/rust-modules/owp/fixtures/examples/valid/descriptor.duration-max.json new file mode 100644 index 0000000000..444e36507c --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.duration-max.json @@ -0,0 +1,6 @@ +{ + "kind": "movie", + "title": "Shoah", + "year": 1985, + "durationMs": 604800000 +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.episode-app-ids.json b/rust-modules/owp/fixtures/examples/valid/descriptor.episode-app-ids.json new file mode 100644 index 0000000000..fc674f247b --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.episode-app-ids.json @@ -0,0 +1,21 @@ +{ + "kind": "episode", + "title": "The Woman in Red", + "series": { + "title": "Cowboy Bebop", + "year": 1998, + "ids": { + "kitsu": "123", + "imdb": "tt0213338" + } + }, + "season": 1, + "episode": 5, + "durationMs": 1460000, + "ext": { + "org.example": { + "series": "kitsu:123", + "video": "kitsu:123:5" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.episode.json b/rust-modules/owp/fixtures/examples/valid/descriptor.episode.json new file mode 100644 index 0000000000..56000d3773 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.episode.json @@ -0,0 +1,31 @@ +{ + "kind": "episode", + "title": "Pilot", + "ids": { + "imdb": "tt0959621", + "tvdb": "349232" + }, + "series": { + "title": "Breaking Bad", + "year": 2008, + "ids": { + "imdb": "tt0903747", + "tmdb": "1396", + "tvdb": "81189" + } + }, + "season": 1, + "episode": 1, + "durationMs": 3487000, + "file": { + "sizeBytes": 2147483648, + "oshash": "8e245d9679d31e12", + "name": "Breaking.Bad.S01E01.1080p.mkv" + }, + "ext": { + "com.example": { + "server": "1a2b3c", + "item": "4711" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.file-name-hidden.json b/rust-modules/owp/fixtures/examples/valid/descriptor.file-name-hidden.json new file mode 100644 index 0000000000..d8d80ae50d --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.file-name-hidden.json @@ -0,0 +1,9 @@ +{ + "kind": "video", + "title": "Beach day", + "durationMs": 754000, + "file": { + "sizeBytes": 812345678, + "name": ".beach-day.mov" + } +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.file-name-leading-dots.json b/rust-modules/owp/fixtures/examples/valid/descriptor.file-name-leading-dots.json new file mode 100644 index 0000000000..678dc79251 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.file-name-leading-dots.json @@ -0,0 +1,9 @@ +{ + "kind": "video", + "title": "Beach day", + "durationMs": 754000, + "file": { + "sizeBytes": 812345678, + "name": "...Beach.Day.2024.mp4" + } +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.minimal.json b/rust-modules/owp/fixtures/examples/valid/descriptor.minimal.json new file mode 100644 index 0000000000..e67bebbefd --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.minimal.json @@ -0,0 +1,5 @@ +{ + "kind": "movie", + "title": "Arrival", + "durationMs": 1 +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.movie.json b/rust-modules/owp/fixtures/examples/valid/descriptor.movie.json new file mode 100644 index 0000000000..258cd7f47d --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.movie.json @@ -0,0 +1,15 @@ +{ + "kind": "movie", + "title": "Arrival", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "durationMs": 6960000, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + } +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.title-emoji-zwj.json b/rust-modules/owp/fixtures/examples/valid/descriptor.title-emoji-zwj.json new file mode 100644 index 0000000000..a191b218b3 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.title-emoji-zwj.json @@ -0,0 +1,6 @@ +{ + "kind": "movie", + "title": "Family movie night 👨‍👩‍👧", + "year": 2016, + "durationMs": 6960000 +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.title-rtl-script.json b/rust-modules/owp/fixtures/examples/valid/descriptor.title-rtl-script.json new file mode 100644 index 0000000000..4f09c4ba10 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.title-rtl-script.json @@ -0,0 +1,6 @@ +{ + "kind": "movie", + "title": "وجدة", + "year": 2016, + "durationMs": 6960000 +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.unknown-namespace.json b/rust-modules/owp/fixtures/examples/valid/descriptor.unknown-namespace.json new file mode 100644 index 0000000000..4f67fc0ec3 --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.unknown-namespace.json @@ -0,0 +1,15 @@ +{ + "kind": "movie", + "title": "Arrival", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "letterboxd": "arrival-2016" + }, + "durationMs": 6960000, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + } +} diff --git a/rust-modules/owp/fixtures/examples/valid/descriptor.video.json b/rust-modules/owp/fixtures/examples/valid/descriptor.video.json new file mode 100644 index 0000000000..2e6788450d --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/descriptor.video.json @@ -0,0 +1,17 @@ +{ + "kind": "video", + "title": "Summer 2024", + "durationMs": 754000, + "file": { + "sizeBytes": 318767104, + "oshash": "a1b2c3d4e5f60718", + "name": "summer-2024.mp4" + }, + "ext": { + "org.example": { + "type": "other", + "metaId": "local:abc", + "videoId": "local:abc:1" + } + } +} diff --git a/rust-modules/owp/fixtures/examples/valid/setMedia.episode.json b/rust-modules/owp/fixtures/examples/valid/setMedia.episode.json new file mode 100644 index 0000000000..56bde5d96d --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/setMedia.episode.json @@ -0,0 +1,34 @@ +{ + "type": "setMedia", + "media": { + "kind": "episode", + "title": "Pilot", + "ids": { + "imdb": "tt0959621", + "tvdb": "349232" + }, + "series": { + "title": "Breaking Bad", + "year": 2008, + "ids": { + "imdb": "tt0903747", + "tmdb": "1396", + "tvdb": "81189" + } + }, + "season": 1, + "episode": 1, + "durationMs": 3487000, + "file": { + "sizeBytes": 2147483648, + "oshash": "8e245d9679d31e12", + "name": "Breaking.Bad.S01E01.1080p.mkv" + }, + "ext": { + "com.example": { + "server": "1a2b3c", + "item": "4711" + } + } + } +} diff --git a/rust-modules/owp/fixtures/examples/valid/setMedia.movie-at-position.json b/rust-modules/owp/fixtures/examples/valid/setMedia.movie-at-position.json new file mode 100644 index 0000000000..d0ab1c06cc --- /dev/null +++ b/rust-modules/owp/fixtures/examples/valid/setMedia.movie-at-position.json @@ -0,0 +1,19 @@ +{ + "type": "setMedia", + "media": { + "kind": "movie", + "title": "Arrival", + "year": 2016, + "ids": { + "imdb": "tt2543164", + "tmdb": "329865" + }, + "durationMs": 6960000, + "file": { + "sizeBytes": 4294967296, + "oshash": "0f1e2d3c4b5a6978", + "name": "Arrival.2016.1080p.mkv" + } + }, + "positionMs": 600000 +} diff --git a/rust-modules/owp/fixtures/relays.json b/rust-modules/owp/fixtures/relays.json new file mode 100644 index 0000000000..c279ebbd99 --- /dev/null +++ b/rust-modules/owp/fixtures/relays.json @@ -0,0 +1,22 @@ +{ + "relays": [ + { + "id": "na", + "name": "North America", + "url": "wss://na.relay.openwatch.party/v1/ws", + "prefixes": "2345678" + }, + { + "id": "eu", + "name": "Europe", + "url": "wss://eu.relay.openwatch.party/v1/ws", + "prefixes": "9ABCDEF" + }, + { + "id": "asia", + "name": "Asia", + "url": "wss://asia.relay.openwatch.party/v1/ws", + "prefixes": "GHJKMNP" + } + ] +} diff --git a/rust-modules/owp/fixtures/vectors/clock-sync.json b/rust-modules/owp/fixtures/vectors/clock-sync.json new file mode 100644 index 0000000000..11c98197dc --- /dev/null +++ b/rust-modules/owp/fixtures/vectors/clock-sync.json @@ -0,0 +1,28 @@ +{ + "table": "clock-sync", + "cases": [ + {"name":"first sample","input":{"events":[{"ping":1,"atMs":1000},{"pong":1,"serverTime":50000,"atMs":1100}]},"expect":{"pongs":[{"result":"accepted","offsetMs":48950,"rttMs":100}]}}, + {"name":"relay clock behind the local one","input":{"events":[{"ping":1,"atMs":900000},{"pong":1,"serverTime":1020,"atMs":900040}]},"expect":{"pongs":[{"result":"accepted","offsetMs":-899000,"rttMs":40}]}}, + {"name":"odd round trip halves down","input":{"events":[{"ping":1,"atMs":1000},{"pong":1,"serverTime":6050,"atMs":1101}]},"expect":{"pongs":[{"result":"accepted","offsetMs":5000,"rttMs":101}]}}, + {"name":"zero round trip","input":{"events":[{"ping":1,"atMs":1000},{"pong":1,"serverTime":6000,"atMs":1000}]},"expect":{"pongs":[{"result":"accepted","offsetMs":5000,"rttMs":0}]}}, + {"name":"burst: the lowest round trip wins","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":5060,"atMs":120},{"ping":2,"atMs":500},{"pong":2,"serverTime":5570,"atMs":580},{"ping":3,"atMs":1000},{"pong":3,"serverTime":6037,"atMs":1095}]},"expect":{"pongs":[{"result":"accepted","offsetMs":5000,"rttMs":120},{"result":"accepted","offsetMs":5030,"rttMs":80},{"result":"accepted","offsetMs":5030,"rttMs":80}]}}, + {"name":"tie: the oldest sample wins","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":5040,"atMs":80},{"ping":2,"atMs":500},{"pong":2,"serverTime":5550,"atMs":580}]},"expect":{"pongs":[{"result":"accepted","offsetMs":5000,"rttMs":80},{"result":"accepted","offsetMs":5000,"rttMs":80}]}}, + {"name":"round trip of 1000 ms is kept","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":5500,"atMs":1000}]},"expect":{"pongs":[{"result":"accepted","offsetMs":5000,"rttMs":1000}]}}, + {"name":"round trip of 1001 ms is dropped","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":5500,"atMs":1001}]},"expect":{"pongs":[{"result":"ignored","offsetMs":null,"rttMs":null}]}}, + {"name":"dropped sample leaves the best alone","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":5050,"atMs":100},{"ping":2,"atMs":500},{"pong":2,"serverTime":6000,"atMs":1501}]},"expect":{"pongs":[{"result":"accepted","offsetMs":5000,"rttMs":100},{"result":"ignored","offsetMs":5000,"rttMs":100}]}}, + {"name":"dropped sample never counts as a clock step","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":5050,"atMs":100},{"ping":2,"atMs":500},{"pong":2,"serverTime":91250,"atMs":2000}]},"expect":{"pongs":[{"result":"accepted","offsetMs":5000,"rttMs":100},{"result":"ignored","offsetMs":5000,"rttMs":100}]}}, + {"name":"unknown ping id is ignored","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":5050,"atMs":100},{"pong":7,"serverTime":9999,"atMs":600}]},"expect":{"pongs":[{"result":"accepted","offsetMs":5000,"rttMs":100},{"result":"ignored","offsetMs":5000,"rttMs":100}]}}, + {"name":"second pong for one ping is ignored","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":5050,"atMs":100},{"pong":1,"serverTime":5100,"atMs":700}]},"expect":{"pongs":[{"result":"accepted","offsetMs":5000,"rttMs":100},{"result":"ignored","offsetMs":5000,"rttMs":100}]}}, + {"name":"negative round trip is ignored","input":{"events":[{"ping":1,"atMs":1000},{"pong":1,"serverTime":5000,"atMs":999}]},"expect":{"pongs":[{"result":"ignored","offsetMs":null,"rttMs":null}]}}, + {"name":"pongs out of order","input":{"events":[{"ping":1,"atMs":0},{"ping":2,"atMs":500},{"pong":2,"serverTime":5560,"atMs":620},{"pong":1,"serverTime":5300,"atMs":640}]},"expect":{"pongs":[{"result":"accepted","offsetMs":5000,"rttMs":120},{"result":"accepted","offsetMs":5000,"rttMs":120}]}}, + {"name":"burst then interval","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":2030,"atMs":60},{"ping":2,"atMs":500},{"pong":2,"serverTime":2529,"atMs":555},{"ping":3,"atMs":1000},{"pong":3,"serverTime":3033,"atMs":1070},{"ping":4,"atMs":5000},{"pong":4,"serverTime":7029,"atMs":5050},{"ping":5,"atMs":10000},{"pong":5,"serverTime":12033,"atMs":10065}]},"expect":{"pongs":[{"result":"accepted","offsetMs":2000,"rttMs":60},{"result":"accepted","offsetMs":2002,"rttMs":55},{"result":"accepted","offsetMs":2002,"rttMs":55},{"result":"accepted","offsetMs":2004,"rttMs":50},{"result":"accepted","offsetMs":2004,"rttMs":50}]}}, + {"name":"window keeps 8 samples: the 9th evicts the best","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":7015,"atMs":30},{"ping":2,"atMs":5000},{"pong":2,"serverTime":12023,"atMs":5042},{"ping":3,"atMs":10000},{"pong":3,"serverTime":17024,"atMs":10043},{"ping":4,"atMs":15000},{"pong":4,"serverTime":22026,"atMs":15044},{"ping":5,"atMs":20000},{"pong":5,"serverTime":27027,"atMs":20045},{"ping":6,"atMs":25000},{"pong":6,"serverTime":32029,"atMs":25046},{"ping":7,"atMs":30000},{"pong":7,"serverTime":37030,"atMs":30047},{"ping":8,"atMs":35000},{"pong":8,"serverTime":42032,"atMs":35048},{"ping":9,"atMs":40000},{"pong":9,"serverTime":47033,"atMs":40049}]},"expect":{"pongs":[{"result":"accepted","offsetMs":7000,"rttMs":30},{"result":"accepted","offsetMs":7000,"rttMs":30},{"result":"accepted","offsetMs":7000,"rttMs":30},{"result":"accepted","offsetMs":7000,"rttMs":30},{"result":"accepted","offsetMs":7000,"rttMs":30},{"result":"accepted","offsetMs":7000,"rttMs":30},{"result":"accepted","offsetMs":7000,"rttMs":30},{"result":"accepted","offsetMs":7000,"rttMs":30},{"result":"accepted","offsetMs":7002,"rttMs":42}]}}, + {"name":"step: difference equal to the tolerance is kept","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":1050,"atMs":100},{"ping":2,"atMs":500},{"pong":2,"serverTime":1750,"atMs":600}]},"expect":{"pongs":[{"result":"accepted","offsetMs":1000,"rttMs":100},{"result":"accepted","offsetMs":1000,"rttMs":100}]}}, + {"name":"step: 1 ms over the tolerance clears the window","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":1050,"atMs":100},{"ping":2,"atMs":500},{"pong":2,"serverTime":1751,"atMs":600}]},"expect":{"pongs":[{"result":"accepted","offsetMs":1000,"rttMs":100},{"result":"stepped","offsetMs":1201,"rttMs":100}]}}, + {"name":"step: negative jump over the tolerance clears the window","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":1050,"atMs":100},{"ping":2,"atMs":500},{"pong":2,"serverTime":1349,"atMs":600}]},"expect":{"pongs":[{"result":"accepted","offsetMs":1000,"rttMs":100},{"result":"stepped","offsetMs":799,"rttMs":100}]}}, + {"name":"step: odd round-trip sum halves down (kept)","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":1050,"atMs":100},{"ping":2,"atMs":500},{"pong":2,"serverTime":1750,"atMs":601}]},"expect":{"pongs":[{"result":"accepted","offsetMs":1000,"rttMs":100},{"result":"accepted","offsetMs":1000,"rttMs":100}]}}, + {"name":"step: odd round-trip sum halves down (cleared)","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":1050,"atMs":100},{"ping":2,"atMs":500},{"pong":2,"serverTime":1751,"atMs":601}]},"expect":{"pongs":[{"result":"accepted","offsetMs":1000,"rttMs":100},{"result":"stepped","offsetMs":1201,"rttMs":101}]}}, + {"name":"step: compared with the best, not the newest","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":1010,"atMs":20},{"ping":2,"atMs":500},{"pong":2,"serverTime":1900,"atMs":800},{"ping":3,"atMs":1000},{"pong":3,"serverTime":2170,"atMs":1020}]},"expect":{"pongs":[{"result":"accepted","offsetMs":1000,"rttMs":20},{"result":"accepted","offsetMs":1000,"rttMs":20},{"result":"stepped","offsetMs":1160,"rttMs":20}]}}, + {"name":"step: the window starts over from the stepped sample","input":{"events":[{"ping":1,"atMs":0},{"pong":1,"serverTime":1010,"atMs":20},{"ping":2,"atMs":500},{"pong":2,"serverTime":1525,"atMs":530},{"ping":3,"atMs":1000},{"pong":3,"serverTime":41100,"atMs":1200},{"ping":4,"atMs":5000},{"pong":4,"serverTime":45225,"atMs":5250}]},"expect":{"pongs":[{"result":"accepted","offsetMs":1000,"rttMs":20},{"result":"accepted","offsetMs":1000,"rttMs":20},{"result":"stepped","offsetMs":40000,"rttMs":200},{"result":"accepted","offsetMs":40000,"rttMs":200}]}} + ] +} diff --git a/rust-modules/owp/fixtures/vectors/code-routing.json b/rust-modules/owp/fixtures/vectors/code-routing.json new file mode 100644 index 0000000000..dbc66258c2 --- /dev/null +++ b/rust-modules/owp/fixtures/vectors/code-routing.json @@ -0,0 +1,44 @@ +{ + "table": "code-routing", + "cases": [ + {"name":"upper case","input":{"code":"K7MQ2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"lower case","input":{"code":"k7mq2x","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"mixed case","input":{"code":"k7Mq2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"grouped with a hyphen","input":{"code":"K7M-Q2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"grouped with a space","input":{"code":"k7m q2x","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"surrounding whitespace","input":{"code":" K7MQ2X \n","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"tab and carriage return","input":{"code":"\tK7M\rQ2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"no-break space","input":{"code":"K7M\u00a0Q2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"narrow no-break and figure spaces","input":{"code":"K7\u202fMQ\u20072X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"en dash","input":{"code":"K7M\u2013Q2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"em dash","input":{"code":"K7M\u2014Q2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"minus sign","input":{"code":"K7M\u2212Q2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"non-breaking hyphen","input":{"code":"K7M\u2011Q2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"several separators","input":{"code":"- K7 -- MQ - 2X -","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"K7MQ2X","relay":"c"}}, + {"name":"first symbol 2 routes to a","input":{"code":"2ABCDE","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"2ABCDE","relay":"a"}}, + {"name":"first symbol 8 routes to a","input":{"code":"823456","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"823456","relay":"a"}}, + {"name":"first symbol 9 routes to b","input":{"code":"923456","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"923456","relay":"b"}}, + {"name":"first symbol F routes to b","input":{"code":"F23456","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"F23456","relay":"b"}}, + {"name":"first symbol G routes to c","input":{"code":"G23456","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"G23456","relay":"c"}}, + {"name":"first symbol P routes to c","input":{"code":"PQRSTU","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"PQRSTU","relay":"c"}}, + {"name":"first symbol Q: no relay owns it","input":{"code":"Q23456","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"Q23456","relay":null}}, + {"name":"first symbol Z: no relay owns it","input":{"code":"ZZZZZZ","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"ZZZZZZ","relay":null}}, + {"name":"U V W X Y are symbols","input":{"code":"UVWXY2","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"code":"UVWXY2","relay":null}}, + {"name":"five symbols","input":{"code":"K7MQ2","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"seven symbols","input":{"code":"K7MQ2XA","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"empty","input":{"code":"","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"only separators","input":{"code":" - - ","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"zero is not a symbol","input":{"code":"K7MQ20","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"letter O is not a symbol","input":{"code":"K7MQ2O","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"one is not a symbol","input":{"code":"K7MQ21","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"letter I is not a symbol","input":{"code":"K7MQ2I","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"lower-case l is not a symbol","input":{"code":"k7mq2l","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"underscore is not stripped","input":{"code":"K7M_Q2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"dot is not stripped","input":{"code":"K7M.Q2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"non-ASCII letter","input":{"code":"K7MQ2\u00c9","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"full-width letter","input":{"code":"\uff2b7MQ2X","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"}]},"expect":{"error":"invalid_code"}}, + {"name":"self-hosted relay owns every symbol","input":{"code":"Q2X7MK","relays":[{"id":"local","prefixes":"23456789ABCDEFGHJKMNPQRSTUVWXYZ"}]},"expect":{"code":"Q2X7MK","relay":"local"}}, + {"name":"a symbol no relay owned, now owned by a new relay","input":{"code":"Q2X7MK","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"GHJKMNP"},{"id":"d","prefixes":"QRSTUVWXYZ"}]},"expect":{"code":"Q2X7MK","relay":"d"}}, + {"name":"ownership after a move","input":{"code":"G2X7MK","relays":[{"id":"a","prefixes":"2345678"},{"id":"b","prefixes":"9ABCDEF"},{"id":"c","prefixes":"HJKMNP"},{"id":"d","prefixes":"G"}]},"expect":{"code":"G2X7MK","relay":"d"}} + ] +} diff --git a/rust-modules/owp/fixtures/vectors/media-check.json b/rust-modules/owp/fixtures/vectors/media-check.json new file mode 100644 index 0000000000..d0c59af787 --- /dev/null +++ b/rust-modules/owp/fixtures/vectors/media-check.json @@ -0,0 +1,188 @@ +{ + "table": "media-check", + "cases": [ + {"name":"movie (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"movie (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"only kind, title and durationMs (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","durationMs":1}},"expect":{"valid":true}}, + {"name":"only kind, title and durationMs (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","durationMs":1}},"expect":{"valid":true}}, + {"name":"episode (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","year":2008,"ids":{"tvdb":"81189"}},"season":1,"episode":1}},"expect":{"valid":true}}, + {"name":"episode (send)","input":{"on":"send","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","year":2008,"ids":{"tvdb":"81189"}},"season":1,"episode":1}},"expect":{"valid":true}}, + {"name":"video with a file and no IDs (receive)","input":{"on":"receive","media":{"kind":"video","title":"Beach 2024","durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"video with a file and no IDs (send)","input":{"on":"send","media":{"kind":"video","title":"Beach 2024","durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"a movie may carry series (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Heat"}}},"expect":{"valid":true}}, + {"name":"a movie may carry series (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Heat"}}},"expect":{"valid":true}}, + {"name":"unknown members are ignored (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"name":"Heat.mkv","codec":"hevc"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"rating":"R"}},"expect":{"valid":true}}, + {"name":"unknown members are ignored (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"name":"Heat.mkv","codec":"hevc"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"rating":"R"}},"expect":{"valid":true}}, + {"name":"unknown ID namespace (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"trakt":"1234"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"unknown ID namespace (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"trakt":"1234"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"year 0 and negative years are ints (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":-50,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"year 0 and negative years are ints (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":-50,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"int written as 3487000.0 (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":3487000.0,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"int written as 3487000.0 (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":3487000.0,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"int written with an exponent (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":3.487e6,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"int written with an exponent (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":3.487e6,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"title with an emoji ZWJ sequence (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Family \ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"title with an emoji ZWJ sequence (send)","input":{"on":"send","media":{"kind":"movie","title":"Family \ud83d\udc68\u200d\ud83d\udc69\u200d\ud83d\udc67","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"title in a right-to-left script (receive)","input":{"on":"receive","media":{"kind":"movie","title":"\u05d4\u05e9\u05d5\u05d3","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"title in a right-to-left script (send)","input":{"on":"send","media":{"kind":"movie","title":"\u05d4\u05e9\u05d5\u05d3","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"title with a no-break space (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat\u00a0II","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"title with a no-break space (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat\u00a0II","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"title empty (receive)","input":{"on":"receive","media":{"kind":"movie","title":"","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title empty (send)","input":{"on":"send","media":{"kind":"movie","title":"","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with a line feed (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat\n","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with a line feed (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat\n","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with NUL (receive)","input":{"on":"receive","media":{"kind":"movie","title":"He\u0000at","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with NUL (send)","input":{"on":"send","media":{"kind":"movie","title":"He\u0000at","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with a C1 control character (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat\u0085","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with a C1 control character (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat\u0085","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with a right-to-left override (receive)","input":{"on":"receive","media":{"kind":"movie","title":"\u202etaeH","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with a right-to-left override (send)","input":{"on":"send","media":{"kind":"movie","title":"\u202etaeH","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with an isolate (receive)","input":{"on":"receive","media":{"kind":"movie","title":"\u2068Heat\u2069","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with an isolate (send)","input":{"on":"send","media":{"kind":"movie","title":"\u2068Heat\u2069","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with an unpaired high surrogate (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat\ud800","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with an unpaired high surrogate (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat\ud800","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with an unpaired low surrogate (receive)","input":{"on":"receive","media":{"kind":"movie","title":"\udc00Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title with an unpaired low surrogate (send)","input":{"on":"send","media":{"kind":"movie","title":"\udc00Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"episode without series (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"episode without series (send)","input":{"on":"send","media":{"kind":"episode","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"series title empty (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":""},"season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"series title empty (send)","input":{"on":"send","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":""},"season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"series title with a left-to-right mark (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad\u200e"},"season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"series title with a left-to-right mark (send)","input":{"on":"send","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad\u200e"},"season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"series title with an unpaired surrogate (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking\udbff Bad"},"season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"series title with an unpaired surrogate (send)","input":{"on":"send","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking\udbff Bad"},"season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"season 0 is allowed (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","year":2008,"ids":{"tvdb":"81189"}},"season":0,"episode":1}},"expect":{"valid":true}}, + {"name":"season 0 is allowed (send)","input":{"on":"send","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","year":2008,"ids":{"tvdb":"81189"}},"season":0,"episode":1}},"expect":{"valid":true}}, + {"name":"season -1 (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","year":2008,"ids":{"tvdb":"81189"}},"season":-1,"episode":1}},"expect":{"valid":false}}, + {"name":"season -1 (send)","input":{"on":"send","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","year":2008,"ids":{"tvdb":"81189"}},"season":-1,"episode":1}},"expect":{"valid":false}}, + {"name":"episode -1 (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","year":2008,"ids":{"tvdb":"81189"}},"season":1,"episode":-1}},"expect":{"valid":false}}, + {"name":"episode -1 (send)","input":{"on":"send","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","year":2008,"ids":{"tvdb":"81189"}},"season":1,"episode":-1}},"expect":{"valid":false}}, + {"name":"ID empty (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":""},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"ID empty (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":""},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"series ID empty (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","ids":{"tvdb":""}},"season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"series ID empty (send)","input":{"on":"send","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","ids":{"tvdb":""}},"season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"ID with an unpaired surrogate (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt\ud800"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"ID with an unpaired surrogate (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt\ud800"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"ID namespace with an unpaired surrogate (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"im\udc00db":"tt0113277"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"ID namespace with an unpaired surrogate (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"im\udc00db":"tt0113277"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs 1 (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":1,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"durationMs 1 (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":1,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"durationMs 0 (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":0,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs 0 (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":0,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs negative (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":-5,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs negative (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":-5,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs 604800000 (7 days) (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":604800000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"durationMs 604800000 (7 days) (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":604800000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"durationMs 604800001 (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":604800001,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs 604800001 (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":604800001,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs 2^53 - 1 (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":9007199254740991,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs 2^53 - 1 (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":9007199254740991,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"sizeBytes 0 (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":0},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"sizeBytes 0 (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":0},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"sizeBytes negative (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":-1},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"sizeBytes negative (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":-1},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"oshash upper case (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"oshash":"8E245D9679D31E12"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"oshash upper case (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"oshash":"8E245D9679D31E12"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"oshash of 15 digits (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"oshash":"8e245d9679d31e1"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"oshash of 15 digits (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"oshash":"8e245d9679d31e1"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"oshash of 17 digits (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"oshash":"8e245d9679d31e120"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"oshash of 17 digits (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"oshash":"8e245d9679d31e120"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"oshash not hex (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"oshash":"8e245d9679d31e1g"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"oshash not hex (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"oshash":"8e245d9679d31e1g"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with a leading dot (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":".beach.mov"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"file name with a leading dot (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":".beach.mov"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"file name of three dots (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"..."},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"file name of three dots (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"..."},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"file name starting with three dots (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"...x.mp4"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"file name starting with three dots (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"...x.mp4"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"file name with two dots inside (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"Heat..1995.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"file name with two dots inside (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"Heat..1995.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":true}}, + {"name":"file name empty (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":""},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name empty (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":""},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name . (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"."},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name . (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"."},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name .. (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":".."},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name .. (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":".."},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with a slash (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"Movies/Heat.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with a slash (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"Movies/Heat.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name is a slash (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"/"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name is a slash (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"/"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with a backslash (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"C:\\Movies\\Heat.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with a backslash (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"C:\\Movies\\Heat.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name climbing directories (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"../../.ssh/id_rsa"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name climbing directories (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"../../.ssh/id_rsa"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with NUL (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"Heat.mkv\u0000.txt"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with NUL (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"Heat.mkv\u0000.txt"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with a right-to-left override (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"Heat\u202evkm.exe"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with a right-to-left override (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"Heat\u202evkm.exe"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with an unpaired surrogate (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"Heat\ud800.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name with an unpaired surrogate (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":1000,"name":"Heat\ud800.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"ext member of two labels (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"org.example":{"type":"movie","metaId":"tt0113277"}}}},"expect":{"valid":true}}, + {"name":"ext member of two labels (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"org.example":{"type":"movie","metaId":"tt0113277"}}}},"expect":{"valid":true}}, + {"name":"ext member with digits and dashes (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example-2.app":1}}},"expect":{"valid":true}}, + {"name":"ext member with digits and dashes (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example-2.app":1}}},"expect":{"valid":true}}, + {"name":"ext values may be any JSON (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"app.a":null,"app.b":[1,"x"],"app.c":true}}},"expect":{"valid":true}}, + {"name":"ext values may be any JSON (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"app.a":null,"app.b":[1,"x"],"app.c":true}}},"expect":{"valid":true}}, + {"name":"ext empty (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{}}},"expect":{"valid":true}}, + {"name":"ext empty (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{}}},"expect":{"valid":true}}, + {"name":"ext name of one label (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"example":{}}}},"expect":{"valid":false}}, + {"name":"ext name of one label (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"example":{}}}},"expect":{"valid":false}}, + {"name":"ext name with an upper-case letter (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.Example":{}}}},"expect":{"valid":false}}, + {"name":"ext name with an upper-case letter (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.Example":{}}}},"expect":{"valid":false}}, + {"name":"ext name with an empty label (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com..example":{}}}},"expect":{"valid":false}}, + {"name":"ext name with an empty label (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com..example":{}}}},"expect":{"valid":false}}, + {"name":"ext name ending in a dot (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example.":{}}}},"expect":{"valid":false}}, + {"name":"ext name ending in a dot (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example.":{}}}},"expect":{"valid":false}}, + {"name":"ext name with an underscore (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.exam_ple":{}}}},"expect":{"valid":false}}, + {"name":"ext name with an underscore (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.exam_ple":{}}}},"expect":{"valid":false}}, + {"name":"ext name with an unpaired surrogate (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example\ud800":{}}}},"expect":{"valid":false}}, + {"name":"ext name with an unpaired surrogate (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example\ud800":{}}}},"expect":{"valid":false}}, + {"name":"ext value with an unpaired surrogate (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":["a\udc00"]}}}},"expect":{"valid":false}}, + {"name":"ext value with an unpaired surrogate (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":["a\udc00"]}}}},"expect":{"valid":false}}, + {"name":"ext member name with an unpaired surrogate (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"\ud800":1}}}},"expect":{"valid":false}}, + {"name":"ext member name with an unpaired surrogate (send)","input":{"on":"send","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"\ud800":1}}}},"expect":{"valid":false}}, + {"name":"not an object (receive)","input":{"on":"receive","media":["movie"]},"expect":{"valid":false}}, + {"name":"null (receive)","input":{"on":"receive","media":null},"expect":{"valid":false}}, + {"name":"kind missing (receive)","input":{"on":"receive","media":{"title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"kind unknown (receive)","input":{"on":"receive","media":{"kind":"show","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"kind upper case (receive)","input":{"on":"receive","media":{"kind":"Movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title missing (receive)","input":{"on":"receive","media":{"kind":"movie","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title null (receive)","input":{"on":"receive","media":{"kind":"movie","title":null,"year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"title a number (receive)","input":{"on":"receive","media":{"kind":"movie","title":1995,"year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"year not integral (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995.5,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"year a string (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":"1995","ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"year null (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":null,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"ids not an object (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":["tt0113277"],"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"ID a number (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"tmdb":949},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"series not an object (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":"Breaking Bad","season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"series without title (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"year":2008},"season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"series year a string (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","year":"2008"},"season":1,"episode":1}},"expect":{"valid":false}}, + {"name":"season not integral (receive)","input":{"on":"receive","media":{"kind":"episode","title":"Pilot","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}},"series":{"title":"Breaking Bad","year":2008,"ids":{"tvdb":"81189"}},"season":1.5,"episode":1}},"expect":{"valid":false}}, + {"name":"durationMs missing (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs not integral (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":1000.5,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs a string (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":"1000","file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"durationMs too large for a double (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":1e400,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file not an object (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":"Heat.mkv","ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"sizeBytes a string (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":"1000"},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"file name a number (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"name":1995},"ext":{"com.example":{"server":"1a2b3c","item":"4711"}}}},"expect":{"valid":false}}, + {"name":"ext not an object (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000,"file":{"sizeBytes":4700000000,"oshash":"8e245d9679d31e12","name":"Heat.1995.1080p.BluRay.mkv"},"ext":["com.example"]}},"expect":{"valid":false}}, + {"name":"descriptor of 4096 bytes (receive)","input":{"on":"receive","media":{"kind":"movie","title":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","durationMs":1000}},"expect":{"valid":false}}, + {"name":"4096 bytes, U+00E9 counts as two (receive)","input":{"on":"receive","media":{"kind":"movie","title":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9a","durationMs":1000}},"expect":{"valid":true}}, + {"name":"4096 bytes, U+00E9 counts as two (send)","input":{"on":"send","media":{"kind":"movie","title":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9a","durationMs":1000}},"expect":{"valid":true}}, + {"name":"4097 bytes, U+00E9 counts as two (receive)","input":{"on":"receive","media":{"kind":"movie","title":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9aa","durationMs":1000}},"expect":{"valid":true}}, + {"name":"4097 bytes, U+00E9 counts as two (send)","input":{"on":"send","media":{"kind":"movie","title":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9aa","durationMs":1000}},"expect":{"valid":false}}, + {"name":"whitespace in the input doesn't count (receive)","input":{"on":"receive","media":{"kind":"movie","title":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","durationMs":1000.000}},"expect":{"valid":true}}, + {"name":"ext of 1024 bytes (receive)","input":{"on":"receive","media":{"kind":"movie","title":"Heat","durationMs":1000,"ext":{"com.example":{"note":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}}}},"expect":{"valid":false}} + ] +} diff --git a/rust-modules/owp/fixtures/vectors/names.json b/rust-modules/owp/fixtures/vectors/names.json new file mode 100644 index 0000000000..6f9d2a09ff --- /dev/null +++ b/rust-modules/owp/fixtures/vectors/names.json @@ -0,0 +1,55 @@ +{ + "table": "names", + "cases": [ + {"name":"name: one character","input":{"field":"name","value":"A"},"expect":{"valid":true}}, + {"name":"name: empty","input":{"field":"name","value":""},"expect":{"valid":false}}, + {"name":"name: 32 characters","input":{"field":"name","value":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},"expect":{"valid":true}}, + {"name":"name: 33 characters","input":{"field":"name","value":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"},"expect":{"valid":false}}, + {"name":"name: 32 emoji are 32 characters","input":{"field":"name","value":"\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00"},"expect":{"valid":true}}, + {"name":"name: 33 emoji are 33 characters","input":{"field":"name","value":"\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00"},"expect":{"valid":false}}, + {"name":"name: a combining mark is a character","input":{"field":"name","value":"e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301"},"expect":{"valid":true}}, + {"name":"name: 33 code points with combining marks","input":{"field":"name","value":"e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301e\u0301x"},"expect":{"valid":false}}, + {"name":"name: spaces are kept and allowed","input":{"field":"name","value":" Anna "},"expect":{"valid":true}}, + {"name":"name: emoji ZWJ sequence","input":{"field":"name","value":"\ud83d\udc69\u200d\ud83d\udcbb"},"expect":{"valid":true}}, + {"name":"name: zero-width space is allowed","input":{"field":"name","value":"An\u200bna"},"expect":{"valid":true}}, + {"name":"name: no-break space is allowed","input":{"field":"name","value":"Anna\u00a0B"},"expect":{"valid":true}}, + {"name":"name: narrow no-break space is allowed","input":{"field":"name","value":"Anna\u202fB"},"expect":{"valid":true}}, + {"name":"name: line separator is allowed","input":{"field":"name","value":"Anna\u2028B"},"expect":{"valid":true}}, + {"name":"name: byte order mark is allowed","input":{"field":"name","value":"\ufeffAnna"},"expect":{"valid":true}}, + {"name":"name: NUL","input":{"field":"name","value":"An\u0000na"},"expect":{"valid":false}}, + {"name":"name: tab","input":{"field":"name","value":"An\tna"},"expect":{"valid":false}}, + {"name":"name: line feed","input":{"field":"name","value":"Anna\n"},"expect":{"valid":false}}, + {"name":"name: U+001F","input":{"field":"name","value":"Anna\u001f"},"expect":{"valid":false}}, + {"name":"name: DEL","input":{"field":"name","value":"Anna\u007f"},"expect":{"valid":false}}, + {"name":"name: U+0080","input":{"field":"name","value":"Anna\u0080"},"expect":{"valid":false}}, + {"name":"name: U+009F","input":{"field":"name","value":"Anna\u009f"},"expect":{"valid":false}}, + {"name":"name: Arabic letter mark U+061C","input":{"field":"name","value":"Anna\u061c"},"expect":{"valid":false}}, + {"name":"name: left-to-right mark U+200E","input":{"field":"name","value":"Anna\u200e"},"expect":{"valid":false}}, + {"name":"name: right-to-left mark U+200F","input":{"field":"name","value":"Anna\u200f"},"expect":{"valid":false}}, + {"name":"name: left-to-right embedding U+202A","input":{"field":"name","value":"\u202aAnna"},"expect":{"valid":false}}, + {"name":"name: right-to-left override U+202E","input":{"field":"name","value":"\u202eannA"},"expect":{"valid":false}}, + {"name":"name: left-to-right isolate U+2066","input":{"field":"name","value":"\u2066Anna"},"expect":{"valid":false}}, + {"name":"name: pop directional isolate U+2069","input":{"field":"name","value":"Anna\u2069"},"expect":{"valid":false}}, + {"name":"client: app and version","input":{"field":"client","value":"Example/1.31.0"},"expect":{"valid":true}}, + {"name":"client: one character each","input":{"field":"client","value":"a/b"},"expect":{"valid":true}}, + {"name":"client: no slash","input":{"field":"client","value":"Example"},"expect":{"valid":false}}, + {"name":"client: empty app","input":{"field":"client","value":"/1.0"},"expect":{"valid":false}}, + {"name":"client: empty version","input":{"field":"client","value":"Example/"},"expect":{"valid":false}}, + {"name":"client: only a slash","input":{"field":"client","value":"/"},"expect":{"valid":false}}, + {"name":"client: the version may hold slashes","input":{"field":"client","value":"Example/1.0/beta"},"expect":{"valid":true}}, + {"name":"client: a slash right after the first","input":{"field":"client","value":"a//"},"expect":{"valid":true}}, + {"name":"client: two slashes, empty app","input":{"field":"client","value":"//"},"expect":{"valid":false}}, + {"name":"client: spaces are allowed","input":{"field":"client","value":"Open Watch/1.0 beta"},"expect":{"valid":true}}, + {"name":"client: 64 characters","input":{"field":"client","value":"App/111111111111111111111111111111111111111111111111111111111111"},"expect":{"valid":true}}, + {"name":"client: 65 characters","input":{"field":"client","value":"App/1111111111111111111111111111111111111111111111111111111111111"},"expect":{"valid":false}}, + {"name":"client: 64 characters, some outside ASCII","input":{"field":"client","value":"\u00c5pp/\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9"},"expect":{"valid":true}}, + {"name":"client: line feed","input":{"field":"client","value":"Example/1.0\n"},"expect":{"valid":false}}, + {"name":"client: right-to-left mark","input":{"field":"client","value":"Example/1.0\u200f"},"expect":{"valid":false}}, + {"name":"client: empty","input":{"field":"client","value":""},"expect":{"valid":false}}, + {"name":"name: surrogate pair escapes are one character","input":{"field":"name","value":"\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00"},"expect":{"valid":true}}, + {"name":"name: unpaired high surrogate","input":{"field":"name","value":"Anna\ud800"},"expect":{"valid":false}}, + {"name":"name: unpaired low surrogate","input":{"field":"name","value":"\udc00Anna"},"expect":{"valid":false}}, + {"name":"name: two high surrogates","input":{"field":"name","value":"\ud83d\ud83dAnna"},"expect":{"valid":false}}, + {"name":"client: unpaired surrogate in the version","input":{"field":"client","value":"Example/1.0\udfff"},"expect":{"valid":false}} + ] +} diff --git a/rust-modules/owp/fixtures/vectors/relay-list.json b/rust-modules/owp/fixtures/vectors/relay-list.json new file mode 100644 index 0000000000..2cc73ce122 --- /dev/null +++ b/rust-modules/owp/fixtures/vectors/relay-list.json @@ -0,0 +1,74 @@ +{ + "table": "relay-list", + "cases": [ + {"name":"a list that leaves symbols to no relay","input":{"list":{"relays":[{"id":"a","name":"Relay A","url":"wss://a.relay.example/v1/ws","prefixes":"2345678"},{"id":"b","name":"Relay B","url":"wss://b.relay.example/v1/ws","prefixes":"9ABCDEF"},{"id":"c","name":"Relay C","url":"wss://c.relay.example/v1/ws","prefixes":"GHJKMNP"}]}},"expect":{"relays":[{"id":"a","name":"Relay A","url":"wss://a.relay.example/v1/ws","prefixes":"2345678"},{"id":"b","name":"Relay B","url":"wss://b.relay.example/v1/ws","prefixes":"9ABCDEF"},{"id":"c","name":"Relay C","url":"wss://c.relay.example/v1/ws","prefixes":"GHJKMNP"}]}}, + {"name":"a ws url is refused","input":{"list":{"relays":[{"id":"x","name":"X","url":"ws://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"a ws url with a port is refused","input":{"list":{"relays":[{"id":"x","name":"X","url":"ws://127.0.0.1:18100/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"a wss url with an IP address and a port","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://127.0.0.1:18100/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"X","url":"wss://127.0.0.1:18100/v1/ws","prefixes":"A"}]}}, + {"name":"path before /v1/ws is kept","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://example.com/owp/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"X","url":"wss://example.com/owp/v1/ws","prefixes":"A"}]}}, + {"name":"unknown fields are ignored","input":{"list":{"protocol":1,"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws","prefixes":"A","weight":3}],"motd":"hi"}},"expect":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}}, + {"name":"id of 32 characters","input":{"list":{"relays":[{"id":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}}, + {"name":"id with digits and dashes","input":{"list":{"relays":[{"id":"eu-2","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"eu-2","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}}, + {"name":"name of 64 characters","input":{"list":{"relays":[{"id":"x","name":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9","url":"wss://x.example/v1/ws","prefixes":"A"}]}}, + {"name":"not an object","input":{"list":[1,2]},"expect":{"error":"invalid_list"}}, + {"name":"relays missing","input":{"list":{"protocol":1}},"expect":{"error":"invalid_list"}}, + {"name":"relays empty","input":{"list":{"relays":[]}},"expect":{"error":"invalid_list"}}, + {"name":"relays not an array","input":{"list":{"relays":{"id":"x"}}},"expect":{"error":"invalid_list"}}, + {"name":"relay not an object","input":{"list":{"relays":["wss://x.example/v1/ws"]}},"expect":{"error":"invalid_list"}}, + {"name":"id missing","input":{"list":{"relays":[{"name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"id empty","input":{"list":{"relays":[{"id":"","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"id not a string","input":{"list":{"relays":[{"id":7,"name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"id of 33 characters","input":{"list":{"relays":[{"id":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"id with an upper-case letter","input":{"list":{"relays":[{"id":"Eu","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"id starting with a dash","input":{"list":{"relays":[{"id":"-eu","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"id with an underscore","input":{"list":{"relays":[{"id":"eu_2","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"duplicate id","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws","prefixes":"A"},{"id":"x","name":"X","url":"wss://y.example/v1/ws","prefixes":"B"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name missing","input":{"list":{"relays":[{"id":"x","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name null","input":{"list":{"relays":[{"id":"x","name":null,"url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name empty","input":{"list":{"relays":[{"id":"x","name":"","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name not a string","input":{"list":{"relays":[{"id":"x","name":5,"url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name of 65 characters","input":{"list":{"relays":[{"id":"x","name":"\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9\u00e9","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with a control character","input":{"list":{"relays":[{"id":"x","name":"Eu\u0007rope","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with a C1 control character","input":{"list":{"relays":[{"id":"x","name":"Eu\u0085rope","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with U+009F","input":{"list":{"relays":[{"id":"x","name":"Europe\u009f","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with a right-to-left override","input":{"list":{"relays":[{"id":"x","name":"\u202eeporuE","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with an isolate","input":{"list":{"relays":[{"id":"x","name":"\u2066Europe\u2069","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with a left-to-right mark","input":{"list":{"relays":[{"id":"x","name":"Europe\u200e","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with the Arabic letter mark","input":{"list":{"relays":[{"id":"x","name":"Europe\u061c","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with a no-break space","input":{"list":{"relays":[{"id":"x","name":"North\u00a0America","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"North\u00a0America","url":"wss://x.example/v1/ws","prefixes":"A"}]}}, + {"name":"name with a zero-width joiner","input":{"list":{"relays":[{"id":"x","name":"Europe\u200d","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"Europe\u200d","url":"wss://x.example/v1/ws","prefixes":"A"}]}}, + {"name":"name of 64 emoji","input":{"list":{"relays":[{"id":"x","name":"\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00","url":"wss://x.example/v1/ws","prefixes":"A"}]}}, + {"name":"name of 65 emoji","input":{"list":{"relays":[{"id":"x","name":"\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00\ud83d\ude00","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with a surrogate pair escape","input":{"list":{"relays":[{"id":"x","name":"Europe \ud83d\ude00","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"Europe \ud83d\ude00","url":"wss://x.example/v1/ws","prefixes":"A"}]}}, + {"name":"name with an unpaired high surrogate","input":{"list":{"relays":[{"id":"x","name":"Eu\ud800rope","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with an unpaired low surrogate","input":{"list":{"relays":[{"id":"x","name":"\udc00Europe","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name with a high surrogate before a pair","input":{"list":{"relays":[{"id":"x","name":"Europe\ud800\ud83d\ude00","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"name ending in a high surrogate","input":{"list":{"relays":[{"id":"x","name":"Europe\ud83d","url":"wss://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url missing","input":{"list":{"relays":[{"id":"x","name":"X","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url not a string","input":{"list":{"relays":[{"id":"x","name":"X","url":1,"prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"https url","input":{"list":{"relays":[{"id":"x","name":"X","url":"https://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url without /v1/ws","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url with a trailing slash","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws/","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url with a query","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws?a=1","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url with a fragment","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws#a","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url without a host","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss:///v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"upper-case scheme","input":{"list":{"relays":[{"id":"x","name":"X","url":"WSS://x.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url with a space","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/my relay/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url with a tab","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example\t/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url with a control character","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.exa\u0007mple/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url with DEL","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example\u007f/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url with a non-ASCII host","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://b\u00fccher.example/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url with an unpaired surrogate","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example\ud800/v1/ws","prefixes":"A"}]}},"expect":{"error":"invalid_list"}}, + {"name":"url with percent-encoding and a tilde","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/~owp/a%20b/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"X","url":"wss://x.example/~owp/a%20b/v1/ws","prefixes":"A"}]}}, + {"name":"url with a punycode host","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://xn--bcher-kva.example/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"X","url":"wss://xn--bcher-kva.example/v1/ws","prefixes":"A"}]}}, + {"name":"url with an IPv6 literal and a port","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://[fd00::20]:8080/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"X","url":"wss://[fd00::20]:8080/v1/ws","prefixes":"A"}]}}, + {"name":"url with a greater-than sign in the host","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x>y.example/v1/ws","prefixes":"A"}]}},"expect":{"relays":[{"id":"x","name":"X","url":"wss://x>y.example/v1/ws","prefixes":"A"}]}}, + {"name":"prefixes missing","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws"}]}},"expect":{"error":"invalid_list"}}, + {"name":"prefixes empty","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws","prefixes":""}]}},"expect":{"error":"invalid_list"}}, + {"name":"prefixes not a string","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws","prefixes":["A"]}]}},"expect":{"error":"invalid_list"}}, + {"name":"lower-case prefix","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws","prefixes":"a"}]}},"expect":{"error":"invalid_list"}}, + {"name":"prefix outside the alphabet","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws","prefixes":"A0"}]}},"expect":{"error":"invalid_list"}}, + {"name":"symbol repeated in one relay","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws","prefixes":"AA"}]}},"expect":{"error":"invalid_list"}}, + {"name":"symbol owned by two relays","input":{"list":{"relays":[{"id":"x","name":"X","url":"wss://x.example/v1/ws","prefixes":"AB"},{"id":"y","name":"X","url":"wss://y.example/v1/ws","prefixes":"BC"}]}},"expect":{"error":"invalid_list"}} + ] +} diff --git a/rust-modules/owp/fixtures/vectors/room-check.json b/rust-modules/owp/fixtures/vectors/room-check.json new file mode 100644 index 0000000000..fbb285575e --- /dev/null +++ b/rust-modules/owp/fixtures/vectors/room-check.json @@ -0,0 +1,100 @@ +{ + "table": "room-check", + "cases": [ + {"name":"the snapshot of SPEC.md section 9.1","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"idle room","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":0,"phase":"idle","positionMs":0,"atMs":0,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"waiting room","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"waiting","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":["p2"],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"paused room with control for everyone","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"paused","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"everyone","locked":true,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"rate 0.5","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":0.5,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"rate 2","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":2,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"rev written as 42.0","input":{"room":{"rev":42.0,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"rev written with an exponent","input":{"room":{"rev":4.2e1,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"atMs 2^53 - 1","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":9007199254740991,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"action by a participant","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"seek","by":"p2"}}},"expect":{"valid":true}}, + {"name":"action by a peer who has left","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"pause","by":"p3"}}},"expect":{"valid":true}}, + {"name":"action by the relay","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"ended","by":null}}},"expect":{"valid":true}}, + {"name":"action of a kind this SDK doesn't know","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"chapter","by":"p1"}}},"expect":{"valid":true}}, + {"name":"action with unknown members","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"seek","by":"p1","rev":41}}},"expect":{"valid":true}}, + {"name":"lastAction is an unknown member","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"lastAction":"seek"}},"expect":{"valid":true}}, + {"name":"match without deltaMs","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":{"state":"searching"},"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"negative offsetMs","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":-2500}]}},"expect":{"valid":true}}, + {"name":"positionMs 604800000","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"paused","positionMs":604800000,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"offsetMs 604800000","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":604800000}]}},"expect":{"valid":true}}, + {"name":"offsetMs -604800000","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":-604800000}]}},"expect":{"valid":true}}, + {"name":"unknown members are ignored","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0,"avatar":"x"},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"theme":"dark"}},"expect":{"valid":true}}, + {"name":"peer IDs of 16 characters","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"Ab-_0123456789xy","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":true}}, + {"name":"not an object","input":{"room":[42]},"expect":{"valid":false}}, + {"name":"rev missing","input":{"room":{"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"code missing","input":{"room":{"rev":42,"epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"epoch missing","input":{"room":{"rev":42,"code":"K7MQ2X","phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"phase missing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"positionMs missing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"atMs missing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"rate missing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"control missing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"locked missing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"waitingOn missing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"participants missing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[]}},"expect":{"valid":false}}, + {"name":"rev 0","input":{"room":{"rev":0,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"rev not integral","input":{"room":{"rev":42.5,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"rev a string","input":{"room":{"rev":"42","code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"code in lower case","input":{"room":{"rev":42,"code":"k7mq2x","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"code of 5 symbols","input":{"room":{"rev":42,"code":"K7MQ2","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"code with a letter outside the alphabet","input":{"room":{"rev":42,"code":"K7MQ2I","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"epoch negative","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":-1,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"phase unknown","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"stopped","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"phase upper case","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"Playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"positionMs negative","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":-1,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"positionMs 604800001","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"paused","positionMs":604800001,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"positionMs too large for a double","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":1e400,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"atMs negative","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":-1,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"atMs 2^53","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":9007199254740992,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"rate 0.49","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":0.49,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"rate 2.01","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":2.01,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"rate 0","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"rate negative","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":-1,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"rate a string","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":"1.0","control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"rate null","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":null,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"control unknown","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"all","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"locked a string","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":"false","waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"locked a number","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":0,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"waitingOn not an array","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"waiting","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":"p2","participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"waitingOn holds a number","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"waiting","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[2],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"waitingOn holds a bad peer ID","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"waiting","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":["p 2"],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"waitingOn holds a peer ID twice","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"waiting","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":["p2","p2"],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"waitingOn not empty while playing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":["p2"],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"idle room at a position","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"idle","positionMs":5,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"action null","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":null}},"expect":{"valid":false}}, + {"name":"action a string","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":"seek"}},"expect":{"valid":false}}, + {"name":"action without kind","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"by":"p1"}}},"expect":{"valid":false}}, + {"name":"action kind empty","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"","by":"p1"}}},"expect":{"valid":false}}, + {"name":"action kind a number","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":3,"by":"p1"}}},"expect":{"valid":false}}, + {"name":"action without by","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"seek"}}},"expect":{"valid":false}}, + {"name":"action by a number","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"seek","by":2}}},"expect":{"valid":false}}, + {"name":"action by an empty peer ID","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"seek","by":""}}},"expect":{"valid":false}}, + {"name":"action by a peer ID of 17 characters","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"seek","by":"Ab-_0123456789xyz"}}},"expect":{"valid":false}}, + {"name":"participants empty","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[]}},"expect":{"valid":false}}, + {"name":"participants not an array","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0}}},"expect":{"valid":false}}, + {"name":"participant not an object","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},"p2"]}},"expect":{"valid":false}}, + {"name":"no host","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":false,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"two hosts","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":true,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"host a string","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":"false","connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"connected missing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"peer ID of 17 characters","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"Ab-_0123456789xyz","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"peer ID empty","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"peer ID with a dot","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p.2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"name of 33 characters","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"name with a right-to-left override","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"\u202eannA","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"name with an unpaired surrogate","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna\ud800","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"client without a slash","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"player unknown","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"playing","match":null,"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"match a string","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":"matched","offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"match state unknown","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":{"state":"found"},"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"match deltaMs not integral","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":{"state":"mismatched","deltaMs":1.5},"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"match deltaMs -2^63","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":{"state":"mismatched","deltaMs":-9223372036854775808},"offsetMs":0}]}},"expect":{"valid":false}}, + {"name":"offsetMs not integral","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":0.5}]}},"expect":{"valid":false}}, + {"name":"offsetMs 604800001","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":604800001}]}},"expect":{"valid":false}}, + {"name":"offsetMs -604800001","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null,"offsetMs":-604800001}]}},"expect":{"valid":false}}, + {"name":"offsetMs missing","input":{"room":{"rev":42,"code":"K7MQ2X","epoch":3,"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.0,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"ready","match":{"state":"matched","deltaMs":-120},"offsetMs":0},{"peerId":"p2","name":"Anna","client":"Sample/2.4.0","host":false,"connected":false,"player":"idle","match":null}]}},"expect":{"valid":false}} + ] +} diff --git a/rust-modules/owp/fixtures/vectors/same-title.json b/rust-modules/owp/fixtures/vectors/same-title.json new file mode 100644 index 0000000000..7cdb70c652 --- /dev/null +++ b/rust-modules/owp/fixtures/vectors/same-title.json @@ -0,0 +1,36 @@ +{ + "table": "same-title", + "cases": [ + {"name":"movie: shared imdb","input":{"a":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277"},"durationMs":10200000},"b":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000}},"expect":{"same":true}}, + {"name":"movie: shared tmdb only","input":{"a":{"kind":"movie","title":"Heat","year":1995,"ids":{"tmdb":"949"},"durationMs":10200000},"b":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000}},"expect":{"same":true}}, + {"name":"movie: shared plex guid","input":{"a":{"kind":"movie","title":"Heat","year":1995,"ids":{"plex":"plex://movie/5d776825880197001ec967c9"},"durationMs":10200000},"b":{"kind":"movie","title":"Heat","year":1995,"ids":{"plex":"plex://movie/5d776825880197001ec967c9"},"durationMs":10200000}},"expect":{"same":true}}, + {"name":"movie: one shared ID is enough","input":{"a":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"949"},"durationMs":10200000},"b":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277","tmdb":"950"},"durationMs":10200000}},"expect":{"same":true}}, + {"name":"movie: no shared ID","input":{"a":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277"},"durationMs":10200000},"b":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113278","tmdb":"949"},"durationMs":10200000}},"expect":{"same":false}}, + {"name":"movie: same value in another namespace","input":{"a":{"kind":"movie","title":"Heat","year":1995,"ids":{"tmdb":"949"},"durationMs":10200000},"b":{"kind":"movie","title":"Heat","year":1995,"ids":{"tvdb":"949"},"durationMs":10200000}},"expect":{"same":false}}, + {"name":"movie: unknown namespace doesn't count","input":{"a":{"kind":"movie","title":"Heat","year":1995,"ids":{"trakt":"1234"},"durationMs":10200000},"b":{"kind":"movie","title":"Heat","year":1995,"ids":{"trakt":"1234"},"durationMs":10200000}},"expect":{"same":false}}, + {"name":"movie: IDs on one side only","input":{"a":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277"},"durationMs":10200000},"b":{"kind":"movie","title":"Heat","year":1995,"durationMs":10200000}},"expect":{"same":false}}, + {"name":"movie: no IDs","input":{"a":{"kind":"movie","title":"Heat","year":1995,"durationMs":10200000},"b":{"kind":"movie","title":"Heat","year":1995,"durationMs":10200000}},"expect":{"same":false}}, + {"name":"movie: IDs compare exactly","input":{"a":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0113277"},"durationMs":10200000},"b":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"TT0113277"},"durationMs":10200000}},"expect":{"same":false}}, + {"name":"movie vs episode","input":{"a":{"kind":"movie","title":"Heat","year":1995,"ids":{"imdb":"tt0959621"},"durationMs":10200000},"b":{"kind":"episode","title":"Pilot","ids":{"imdb":"tt0959621"},"series":{"title":"Breaking Bad"},"season":1,"episode":1,"durationMs":3487000}},"expect":{"same":false}}, + {"name":"episode: shared episode ID","input":{"a":{"kind":"episode","title":"Pilot","ids":{"imdb":"tt0959621"},"series":{"title":"Breaking Bad"},"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","ids":{"imdb":"tt0959621","tvdb":"349232"},"series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000}},"expect":{"same":true}}, + {"name":"episode: shared episode ID beats different numbers","input":{"a":{"kind":"episode","title":"Pilot","ids":{"tvdb":"349232"},"series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","ids":{"tvdb":"349232"},"series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":0,"episode":7,"durationMs":3487000}},"expect":{"same":true}}, + {"name":"episode: shared series ID and numbers","input":{"a":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"tmdb":"1396","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000}},"expect":{"same":true}}, + {"name":"episode: shared series ID, other episode","input":{"a":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":2,"durationMs":3487000}},"expect":{"same":false}}, + {"name":"episode: shared series ID, other season","input":{"a":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":2,"episode":1,"durationMs":3487000}},"expect":{"same":false}}, + {"name":"episode: shared series ID, one without season","input":{"a":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000}},"expect":{"same":false}}, + {"name":"episode: series IDs in different namespaces","input":{"a":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747"}},"season":1,"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"tmdb":"1396"}},"season":1,"episode":1,"durationMs":3487000}},"expect":{"same":false}}, + {"name":"episode: one without series IDs","input":{"a":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad"},"season":1,"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000}},"expect":{"same":false}}, + {"name":"episode: anilist series","input":{"a":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"anilist":"21"}},"season":1,"episode":1000,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"anilist":"21","mal":"21"}},"season":1,"episode":1000,"durationMs":3487000}},"expect":{"same":true}}, + {"name":"episode: different episode IDs beat equal numbers","input":{"a":{"kind":"episode","title":"Pilot","ids":{"imdb":"tt0959621"},"series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","ids":{"imdb":"tt1054724"},"series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000}},"expect":{"same":false}}, + {"name":"episode: episode ID on one side only, equal numbers","input":{"a":{"kind":"episode","title":"Pilot","ids":{"imdb":"tt0959621"},"series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000}},"expect":{"same":true}}, + {"name":"episode: episode IDs in different namespaces, equal numbers","input":{"a":{"kind":"episode","title":"Pilot","ids":{"imdb":"tt0959621"},"series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","ids":{"tvdb":"349232"},"series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000}},"expect":{"same":true}}, + {"name":"episode: different unknown-namespace IDs don't count","input":{"a":{"kind":"episode","title":"Pilot","ids":{"trakt":"62085"},"series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000},"b":{"kind":"episode","title":"Pilot","ids":{"trakt":"62086"},"series":{"title":"Breaking Bad","ids":{"imdb":"tt0903747","tvdb":"81189"}},"season":1,"episode":1,"durationMs":3487000}},"expect":{"same":true}}, + {"name":"video: same oshash","input":{"a":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"oshash":"00ff00ff00ff00ff"}},"b":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"oshash":"00ff00ff00ff00ff","name":"x.mp4"}}},"expect":{"same":true}}, + {"name":"video: same size and name, name case-insensitive","input":{"a":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"sizeBytes":1200000000,"name":"wedding.mp4"}},"b":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"sizeBytes":1200000000,"name":"Wedding.MP4"}}},"expect":{"same":true}}, + {"name":"video: same size, other name","input":{"a":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"sizeBytes":1200000000,"name":"wedding.mp4"}},"b":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"sizeBytes":1200000000,"name":"wedding (1).mp4"}}},"expect":{"same":false}}, + {"name":"video: same name, one size missing","input":{"a":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"name":"wedding.mp4"}},"b":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"sizeBytes":1200000000,"name":"wedding.mp4"}}},"expect":{"same":false}}, + {"name":"video: different oshash, same size and name","input":{"a":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"sizeBytes":5,"oshash":"1111111111111111","name":"a.mp4"}},"b":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"sizeBytes":5,"oshash":"2222222222222222","name":"a.mp4"}}},"expect":{"same":true}}, + {"name":"video: one without file","input":{"a":{"kind":"video","title":"Wedding","durationMs":5400000},"b":{"kind":"video","title":"Wedding","durationMs":5400000,"file":{"oshash":"00ff00ff00ff00ff"}}},"expect":{"same":false}}, + {"name":"video: IDs don't count","input":{"a":{"kind":"video","title":"a","ids":{"imdb":"tt1"},"durationMs":1},"b":{"kind":"video","title":"a","ids":{"imdb":"tt1"},"durationMs":1}},"expect":{"same":false}} + ] +} diff --git a/rust-modules/owp/fixtures/vectors/timeline.json b/rust-modules/owp/fixtures/vectors/timeline.json new file mode 100644 index 0000000000..834fcca9f6 --- /dev/null +++ b/rust-modules/owp/fixtures/vectors/timeline.json @@ -0,0 +1,31 @@ +{ + "table": "timeline", + "cases": [ + {"name":"idle holds positionMs","input":{"room":{"phase":"idle","positionMs":0,"atMs":1000,"rate":1},"durationMs":3487000,"serverNowMs":50000},"expect":{"positionMs":0,"running":false}}, + {"name":"paused ignores time","input":{"room":{"phase":"paused","positionMs":61234,"atMs":1000,"rate":1},"durationMs":3487000,"serverNowMs":900000},"expect":{"positionMs":61234,"running":false}}, + {"name":"waiting ignores time","input":{"room":{"phase":"waiting","positionMs":61234,"atMs":1000,"rate":1},"durationMs":3487000,"serverNowMs":900000},"expect":{"positionMs":61234,"running":false}}, + {"name":"paused at durationMs","input":{"room":{"phase":"paused","positionMs":3487000,"atMs":1000,"rate":1},"durationMs":3487000,"serverNowMs":5000},"expect":{"positionMs":3487000,"running":false}}, + {"name":"paused ignores rate","input":{"room":{"phase":"paused","positionMs":61234,"atMs":1000,"rate":2},"durationMs":3487000,"serverNowMs":900000},"expect":{"positionMs":61234,"running":false}}, + {"name":"playing at atMs","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":918273645},"expect":{"positionMs":61234,"running":true}}, + {"name":"playing 1 ms before atMs is a scheduled start","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":918273644},"expect":{"positionMs":61234,"running":false}}, + {"name":"playing 1500 ms before atMs is a scheduled start","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":918272145},"expect":{"positionMs":61234,"running":false}}, + {"name":"playing 1 ms after atMs","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":918273646},"expect":{"positionMs":61235,"running":true}}, + {"name":"playing 1000 ms at rate 1","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":918274645},"expect":{"positionMs":62234,"running":true}}, + {"name":"rate 1.25 floors","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.25},"durationMs":3487000,"serverNowMs":918274644},"expect":{"positionMs":62482,"running":true}}, + {"name":"rate 0.5 floors","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":0.5},"durationMs":3487000,"serverNowMs":918273648},"expect":{"positionMs":61235,"running":true}}, + {"name":"rate 0.5 one millisecond","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":0.5},"durationMs":3487000,"serverNowMs":918273646},"expect":{"positionMs":61234,"running":true}}, + {"name":"rate 2","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":2},"durationMs":3487000,"serverNowMs":918274645},"expect":{"positionMs":63234,"running":true}}, + {"name":"rate 1.1 uses double arithmetic","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.1},"durationMs":3487000,"serverNowMs":918273652},"expect":{"positionMs":61241,"running":true}}, + {"name":"rate 1.15: the product is a double (114.99999999999999)","input":{"room":{"phase":"playing","positionMs":0,"atMs":918273645,"rate":1.15},"durationMs":3487000,"serverNowMs":918273745},"expect":{"positionMs":114,"running":true}}, + {"name":"rate 1.15: the floor applies to the whole sum","input":{"room":{"phase":"playing","positionMs":61234,"atMs":918273645,"rate":1.15},"durationMs":3487000,"serverNowMs":918273665},"expect":{"positionMs":61257,"running":true}}, + {"name":"from zero at relay start","input":{"room":{"phase":"playing","positionMs":0,"atMs":0,"rate":1},"durationMs":3487000,"serverNowMs":0},"expect":{"positionMs":0,"running":true}}, + {"name":"one hour in","input":{"room":{"phase":"playing","positionMs":0,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":921873645},"expect":{"positionMs":3487000,"running":true}}, + {"name":"cap: 1 ms before durationMs","input":{"room":{"phase":"playing","positionMs":3486000,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":918274644},"expect":{"positionMs":3486999,"running":true}}, + {"name":"cap: exactly durationMs","input":{"room":{"phase":"playing","positionMs":3486000,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":918274645},"expect":{"positionMs":3487000,"running":true}}, + {"name":"cap: 1 ms past durationMs","input":{"room":{"phase":"playing","positionMs":3486000,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":918274646},"expect":{"positionMs":3487000,"running":true}}, + {"name":"cap: far past durationMs","input":{"room":{"phase":"playing","positionMs":3486000,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":918873645},"expect":{"positionMs":3487000,"running":true}}, + {"name":"cap at rate 2","input":{"room":{"phase":"playing","positionMs":3486000,"atMs":918273645,"rate":2},"durationMs":3487000,"serverNowMs":918274146},"expect":{"positionMs":3487000,"running":true}}, + {"name":"cap on a short clip","input":{"room":{"phase":"playing","positionMs":0,"atMs":918273645,"rate":1},"durationMs":5000,"serverNowMs":918278646},"expect":{"positionMs":5000,"running":true}}, + {"name":"positionMs already at durationMs","input":{"room":{"phase":"playing","positionMs":3487000,"atMs":918273645,"rate":1},"durationMs":3487000,"serverNowMs":918273655},"expect":{"positionMs":3487000,"running":true}} + ] +} diff --git a/rust-modules/owp/src/clock.rs b/rust-modules/owp/src/clock.rs new file mode 100644 index 0000000000..945df078f0 --- /dev/null +++ b/rust-modules/owp/src/clock.rs @@ -0,0 +1,117 @@ +#![deny(clippy::wildcard_enum_match_arm)] + +use std::collections::{BTreeMap, VecDeque}; + +pub const CLOCK_WINDOW: usize = 8; +pub const LARGEST_RTT_MS: i64 = 1000; +pub const CLOCK_STEP_SLACK_MS: i64 = 100; +pub const FORGET_PING_AFTER_MS: i64 = 10_000; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Sample { + pub offset_ms: i64, + pub rtt_ms: i64, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ClockEvent { + PingSent { id: i64, at_ms: i64 }, + PongReceived { id: i64, server_time: i64, at_ms: i64 }, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum PongOutcome { + Accepted, + Stepped, + Ignored, +} + +#[derive(Debug)] +pub struct ClockSync { + sent: BTreeMap, + window: VecDeque, + best: Option, +} + +impl Default for ClockSync { + fn default() -> ClockSync { + ClockSync::new() + } +} + +fn steps(best: Option, sample: Sample) -> bool { + match best { + Some(best) => (sample.offset_ms - best.offset_ms).abs() > (sample.rtt_ms + best.rtt_ms) / 2 + CLOCK_STEP_SLACK_MS, + None => false, + } +} + +impl ClockSync { + pub fn new() -> ClockSync { + ClockSync { sent: BTreeMap::new(), window: VecDeque::new(), best: None } + } + + pub fn best(&self) -> Option { + self.best + } + + pub fn step(&mut self, event: ClockEvent, outcomes: &mut Vec) { + self.transition(event, outcomes); + } + + fn transition(&mut self, event: ClockEvent, outcomes: &mut Vec) { + match event { + ClockEvent::PingSent { id, at_ms } => { + self.sent.retain(|_, sent_at| at_ms - *sent_at <= FORGET_PING_AFTER_MS); + self.sent.insert(id, at_ms); + } + ClockEvent::PongReceived { id, server_time, at_ms } => { + let Some(sent_at) = self.sent.remove(&id) else { + outcomes.push(PongOutcome::Ignored); + return; + }; + let rtt_ms = at_ms - sent_at; + if !(0..=LARGEST_RTT_MS).contains(&rtt_ms) { + outcomes.push(PongOutcome::Ignored); + return; + } + let sample = Sample { offset_ms: server_time - (sent_at + rtt_ms / 2), rtt_ms }; + let stepped = steps(self.best, sample); + if stepped { + self.window.clear(); + } + self.window.push_back(sample); + if self.window.len() > CLOCK_WINDOW { + self.window.pop_front(); + } + let mut best: Option = None; + for kept in self.window.iter() { + match best { + Some(current) if current.rtt_ms <= kept.rtt_ms => {} + Some(_) | None => best = Some(*kept), + } + } + self.best = best; + outcomes.push(if stepped { PongOutcome::Stepped } else { PongOutcome::Accepted }); + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_ping_unanswered_for_longer_than_the_forget_time_is_dropped() { + let mut clock = ClockSync::new(); + let mut outcomes = Vec::new(); + clock.step(ClockEvent::PingSent { id: 1, at_ms: 0 }, &mut outcomes); + clock.step(ClockEvent::PingSent { id: 2, at_ms: FORGET_PING_AFTER_MS }, &mut outcomes); + assert_eq!(clock.sent.keys().copied().collect::>(), [1, 2]); + clock.step(ClockEvent::PingSent { id: 3, at_ms: FORGET_PING_AFTER_MS + 1 }, &mut outcomes); + assert_eq!(clock.sent.keys().copied().collect::>(), [2, 3]); + clock.step(ClockEvent::PongReceived { id: 1, server_time: 0, at_ms: FORGET_PING_AFTER_MS + 2 }, &mut outcomes); + assert_eq!(outcomes, [PongOutcome::Ignored]); + } +} diff --git a/rust-modules/owp/src/code.rs b/rust-modules/owp/src/code.rs new file mode 100644 index 0000000000..c376fd4cc8 --- /dev/null +++ b/rust-modules/owp/src/code.rs @@ -0,0 +1,59 @@ +use crate::relays::Relay; + +pub const CODE_ALPHABET: &str = "23456789ABCDEFGHJKMNPQRSTUVWXYZ"; +pub const CODE_LENGTH: usize = 6; + +fn is_separator(c: char) -> bool { + matches!(c, '\u{20}' | '\u{9}' | '\u{A}' | '\u{D}' | '\u{A0}' | '\u{2007}' | '\u{202F}' | '-' | '\u{2010}'..='\u{2014}' | '\u{2212}') +} + +pub fn is_room_code(code: &str) -> bool { + code.len() == CODE_LENGTH && code.chars().all(|c| CODE_ALPHABET.contains(c)) +} + +pub fn normalize(typed: &str) -> Option { + let code: String = typed.chars().filter(|c| !is_separator(*c)).map(|c| c.to_ascii_uppercase()).collect(); + is_room_code(&code).then_some(code) +} + +pub fn format(typed: &str) -> Option { + let code = normalize(typed)?; + Some(format!("{}-{}", &code[..3], &code[3..])) +} + +pub fn relay_for<'a>(typed: &str, relays: &'a [Relay]) -> Option<&'a Relay> { + let first = normalize(typed)?.chars().next()?; + relays.iter().find(|relay| relay.prefixes.contains(first)) +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::relays::embedded_public_list; + + fn routed(typed: &str) -> Option { + relay_for(typed, &embedded_public_list().unwrap()).map(|relay| relay.id.clone()) + } + + #[test] + fn a_typed_code_is_grouped_for_display() { + assert_eq!(format("k7m q2x").as_deref(), Some("K7M-Q2X")); + assert_eq!(format("K7MQ2"), None); + } + + #[test] + fn a_typed_code_is_normalized_before_it_routes() { + assert_eq!(routed("k7m-q2x").as_deref(), Some("asia")); + assert_eq!(routed(" k7m\u{2014}q2x\u{A0}").as_deref(), Some("asia")); + assert_eq!(routed("9ab cde").as_deref(), Some("eu")); + } + + #[test] + fn an_invalid_code_routes_nowhere() { + assert_eq!(routed("K"), None); + assert_eq!(routed("K7MQ2"), None); + assert_eq!(routed("K7M-Q2X7"), None); + assert_eq!(routed("K7M-Q2O"), None); + assert_eq!(routed("QRS-TUV"), None); + } +} diff --git a/rust-modules/owp/src/json.rs b/rust-modules/owp/src/json.rs new file mode 100644 index 0000000000..9fc68179af --- /dev/null +++ b/rust-modules/owp/src/json.rs @@ -0,0 +1,609 @@ +use serde::de::{DeserializeSeed, Deserializer, Error as _, MapAccess, SeqAccess, Visitor}; +use std::cell::Cell; +use std::collections::{BTreeMap, BTreeSet}; +use std::fmt; + +pub const MAX_SAFE_INT: i64 = 9_007_199_254_740_991; +pub const DISAGREEMENT: &str = "the reader and the scan disagree"; + +#[derive(Debug, Clone, PartialEq)] +pub enum Json { + Null, + Bool(bool), + Int(i64), + Float(f64), + Str(Text), + Array(Vec), + Object(Vec<(Text, Json)>), +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Text { + pub value: String, + pub unpaired: bool, +} + +impl Text { + pub fn new(value: &str) -> Text { + Text { value: value.to_owned(), unpaired: false } + } +} + +struct Scan { + text: String, + marked: BTreeSet, + strings: usize, + overflow: BTreeMap, + numbers: usize, + escapes: usize, +} + +const REPLACEMENT_ESCAPE: &[u8; 6] = b"\\ufffd"; + +fn hex4_at(bytes: &[u8], at: usize) -> Option { + let digits = bytes.get(at..at + 4)?; + if !digits.iter().all(u8::is_ascii_hexdigit) { + return None; + } + u16::from_str_radix(std::str::from_utf8(digits).ok()?, 16).ok() +} + +fn unicode_escape_at(bytes: &[u8], at: usize) -> Option { + if bytes.get(at) == Some(&b'\\') && bytes.get(at + 1) == Some(&b'u') { + hex4_at(bytes, at + 2) + } else { + None + } +} + +fn is_high_surrogate(unit: u16) -> bool { + (0xD800..=0xDBFF).contains(&unit) +} + +fn is_low_surrogate(unit: u16) -> bool { + (0xDC00..=0xDFFF).contains(&unit) +} + +fn number_end(bytes: &[u8], start: usize) -> usize { + let mut end = start; + while bytes.get(end).is_some_and(|b| b.is_ascii_digit() || b"+-.eE".contains(b)) { + end += 1; + } + end +} + +fn digits_from(bytes: &[u8], mut at: usize) -> usize { + while bytes.get(at).is_some_and(u8::is_ascii_digit) { + at += 1; + } + at +} + +fn is_json_number(token: &str) -> bool { + let bytes = token.as_bytes(); + let mut at = usize::from(bytes.first() == Some(&b'-')); + match bytes.get(at) { + Some(b'0') => at += 1, + Some(b'1'..=b'9') => at = digits_from(bytes, at), + _ => return false, + } + if bytes.get(at) == Some(&b'.') { + let end = digits_from(bytes, at + 1); + if end == at + 1 { + return false; + } + at = end; + } + if matches!(bytes.get(at), Some(b'e' | b'E')) { + at += 1; + if matches!(bytes.get(at), Some(b'+' | b'-')) { + at += 1; + } + let end = digits_from(bytes, at); + if end == at { + return false; + } + at = end; + } + at == bytes.len() +} + +fn scan(input: &str) -> Result { + let bytes = input.as_bytes(); + let mut out = bytes.to_vec(); + let mut marked = BTreeSet::new(); + let mut overflow = BTreeMap::new(); + let (mut strings, mut numbers, mut escapes) = (0, 0, 0); + let mut in_string = false; + let mut i = 0; + while i < bytes.len() { + let byte = bytes[i]; + if !in_string && (byte == b'-' || byte.is_ascii_digit()) { + let end = number_end(bytes, i); + if let Some(number) = input.get(i..end).filter(|token| is_json_number(token)).and_then(|token| token.parse::().ok()) { + if number.is_infinite() { + out[i] = b'0'; + out[i + 1..end].fill(b' '); + overflow.insert(numbers, number.is_sign_negative()); + } + } + numbers += 1; + i = end; + continue; + } + if !in_string { + in_string = byte == b'"'; + i += 1; + continue; + } + if byte == b'"' { + in_string = false; + strings += 1; + i += 1; + continue; + } + if byte != b'\\' { + i += 1; + continue; + } + let Some(unit) = unicode_escape_at(bytes, i) else { + i += 2; + continue; + }; + if is_high_surrogate(unit) && unicode_escape_at(bytes, i + 6).is_some_and(is_low_surrogate) { + i += 12; + continue; + } + if is_high_surrogate(unit) || is_low_surrogate(unit) { + out[i..i + 6].copy_from_slice(REPLACEMENT_ESCAPE); + marked.insert(strings); + escapes += 1; + } + i += 6; + } + let text = String::from_utf8(out).map_err(|_| serde_json::Error::custom("the scan broke the UTF-8 of its input"))?; + Ok(Scan { text, marked, strings, overflow, numbers, escapes }) +} + +#[derive(Clone, Copy)] +struct Seed<'a> { + marked: &'a BTreeSet, + next_string: &'a Cell, + overflow: &'a BTreeMap, + next_number: &'a Cell, + marks: &'a Cell, + infinities: &'a Cell, +} + +impl Seed<'_> { + fn text(self, value: &str) -> Text { + let ordinal = self.next_string.get(); + self.next_string.set(ordinal + 1); + let unpaired = self.marked.contains(&ordinal); + if unpaired { + self.marks.set(self.marks.get() + 1); + } + Text { value: value.to_owned(), unpaired } + } + + fn number(self, value: Json) -> Json { + let ordinal = self.next_number.get(); + self.next_number.set(ordinal + 1); + let Some(&negative) = self.overflow.get(&ordinal) else { return value }; + self.infinities.set(self.infinities.get() + 1); + Json::Float(if negative { f64::NEG_INFINITY } else { f64::INFINITY }) + } +} + +impl<'de> DeserializeSeed<'de> for Seed<'_> { + type Value = Json; + fn deserialize>(self, deserializer: D) -> Result { + deserializer.deserialize_any(self) + } +} + +impl<'de> Visitor<'de> for Seed<'_> { + type Value = Json; + + fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("a JSON value") + } + + fn visit_unit(self) -> Result { + Ok(Json::Null) + } + + fn visit_bool(self, v: bool) -> Result { + Ok(Json::Bool(v)) + } + + fn visit_i64(self, v: i64) -> Result { + Ok(self.number(Json::Int(v))) + } + + fn visit_u64(self, v: u64) -> Result { + Ok(self.number(i64::try_from(v).map_or(Json::Float(v as f64), Json::Int))) + } + + fn visit_f64(self, v: f64) -> Result { + Ok(self.number(Json::Float(v))) + } + + fn visit_str(self, v: &str) -> Result { + Ok(Json::Str(self.text(v))) + } + + fn visit_seq>(self, mut seq: A) -> Result { + let mut items = Vec::new(); + while let Some(item) = seq.next_element_seed(self)? { + items.push(item); + } + Ok(Json::Array(items)) + } + + fn visit_map>(self, mut map: A) -> Result { + let mut members = Vec::new(); + while let Some(key) = map.next_key_seed(KeySeed(self))? { + let value = map.next_value_seed(self)?; + members.push((key, value)); + } + Ok(Json::Object(members)) + } +} + +struct KeySeed<'a>(Seed<'a>); + +impl<'de> DeserializeSeed<'de> for KeySeed<'_> { + type Value = Text; + fn deserialize>(self, deserializer: D) -> Result { + deserializer.deserialize_str(self) + } +} + +impl<'de> Visitor<'de> for KeySeed<'_> { + type Value = Text; + + fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("a member name") + } + + fn visit_str(self, v: &str) -> Result { + Ok(self.0.text(v)) + } +} + +pub struct Read { + pub value: Json, + pub unpaired_escapes: usize, +} + +pub fn read(input: &str) -> Result { + read_scanned(scan(input)?) +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Scanned { + pub length: usize, + pub marked: Vec, + pub overflowing: Vec, +} + +pub fn scanned(input: &str) -> Result { + let scan = scan(input)?; + Ok(Scanned { length: scan.text.len(), marked: scan.marked.into_iter().collect(), overflowing: scan.overflow.into_keys().collect() }) +} + +fn read_scanned(scan: Scan) -> Result { + let (next_string, next_number, marks, infinities) = (Cell::new(0), Cell::new(0), Cell::new(0), Cell::new(0)); + let seed = Seed { + marked: &scan.marked, + next_string: &next_string, + overflow: &scan.overflow, + next_number: &next_number, + marks: &marks, + infinities: &infinities, + }; + let mut deserializer = serde_json::Deserializer::from_str(&scan.text); + let value = seed.deserialize(&mut deserializer)?; + deserializer.end()?; + let seen = [next_string.get(), next_number.get(), marks.get(), infinities.get()]; + if seen != [scan.strings, scan.numbers, scan.marked.len(), scan.overflow.len()] { + return Err(serde_json::Error::custom(DISAGREEMENT)); + } + Ok(Read { value, unpaired_escapes: scan.escapes }) +} + +impl Json { + pub fn get(&self, name: &str) -> Option<&Json> { + match self { + Json::Object(members) => members.iter().find(|(key, _)| key.value == name).map(|(_, value)| value), + Json::Null | Json::Bool(_) | Json::Int(_) | Json::Float(_) | Json::Str(_) | Json::Array(_) => None, + } + } + + pub fn members(&self) -> Option<&[(Text, Json)]> { + match self { + Json::Object(members) => Some(members), + Json::Null | Json::Bool(_) | Json::Int(_) | Json::Float(_) | Json::Str(_) | Json::Array(_) => None, + } + } + + pub fn as_text(&self) -> Option<&Text> { + match self { + Json::Str(text) => Some(text), + Json::Null | Json::Bool(_) | Json::Int(_) | Json::Float(_) | Json::Array(_) | Json::Object(_) => None, + } + } + + pub fn as_int(&self) -> Option { + match self { + Json::Int(i) if i.unsigned_abs() <= MAX_SAFE_INT.unsigned_abs() => Some(*i), + Json::Float(f) if f.is_finite() && f.fract() == 0.0 && f.abs() <= MAX_SAFE_INT as f64 => Some(*f as i64), + _ => None, + } + } + + pub fn as_number(&self) -> Option { + match self { + Json::Int(i) => Some(*i as f64), + Json::Float(f) if f.is_finite() => Some(*f), + _ => None, + } + } + + pub fn repeats_a_member_name(&self) -> bool { + match self { + Json::Object(members) => { + let mut seen = BTreeSet::new(); + members.iter().any(|(key, value)| !seen.insert(key.value.as_str()) || value.repeats_a_member_name()) + } + Json::Array(items) => items.iter().any(Json::repeats_a_member_name), + Json::Null | Json::Bool(_) | Json::Int(_) | Json::Float(_) | Json::Str(_) => false, + } + } + + pub fn holds_unpaired(&self) -> bool { + match self { + Json::Str(text) => text.unpaired, + Json::Array(items) => items.iter().any(Json::holds_unpaired), + Json::Object(members) => members.iter().any(|(key, value)| key.unpaired || value.holds_unpaired()), + Json::Null | Json::Bool(_) | Json::Int(_) | Json::Float(_) => false, + } + } + + pub fn holds_a_non_finite_number(&self) -> bool { + match self { + Json::Float(f) => !f.is_finite(), + Json::Array(items) => items.iter().any(Json::holds_a_non_finite_number), + Json::Object(members) => members.iter().any(|(_, value)| value.holds_a_non_finite_number()), + Json::Null | Json::Bool(_) | Json::Int(_) | Json::Str(_) => false, + } + } + + pub fn write_compact(&self, out: &mut String) { + match self { + Json::Null => out.push_str("null"), + Json::Bool(b) => out.push_str(if *b { "true" } else { "false" }), + Json::Int(i) => out.push_str(&i.to_string()), + Json::Float(f) => match self.as_int() { + Some(i) => out.push_str(&i.to_string()), + None => out.push_str(&serde_json::to_string(f).unwrap_or_default()), + }, + Json::Str(text) => write_string(&text.value, out), + Json::Array(items) => { + out.push('['); + for (index, item) in items.iter().enumerate() { + if index > 0 { + out.push(','); + } + item.write_compact(out); + } + out.push(']'); + } + Json::Object(members) => { + out.push('{'); + for (index, (name, member)) in members.iter().enumerate() { + if index > 0 { + out.push(','); + } + write_string(&name.value, out); + out.push(':'); + member.write_compact(out); + } + out.push('}'); + } + } + } + + pub fn compact(&self) -> String { + let mut out = String::new(); + self.write_compact(&mut out); + out + } +} + +fn write_string(value: &str, out: &mut String) { + out.push_str(&serde_json::to_string(value).unwrap_or_default()); +} + +#[cfg(test)] +mod tests { + use super::*; + + fn marks(input: &str) -> Vec { + fn walk(value: &Json, found: &mut Vec) { + match value { + Json::Str(text) => found.push(text.unpaired), + Json::Array(items) => items.iter().for_each(|item| walk(item, found)), + Json::Object(members) => members.iter().for_each(|(key, value)| { + found.push(key.unpaired); + walk(value, found); + }), + Json::Null | Json::Bool(_) | Json::Int(_) | Json::Float(_) => {} + } + } + let mut found = Vec::new(); + walk(&read(input).unwrap().value, &mut found); + found + } + + fn string(value: &str, unpaired: bool) -> Json { + Json::Str(Text { value: value.into(), unpaired }) + } + + #[test] + fn a_lone_high_surrogate_is_marked() { + assert_eq!(marks(r#"["Anna\ud800"]"#), [true]); + } + + #[test] + fn a_lone_low_surrogate_is_marked() { + assert_eq!(marks(r#"["\ude00x"]"#), [true]); + } + + #[test] + fn upper_case_hex_is_read() { + assert_eq!(marks(r#"["a\uD800"]"#), [true]); + } + + #[test] + fn a_pair_is_not_marked() { + assert_eq!(read(r#""\ud83d\ude00""#).unwrap().value, string("😀", false)); + } + + #[test] + fn reversed_surrogates_are_both_lone() { + let read = read(r#""\ude00\ud83d""#).unwrap(); + assert_eq!(read.unpaired_escapes, 2); + assert_eq!(read.value, string("\u{fffd}\u{fffd}", true)); + } + + #[test] + fn an_escaped_backslash_before_u_is_not_an_escape() { + assert_eq!(marks(r#"["\\ud800"]"#), [false]); + } + + #[test] + fn an_escaped_backslash_then_a_lone_surrogate_is_marked() { + assert_eq!(marks(r#"{"name":"a\\\uD800","client":"x"}"#), [false, true, false, false]); + } + + #[test] + fn an_escaped_backslash_before_a_high_surrogate_is_text() { + let read = read(r#"["\\ud83d"]"#).unwrap(); + assert_eq!(read.unpaired_escapes, 0); + assert_eq!(read.value, Json::Array(vec![string("\\ud83d", false)])); + } + + #[test] + fn an_escaped_backslash_before_a_pair_leaves_the_low_half_lone() { + let read = read(r#"["\\ud83d\ude00"]"#).unwrap(); + assert_eq!(read.unpaired_escapes, 1); + assert_eq!(read.value, Json::Array(vec![string("\\ud83d\u{fffd}", true)])); + } + + #[test] + fn an_odd_run_of_backslashes_ends_in_an_escape() { + assert_eq!(read(r#"["\\\ud83d"]"#).unwrap().value, Json::Array(vec![string("\\\u{fffd}", true)])); + assert_eq!(read(r#"["\\\\ud83d"]"#).unwrap().value, Json::Array(vec![string("\\\\ud83d", false)])); + } + + fn forged(text: &str, strings: usize, marked: &[usize], numbers: usize, overflow: &[usize]) -> Scan { + Scan { + text: text.to_owned(), + marked: marked.iter().copied().collect(), + strings, + overflow: overflow.iter().map(|&ordinal| (ordinal, false)).collect(), + numbers, + escapes: marked.len(), + } + } + + #[test] + fn a_mark_the_visitor_never_applies_is_an_error() { + assert_eq!(read_scanned(forged(r#"["a"]"#, 1, &[3], 0, &[])).err().map(|e| e.to_string()).as_deref(), Some(DISAGREEMENT)); + } + + #[test] + fn an_infinity_the_visitor_never_returns_is_an_error() { + assert_eq!(read_scanned(forged("[1]", 0, &[], 1, &[4])).err().map(|e| e.to_string()).as_deref(), Some(DISAGREEMENT)); + } + + #[test] + fn the_scan_keeps_the_length_and_names_its_marks_and_infinities() { + let input = r#"{"\ud800":[1e400,2,"a","\udc00x",-1e400]}"#; + assert_eq!(scanned(input).unwrap(), Scanned { length: input.len(), marked: vec![0, 2], overflowing: vec![0, 2] }); + } + + #[test] + fn a_scan_the_visitor_agrees_with_reads() { + assert!(read_scanned(forged(r#"["a",1]"#, 1, &[0], 1, &[0])).is_ok()); + } + + #[test] + fn a_real_replacement_character_is_not_marked() { + assert_eq!(marks("[\"\u{fffd}\", \"\\ufffd\"]"), [false, false]); + } + + #[test] + fn a_member_name_is_marked_on_its_own() { + assert_eq!(marks(r#"{"ext":{"com.example\ud800":1,"ok":"\ud800"}}"#), [false, true, false, true]); + } + + #[test] + fn an_escaped_quote_does_not_end_the_string() { + assert_eq!(marks(r#"["a\"b\ud800","c"]"#), [true, false]); + } + + #[test] + fn integers_and_fractions_stay_apart() { + assert_eq!(read("[1, 1.0, 1e0, -3]").unwrap().value, Json::Array(vec![Json::Int(1), Json::Float(1.0), Json::Float(1.0), Json::Int(-3)])); + } + + #[test] + fn a_number_too_large_for_a_double_reads_as_infinity() { + assert_eq!( + read(r#"{"a":1e400,"b":-1e400,"c":"1e400","d":2}"#).unwrap().value, + Json::Object(vec![ + (Text::new("a"), Json::Float(f64::INFINITY)), + (Text::new("b"), Json::Float(f64::NEG_INFINITY)), + (Text::new("c"), string("1e400", false)), + (Text::new("d"), Json::Int(2)), + ]) + ); + } + + #[test] + fn a_number_rounded_past_the_largest_double_reads_as_infinity() { + assert_eq!(read("[1.79769313486231581e308]").unwrap().value, Json::Array(vec![Json::Float(f64::INFINITY)])); + } + + #[test] + fn broken_numbers_stay_errors() { + for text in ["[-]", "[1.2.3]", "[-inf]", "[01]", "[01e400]", "[1.e400]", "[-.5e400]", "[1e+]"] { + assert!(read(text).is_err(), "{text}"); + } + } + + #[test] + fn duplicates_and_order_are_kept() { + let names: Vec<_> = read(r#"{"b":1,"a":2,"b":3}"#).unwrap().value.members().unwrap().iter().map(|(key, _)| key.value.clone()).collect(); + assert_eq!(names, ["b", "a", "b"]); + } + + #[test] + fn broken_text_is_an_error() { + for text in [r#"["\ud800"#, r#"["\u12"]"#, "[1] x"] { + assert!(read(text).is_err(), "{text}"); + } + } + + #[test] + fn an_int_is_integral_and_within_the_safe_range() { + assert_eq!(Json::Float(42.0).as_int(), Some(42)); + assert_eq!(Json::Int(MAX_SAFE_INT).as_int(), Some(MAX_SAFE_INT)); + assert_eq!(Json::Int(MAX_SAFE_INT + 1).as_int(), None); + assert_eq!(Json::Float(1.5).as_int(), None); + assert_eq!(Json::Float(f64::INFINITY).as_int(), None); + } +} diff --git a/rust-modules/owp/src/lib.rs b/rust-modules/owp/src/lib.rs new file mode 100644 index 0000000000..10558231b3 --- /dev/null +++ b/rust-modules/owp/src/lib.rs @@ -0,0 +1,12 @@ +pub mod clock; +pub mod code; +pub mod json; +pub mod media; +pub mod message; +pub mod relays; +pub mod room; +pub mod text; +pub mod timeline; + +#[cfg(test)] +mod vectors; diff --git a/rust-modules/owp/src/media.rs b/rust-modules/owp/src/media.rs new file mode 100644 index 0000000000..1e1d8273d5 --- /dev/null +++ b/rust-modules/owp/src/media.rs @@ -0,0 +1,209 @@ +use crate::json::{Json, Text}; +use crate::text::{equal_ignoring_ascii_case, plain}; + +pub const MAX_DURATION_MS: i64 = 604_800_000; +pub const MAX_MEDIA_BYTES: usize = 4096; +pub const MAX_EXT_BYTES: usize = 1024; +pub const NAMESPACES: [&str; 8] = ["imdb", "tmdb", "tvdb", "plex", "anilist", "anidb", "kitsu", "mal"]; +const MEMBERS: [&str; 10] = ["kind", "title", "year", "ids", "series", "season", "episode", "durationMs", "file", "ext"]; +const SERIES_MEMBERS: [&str; 3] = ["title", "year", "ids"]; +const FILE_MEMBERS: [&str; 3] = ["sizeBytes", "oshash", "name"]; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Direction { + Send, + Receive, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum MediaRule { + Object, + Kind, + Title, + Year, + Ids, + Series, + SeriesTitle, + SeriesYear, + SeriesIds, + Season, + Episode, + DurationMs, + File, + FileSizeBytes, + FileOshash, + FileName, + Ext, + RepeatedName, + ExtNumber, + ExtSize, + Size, +} + +fn optional(object: &Json, name: &str, rule: impl Fn(&Json) -> bool) -> bool { + object.get(name).is_none_or(rule) +} + +fn int_at_least(min: i64) -> impl Fn(&Json) -> bool { + move |value| value.as_int().is_some_and(|i| i >= min) +} + +fn any_int(value: &Json) -> bool { + value.as_int().is_some() +} + +fn titled(value: &Json) -> bool { + value.as_text().is_some_and(|text| plain(text, usize::MAX)) +} + +fn valid_ids(value: &Json) -> bool { + value.members().is_some_and(|members| { + members.iter().all(|(name, id)| !name.unpaired && id.as_text().is_some_and(|text| !text.unpaired && !text.value.is_empty())) + }) +} + +fn valid_ext_name(name: &Text) -> bool { + let mut labels = 0; + let all_valid = name.value.split('.').all(|label| { + labels += 1; + !label.is_empty() && label.bytes().all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'-') + }); + !name.unpaired && all_valid && labels >= 2 +} + +fn valid_file_name(value: &Json) -> bool { + value.as_text().is_some_and(|text| plain(text, usize::MAX) && !text.value.contains(['/', '\\']) && text.value != "." && text.value != "..") +} + +fn valid_oshash(value: &Json) -> bool { + value.as_text().is_some_and(|text| text.value.len() == 16 && text.value.bytes().all(|b| b.is_ascii_digit() || (b'a'..=b'f').contains(&b))) +} + +fn require(holds: bool, rule: MediaRule) -> Result<(), MediaRule> { + if holds { Ok(()) } else { Err(rule) } +} + +fn check_series(series: &Json) -> Result<(), MediaRule> { + require(series.members().is_some(), MediaRule::Series)?; + require(series.get("title").is_some_and(titled), MediaRule::SeriesTitle)?; + require(optional(series, "year", any_int), MediaRule::SeriesYear)?; + require(optional(series, "ids", valid_ids), MediaRule::SeriesIds) +} + +fn check_file(file: &Json) -> Result<(), MediaRule> { + require(file.members().is_some(), MediaRule::File)?; + require(optional(file, "sizeBytes", int_at_least(0)), MediaRule::FileSizeBytes)?; + require(optional(file, "oshash", valid_oshash), MediaRule::FileOshash)?; + require(optional(file, "name", valid_file_name), MediaRule::FileName) +} + +fn valid_ext(ext: &Json) -> bool { + ext.members().is_some_and(|members| members.iter().all(|(name, _)| valid_ext_name(name))) && !ext.holds_unpaired() +} + +fn kind(media: &Json) -> Option<&str> { + media.get("kind").and_then(Json::as_text).map(|text| text.value.as_str()) +} + +fn check_shape(media: &Json) -> Result<(), MediaRule> { + let kind = kind(media); + require(media.members().is_some(), MediaRule::Object)?; + require(matches!(kind, Some("movie" | "episode" | "video")), MediaRule::Kind)?; + require(media.get("title").is_some_and(titled), MediaRule::Title)?; + require(optional(media, "year", any_int), MediaRule::Year)?; + require(optional(media, "ids", valid_ids), MediaRule::Ids)?; + require(kind != Some("episode") || media.get("series").is_some(), MediaRule::Series)?; + media.get("series").map_or(Ok(()), check_series)?; + require(optional(media, "season", int_at_least(0)), MediaRule::Season)?; + require(optional(media, "episode", int_at_least(0)), MediaRule::Episode)?; + require(media.get("durationMs").and_then(Json::as_int).is_some_and(|ms| (1..=MAX_DURATION_MS).contains(&ms)), MediaRule::DurationMs)?; + media.get("file").map_or(Ok(()), check_file)?; + require(optional(media, "ext", valid_ext), MediaRule::Ext) +} + +fn only(value: &Json, names: &[&str]) -> Json { + let members = value.members().unwrap_or_default(); + Json::Object( + names + .iter() + .filter_map(|name| members.iter().find(|(key, _)| key.value == *name)) + .map(|(key, member)| { + let member = match key.value.as_str() { + "series" => only(member, &SERIES_MEMBERS), + "file" => only(member, &FILE_MEMBERS), + _ => member.clone(), + }; + (key.clone(), member) + }) + .collect(), + ) +} + +pub fn known_members(media: &Json) -> Json { + only(media, &MEMBERS) +} + +pub fn check(media: &Json, direction: Direction) -> Result<(), MediaRule> { + check_shape(media)?; + match direction { + Direction::Receive => Ok(()), + Direction::Send => { + require(!media.repeats_a_member_name(), MediaRule::RepeatedName)?; + require(media.get("ext").is_none_or(|ext| !ext.holds_a_non_finite_number()), MediaRule::ExtNumber)?; + require(media.get("ext").is_none_or(|ext| ext.compact().len() <= MAX_EXT_BYTES), MediaRule::ExtSize)?; + require(known_members(media).compact().len() <= MAX_MEDIA_BYTES, MediaRule::Size) + } + } +} + +fn id_in<'a>(ids: Option<&'a Json>, namespace: &str) -> Option<&'a str> { + ids?.get(namespace).and_then(Json::as_text).map(|text| text.value.as_str()).filter(|id| !id.is_empty()) +} + +fn share_an_id(a: Option<&Json>, b: Option<&Json>) -> bool { + NAMESPACES.iter().any(|ns| matches!((id_in(a, ns), id_in(b, ns)), (Some(x), Some(y)) if x == y)) +} + +fn differ_on_an_id(a: Option<&Json>, b: Option<&Json>) -> bool { + NAMESPACES.iter().any(|ns| matches!((id_in(a, ns), id_in(b, ns)), (Some(x), Some(y)) if x != y)) +} + +fn equal_ints(a: Option<&Json>, b: Option<&Json>) -> bool { + matches!((a.and_then(Json::as_int), b.and_then(Json::as_int)), (Some(x), Some(y)) if x == y) +} + +fn equal_names(a: Option<&Json>, b: Option<&Json>) -> bool { + match (a.and_then(Json::as_text), b.and_then(Json::as_text)) { + (Some(x), Some(y)) => equal_ignoring_ascii_case(&x.value, &y.value), + _ => false, + } +} + +fn same_episode(a: &Json, b: &Json) -> bool { + if share_an_id(a.get("ids"), b.get("ids")) { + return true; + } + if differ_on_an_id(a.get("ids"), b.get("ids")) { + return false; + } + let (Some(series_a), Some(series_b)) = (a.get("series"), b.get("series")) else { return false }; + share_an_id(series_a.get("ids"), series_b.get("ids")) && equal_ints(a.get("season"), b.get("season")) && equal_ints(a.get("episode"), b.get("episode")) +} + +fn same_video(a: &Json, b: &Json) -> bool { + let (Some(file_a), Some(file_b)) = (a.get("file"), b.get("file")) else { return false }; + equal_names(file_a.get("oshash"), file_b.get("oshash")) + || (equal_ints(file_a.get("sizeBytes"), file_b.get("sizeBytes")) && equal_names(file_a.get("name"), file_b.get("name"))) +} + +pub fn same_title(a: &Json, b: &Json) -> bool { + if kind(a) != kind(b) { + return false; + } + match kind(a) { + Some("movie") => share_an_id(a.get("ids"), b.get("ids")), + Some("episode") => same_episode(a, b), + Some("video") => same_video(a, b), + _ => false, + } +} diff --git a/rust-modules/owp/src/message.rs b/rust-modules/owp/src/message.rs new file mode 100644 index 0000000000..ca2f4c447b --- /dev/null +++ b/rust-modules/owp/src/message.rs @@ -0,0 +1,327 @@ +use crate::code::is_room_code; +use crate::json::{read, Json, Text, MAX_SAFE_INT}; +use crate::media::{self, Direction}; +use crate::room::{is_peer_id, valid_snapshot, Snapshot, MAX_OFFSET_MS, MAX_RATE, MIN_RATE}; +use crate::text::{valid_client, valid_name}; + +pub const MAX_MESSAGE_BYTES: usize = 8192; +pub const MAX_RELAY_MESSAGE_BYTES: usize = 65_536; +const RELAY_TYPES: [&str; 5] = ["joined", "room", "pong", "error", "closed"]; +const TOKEN_LENGTH: usize = 43; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum PingId { + Text(String), + Number(i64), +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum PlayerState { + Idle, + Loading, + Ready, + Buffering, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum MatchState { + Searching, + Matched, + Mismatched, + Unavailable, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct MatchReport { + pub state: MatchState, + pub delta_ms: Option, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Control { + Host, + Everyone, +} + +#[derive(Debug, Clone, PartialEq)] +pub enum Outgoing { + Create { name: String, client: String }, + Join { code: String, name: String, client: String, create: bool }, + Resume { code: String, peer_id: String, token: String }, + Ping { id: PingId }, + Status { epoch: i64, player: PlayerState, report: Option, offset_ms: i64, rtt_ms: Option }, + Play, + Pause { position_ms: Option }, + Seek { position_ms: i64 }, + Rate { rate: f64 }, + SetMedia { media: Json, position_ms: Option }, + ClearMedia, + SetControl { mode: Control }, + TransferHost { peer_id: String }, + Kick { peer_id: String }, + Lock { locked: bool }, + Leave, + End, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct InvalidMessage(pub &'static str); + +fn text(value: &str) -> Json { + Json::Str(Text::new(value)) +} + +fn int_in(value: i64, min: i64, max: i64, rule: &'static str) -> Result { + if (min..=max).contains(&value) { + Ok(Json::Int(value)) + } else { + Err(InvalidMessage(rule)) + } +} + +fn position(value: i64) -> Result { + int_in(value, 0, MAX_SAFE_INT, "positionMs") +} + +fn checked(value: &str, rule: fn(&Json) -> bool, what: &'static str) -> Result { + let value = text(value); + if rule(&value) { + Ok(value) + } else { + Err(InvalidMessage(what)) + } +} + +fn code(value: &str) -> Result { + if is_room_code(value) { + Ok(text(value)) + } else { + Err(InvalidMessage("code")) + } +} + +impl PlayerState { + pub fn name(self) -> &'static str { + match self { + PlayerState::Idle => "idle", + PlayerState::Loading => "loading", + PlayerState::Ready => "ready", + PlayerState::Buffering => "buffering", + } + } +} + +impl MatchState { + pub fn name(self) -> &'static str { + match self { + MatchState::Searching => "searching", + MatchState::Matched => "matched", + MatchState::Mismatched => "mismatched", + MatchState::Unavailable => "unavailable", + } + } +} + +fn report(report: Option<&MatchReport>) -> Result { + let Some(report) = report else { return Ok(Json::Null) }; + let mut members = vec![(Text::new("state"), text(report.state.name()))]; + if let Some(delta) = report.delta_ms { + members.push((Text::new("deltaMs"), int_in(delta, -MAX_SAFE_INT, MAX_SAFE_INT, "deltaMs")?)); + } + Ok(Json::Object(members)) +} + +impl Outgoing { + pub fn type_name(&self) -> &'static str { + match self { + Outgoing::Create { .. } => "create", + Outgoing::Join { .. } => "join", + Outgoing::Resume { .. } => "resume", + Outgoing::Ping { .. } => "ping", + Outgoing::Status { .. } => "status", + Outgoing::Play => "play", + Outgoing::Pause { .. } => "pause", + Outgoing::Seek { .. } => "seek", + Outgoing::Rate { .. } => "rate", + Outgoing::SetMedia { .. } => "setMedia", + Outgoing::ClearMedia => "clearMedia", + Outgoing::SetControl { .. } => "setControl", + Outgoing::TransferHost { .. } => "transferHost", + Outgoing::Kick { .. } => "kick", + Outgoing::Lock { .. } => "lock", + Outgoing::Leave => "leave", + Outgoing::End => "end", + } + } + + fn members(&self) -> Result, InvalidMessage> { + Ok(match self { + Outgoing::Create { name, client } => vec![("name", checked(name, valid_name, "name")?), ("client", checked(client, valid_client, "client")?)], + Outgoing::Join { code: room, name, client, create } => { + let mut members = vec![("code", code(room)?), ("name", checked(name, valid_name, "name")?), ("client", checked(client, valid_client, "client")?)]; + if *create { + members.push(("create", Json::Bool(true))); + } + members + } + Outgoing::Resume { code: room, peer_id, token } => { + vec![("code", code(room)?), ("peerId", checked(peer_id, is_peer_id, "peerId")?), ("token", checked(token, is_token, "token")?)] + } + Outgoing::Ping { id: PingId::Text(id) } => vec![("id", text(id))], + Outgoing::Ping { id: PingId::Number(id) } => vec![("id", int_in(*id, -MAX_SAFE_INT, MAX_SAFE_INT, "id")?)], + Outgoing::Status { epoch, player, report: match_report, offset_ms, rtt_ms } => { + let mut members = vec![ + ("epoch", int_in(*epoch, 0, MAX_SAFE_INT, "epoch")?), + ("player", text(player.name())), + ("match", report(match_report.as_ref())?), + ("offsetMs", int_in(*offset_ms, -MAX_OFFSET_MS, MAX_OFFSET_MS, "offsetMs")?), + ]; + if let Some(rtt) = rtt_ms { + members.push(("rttMs", int_in(*rtt, 0, MAX_SAFE_INT, "rttMs")?)); + } + members + } + Outgoing::Pause { position_ms: Some(at) } => vec![("positionMs", position(*at)?)], + Outgoing::Seek { position_ms } => vec![("positionMs", position(*position_ms)?)], + Outgoing::Rate { rate } if (MIN_RATE..=MAX_RATE).contains(rate) => vec![("rate", Json::Float(*rate))], + Outgoing::Rate { .. } => return Err(InvalidMessage("rate")), + Outgoing::SetMedia { media: descriptor, position_ms } => { + if media::check(descriptor, Direction::Send).is_err() { + return Err(InvalidMessage("media")); + } + let mut members = vec![("media", media::known_members(descriptor))]; + if let Some(at) = position_ms { + members.push(("positionMs", position(*at)?)); + } + members + } + Outgoing::SetControl { mode: Control::Host } => vec![("mode", text("host"))], + Outgoing::SetControl { mode: Control::Everyone } => vec![("mode", text("everyone"))], + Outgoing::TransferHost { peer_id } | Outgoing::Kick { peer_id } => vec![("peerId", checked(peer_id, is_peer_id, "peerId")?)], + Outgoing::Lock { locked } => vec![("locked", Json::Bool(*locked))], + Outgoing::Pause { position_ms: None } | Outgoing::Play | Outgoing::ClearMedia | Outgoing::Leave | Outgoing::End => Vec::new(), + }) + } + + pub fn encode(&self) -> Result { + let mut members = vec![(Text::new("type"), text(self.type_name()))]; + members.extend(self.members()?.into_iter().map(|(name, value)| (Text::new(name), value))); + let encoded = Json::Object(members).compact(); + if encoded.len() > MAX_MESSAGE_BYTES { + return Err(InvalidMessage("message size")); + } + Ok(encoded) + } +} + +#[derive(Debug, Clone, PartialEq)] +pub enum Incoming { + Joined { code: String, peer_id: String, token: String, room: Json, media: Option, server_time: i64 }, + Room { room: Json, media: Option }, + Pong { id: PingId, server_time: i64 }, + Error { code: String, message: String, re: Option }, + Closed { reason: String }, +} + +#[derive(Debug, Clone, PartialEq)] +pub enum Received { + Message(Incoming), + Ignored, + Malformed(&'static str), + TooLarge, +} + +fn plain_string(value: Option<&Json>) -> Option { + value.and_then(Json::as_text).filter(|text| !text.unpaired).map(|text| text.value.clone()) +} + +fn any_string(value: Option<&Json>) -> Option { + value.and_then(Json::as_text).map(|text| text.value.clone()) +} + +fn non_empty(value: Option<&Json>) -> Option { + any_string(value).filter(|value| !value.is_empty()) +} + +fn server_time(message: &Json) -> Option { + message.get("serverTime").and_then(Json::as_int).filter(|time| *time >= 0) +} + +fn is_token(value: &Json) -> bool { + value.as_text().is_some_and(|text| text.value.len() == TOKEN_LENGTH && text.value.bytes().all(|b| b.is_ascii_alphanumeric() || b == b'_' || b == b'-')) +} + +fn joined_media(value: &Json) -> Option> { + match value { + Json::Null => Some(None), + descriptor if media::check(descriptor, Direction::Receive).is_ok() => Some(Some(media::known_members(descriptor))), + _ => None, + } +} + +fn decode_joined(message: &Json) -> Received { + let code = plain_string(message.get("code")).filter(|code| is_room_code(code)); + let you = message.get("you"); + let peer_id = you.and_then(|you| you.get("peerId")).filter(|id| is_peer_id(id)).and_then(|id| plain_string(Some(id))); + let token = you.and_then(|you| you.get("token")).filter(|token| is_token(token)).and_then(|token| plain_string(Some(token))); + let room = message.get("room").filter(|room| valid_snapshot(room, Snapshot::Joined)); + let media = message.get("media").and_then(joined_media); + match (code, peer_id, token, room, media, server_time(message)) { + (Some(code), Some(peer_id), Some(token), Some(room), Some(media), Some(server_time)) => { + Received::Message(Incoming::Joined { code, peer_id, token, room: room.clone(), media, server_time }) + } + _ => Received::Malformed("joined"), + } +} + +fn decode_pong(message: &Json) -> Received { + let id = match message.get("id") { + Some(Json::Str(id)) if !id.unpaired => Some(PingId::Text(id.value.clone())), + Some(id) => id.as_int().map(PingId::Number), + None => None, + }; + match (id, server_time(message)) { + (Some(id), Some(server_time)) => Received::Message(Incoming::Pong { id, server_time }), + _ => Received::Malformed("pong"), + } +} + +fn decode_error(message: &Json) -> Received { + let re = match message.get("re") { + Some(Json::Null) => Some(None), + Some(re) => any_string(Some(re)).map(Some), + None => None, + }; + match (non_empty(message.get("code")), any_string(message.get("message")), re) { + (Some(code), Some(text), Some(re)) => Received::Message(Incoming::Error { code, message: text, re }), + _ => Received::Malformed("error"), + } +} + +pub fn decode(input: &str) -> Received { + if input.len() > MAX_RELAY_MESSAGE_BYTES { + return Received::TooLarge; + } + let Ok(read) = read(input) else { return Received::Ignored }; + let message = read.value; + let Some(kind) = plain_string(message.get("type")) else { return Received::Ignored }; + let Some(&kind) = RELAY_TYPES.iter().find(|known| **known == kind) else { return Received::Ignored }; + if message.repeats_a_member_name() { + return Received::Malformed(kind); + } + match kind { + "joined" => decode_joined(&message), + "room" if valid_snapshot(&message, Snapshot::Room) => { + let media = message.get("media").cloned(); + Received::Message(Incoming::Room { room: message, media }) + } + "room" => Received::Malformed("room"), + "pong" => decode_pong(&message), + "error" => decode_error(&message), + "closed" => match non_empty(message.get("reason")) { + Some(reason) => Received::Message(Incoming::Closed { reason }), + None => Received::Malformed("closed"), + }, + _ => Received::Ignored, + } +} diff --git a/rust-modules/owp/src/relays.rs b/rust-modules/owp/src/relays.rs new file mode 100644 index 0000000000..6193ba4444 --- /dev/null +++ b/rust-modules/owp/src/relays.rs @@ -0,0 +1,97 @@ +use crate::code::CODE_ALPHABET; +use crate::json::{read, Json}; +use crate::text::plain; +use std::collections::BTreeSet; + +pub const PUBLIC_LIST_URL: &str = "https://openwatch.party/relays.json"; +pub const EMBEDDED_PUBLIC_LIST: &str = include_str!("../fixtures/relays.json"); +pub const MAX_RELAY_ID_LENGTH: usize = 32; +pub const MAX_RELAY_NAME_LENGTH: usize = 64; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Relay { + pub id: String, + pub name: String, + pub url: String, + pub prefixes: String, +} + +fn valid_id(id: &str) -> bool { + (1..=MAX_RELAY_ID_LENGTH).contains(&id.len()) + && !id.starts_with('-') + && id.bytes().all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'-') +} + +pub fn valid_url(url: &str, allow_ws: bool) -> bool { + let rest = match (url.strip_prefix("wss://"), url.strip_prefix("ws://")) { + (Some(rest), _) => rest, + (None, Some(rest)) if allow_ws => rest, + _ => return false, + }; + let host_length = rest.find('/').unwrap_or(rest.len()); + host_length > 0 && rest.ends_with("/v1/ws") && rest.bytes().all(|b| (0x21..=0x7E).contains(&b) && b != b'?' && b != b'#') +} + +pub fn validate(list: &Json) -> Option> { + list.members()?; + let Some(Json::Array(entries)) = list.get("relays") else { return None }; + if entries.is_empty() { + return None; + } + let mut ids = BTreeSet::new(); + let mut symbols = BTreeSet::new(); + let mut relays = Vec::new(); + for entry in entries { + entry.members()?; + let id = entry.get("id")?.as_text()?; + let name = entry.get("name")?.as_text()?; + let url = entry.get("url")?.as_text()?; + let prefixes = entry.get("prefixes")?.as_text()?; + let fresh_symbols = prefixes.value.chars().all(|c| CODE_ALPHABET.contains(c) && symbols.insert(c)); + let valid = !id.unpaired + && valid_id(&id.value) + && ids.insert(id.value.clone()) + && plain(name, MAX_RELAY_NAME_LENGTH) + && !url.unpaired + && valid_url(&url.value, false) + && !prefixes.unpaired + && !prefixes.value.is_empty() + && fresh_symbols; + if !valid { + return None; + } + relays.push(Relay { id: id.value.clone(), name: name.value.clone(), url: url.value.clone(), prefixes: prefixes.value.clone() }); + } + Some(relays) +} + +pub fn embedded_public_list() -> Option> { + validate(&read(EMBEDDED_PUBLIC_LIST).ok()?.value) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn the_embedded_public_list_is_valid_and_kept_whole() { + let ids: Vec<_> = embedded_public_list().unwrap().into_iter().map(|relay| relay.id).collect(); + assert_eq!(ids, ["na", "eu", "asia"]); + } + + #[test] + fn a_ws_url_passes_only_where_allowed() { + assert!(valid_url("ws://192.168.1.5:8080/owp/v1/ws", true)); + assert!(!valid_url("ws://192.168.1.5:8080/owp/v1/ws", false)); + assert!(!valid_url("wss:///v1/ws", false)); + assert!(!valid_url("wss://a.example/v1/ws?x", false)); + } + + #[test] + fn the_v1_ws_ending_comes_after_the_host() { + assert!(valid_url("wss://h/v1/ws", false)); + assert!(!valid_url("wss://v1/ws", false)); + assert!(!valid_url("ws://v1/ws", true)); + assert!(!valid_url("wss://hv1/ws", false)); + } +} diff --git a/rust-modules/owp/src/room.rs b/rust-modules/owp/src/room.rs new file mode 100644 index 0000000000..0e1ba0e6cd --- /dev/null +++ b/rust-modules/owp/src/room.rs @@ -0,0 +1,90 @@ +use crate::code::is_room_code; +use crate::json::Json; +use crate::media::MAX_DURATION_MS; +use crate::text::{valid_client, valid_name}; +use std::collections::BTreeSet; + +pub const MAX_OFFSET_MS: i64 = 604_800_000; +pub const MAX_PEER_ID_LENGTH: usize = 16; +pub const MIN_RATE: f64 = 0.5; +pub const MAX_RATE: f64 = 2.0; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Snapshot { + Room, + Joined, +} + +pub fn is_peer_id(value: &Json) -> bool { + value.as_text().is_some_and(|text| { + (1..=MAX_PEER_ID_LENGTH).contains(&text.value.len()) && text.value.bytes().all(|b| b.is_ascii_alphanumeric() || b == b'_' || b == b'-') + }) +} + +fn one_of(value: Option<&Json>, allowed: &[&str]) -> bool { + value.and_then(Json::as_text).is_some_and(|text| allowed.contains(&text.value.as_str())) +} + +fn boolean(value: Option<&Json>) -> bool { + matches!(value, Some(Json::Bool(_))) +} + +fn valid_match(value: Option<&Json>) -> bool { + match value { + Some(Json::Null) => true, + Some(report @ Json::Object(_)) => { + one_of(report.get("state"), &["searching", "matched", "mismatched", "unavailable"]) && report.get("deltaMs").is_none_or(|d| d.as_int().is_some()) + } + _ => false, + } +} + +fn valid_participant(entry: &Json) -> bool { + entry.members().is_some() + && entry.get("peerId").is_some_and(is_peer_id) + && entry.get("name").is_some_and(valid_name) + && entry.get("client").is_some_and(valid_client) + && boolean(entry.get("host")) + && boolean(entry.get("connected")) + && one_of(entry.get("player"), &["idle", "loading", "ready", "buffering"]) + && valid_match(entry.get("match")) + && entry.get("offsetMs").and_then(Json::as_int).is_some_and(|ms| ms.abs() <= MAX_OFFSET_MS) +} + +fn valid_action(action: &Json) -> bool { + action.members().is_some() + && action.get("kind").and_then(Json::as_text).is_some_and(|text| !text.value.is_empty()) + && (matches!(action.get("by"), Some(Json::Null)) || action.get("by").is_some_and(is_peer_id)) +} + +fn valid_waiting_on(room: &Json, waiting: bool) -> bool { + let Some(Json::Array(items)) = room.get("waitingOn") else { return false }; + let mut seen = BTreeSet::new(); + items.iter().all(|item| is_peer_id(item) && item.as_text().is_some_and(|text| seen.insert(text.value.clone()))) && (items.is_empty() || waiting) +} + +fn valid_participants(room: &Json) -> bool { + let Some(Json::Array(items)) = room.get("participants") else { return false }; + !items.is_empty() && items.iter().all(valid_participant) && items.iter().filter(|p| matches!(p.get("host"), Some(Json::Bool(true)))).count() == 1 +} + +pub fn valid_snapshot(room: &Json, snapshot: Snapshot) -> bool { + let phase = room.get("phase").and_then(Json::as_text).map(|text| text.value.as_str()); + let action = match (room.get("action"), snapshot) { + (Some(action), Snapshot::Room) => valid_action(action), + (None, _) | (Some(_), Snapshot::Joined) => true, + }; + room.members().is_some() + && room.get("rev").and_then(Json::as_int).is_some_and(|rev| rev >= 1) + && room.get("code").and_then(Json::as_text).is_some_and(|code| !code.unpaired && is_room_code(&code.value)) + && room.get("epoch").and_then(Json::as_int).is_some_and(|epoch| epoch >= 0) + && room.get("atMs").and_then(Json::as_int).is_some_and(|at| at >= 0) + && matches!(phase, Some("idle" | "paused" | "waiting" | "playing")) + && room.get("positionMs").and_then(Json::as_int).is_some_and(|ms| (0..=MAX_DURATION_MS).contains(&ms) && (phase != Some("idle") || ms == 0)) + && room.get("rate").and_then(Json::as_number).is_some_and(|rate| (MIN_RATE..=MAX_RATE).contains(&rate)) + && one_of(room.get("control"), &["host", "everyone"]) + && boolean(room.get("locked")) + && valid_waiting_on(room, phase == Some("waiting")) + && action + && valid_participants(room) +} diff --git a/rust-modules/owp/src/text.rs b/rust-modules/owp/src/text.rs new file mode 100644 index 0000000000..125c9f04a2 --- /dev/null +++ b/rust-modules/owp/src/text.rs @@ -0,0 +1,34 @@ +use crate::json::{Json, Text}; + +pub const MAX_NAME_LENGTH: usize = 32; +pub const MAX_CLIENT_LENGTH: usize = 64; + +pub fn forbidden(c: char) -> bool { + let u = u32::from(c); + u <= 0x1F + || (0x7F..=0x9F).contains(&u) + || u == 0x061C + || u == 0x200E + || u == 0x200F + || (0x202A..=0x202E).contains(&u) + || (0x2066..=0x2069).contains(&u) +} + +pub fn plain(text: &Text, max_code_points: usize) -> bool { + let length = text.value.chars().count(); + !text.unpaired && (1..=max_code_points).contains(&length) && !text.value.chars().any(forbidden) +} + +pub fn valid_name(value: &Json) -> bool { + value.as_text().is_some_and(|text| plain(text, MAX_NAME_LENGTH)) +} + +pub fn valid_client(value: &Json) -> bool { + value.as_text().is_some_and(|text| { + plain(text, MAX_CLIENT_LENGTH) && text.value.find('/').is_some_and(|at| at > 0 && at + 1 < text.value.len()) + }) +} + +pub fn equal_ignoring_ascii_case(a: &str, b: &str) -> bool { + !a.is_empty() && !b.is_empty() && a.eq_ignore_ascii_case(b) +} diff --git a/rust-modules/owp/src/timeline.rs b/rust-modules/owp/src/timeline.rs new file mode 100644 index 0000000000..c9844364a2 --- /dev/null +++ b/rust-modules/owp/src/timeline.rs @@ -0,0 +1,47 @@ +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Phase { + Idle, + Paused, + Waiting, + Playing, +} + +impl Phase { + pub fn parse(name: &str) -> Option { + match name { + "idle" => Some(Phase::Idle), + "paused" => Some(Phase::Paused), + "waiting" => Some(Phase::Waiting), + "playing" => Some(Phase::Playing), + _ => None, + } + } +} + +#[derive(Debug, Clone, Copy, PartialEq)] +pub struct Timeline { + pub phase: Phase, + pub position_ms: i64, + pub at_ms: i64, + pub rate: f64, +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct Position { + pub position_ms: i64, + pub running: bool, +} + +impl Timeline { + pub fn at(&self, duration_ms: i64, relay_now_ms: i64) -> Position { + match self.phase { + Phase::Playing => { + let elapsed = (relay_now_ms - self.at_ms).max(0) as f64; + let advanced = elapsed * self.rate; + let sum = self.position_ms as f64 + advanced; + Position { position_ms: (sum.floor() as i64).min(duration_ms), running: relay_now_ms >= self.at_ms } + } + Phase::Idle | Phase::Paused | Phase::Waiting => Position { position_ms: self.position_ms, running: false }, + } + } +} diff --git a/rust-modules/owp/src/vectors.rs b/rust-modules/owp/src/vectors.rs new file mode 100644 index 0000000000..a03e907f3c --- /dev/null +++ b/rust-modules/owp/src/vectors.rs @@ -0,0 +1,548 @@ +use crate::clock::{ClockEvent, ClockSync, PongOutcome}; +use crate::code; +use crate::json::{read, Json, Text, MAX_SAFE_INT}; +use crate::media::{self, Direction, MediaRule, MAX_EXT_BYTES, MAX_MEDIA_BYTES}; +use crate::message::{decode, Incoming, InvalidMessage, Outgoing, PingId, PlayerState, Received, MAX_RELAY_MESSAGE_BYTES}; +use crate::relays::{self, Relay}; +use crate::room::{valid_snapshot, Snapshot, MAX_OFFSET_MS}; +use crate::text::{valid_client, valid_name}; +use crate::timeline::{Phase, Timeline}; +use std::path::PathBuf; + +type Runner = fn(&Json) -> Json; + +const RUNNERS: [(&str, Runner); 8] = [ + ("names", names), + ("code-routing", code_routing), + ("relay-list", relay_list), + ("media-check", media_check), + ("same-title", same_title), + ("room-check", room_check), + ("clock-sync", clock_sync), + ("timeline", timeline), +]; + +fn fixtures() -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("fixtures") +} + +fn load(path: PathBuf) -> Json { + let text = std::fs::read_to_string(&path).unwrap_or_else(|e| panic!("{}: {e}", path.display())); + read(&text).unwrap_or_else(|e| panic!("{}: {e}", path.display())).value +} + +fn string(value: &str) -> Json { + Json::Str(Text::new(value)) +} + +fn object(members: Vec<(&str, Json)>) -> Json { + Json::Object(members.into_iter().map(|(name, value)| (Text::new(name), value)).collect()) +} + +fn valid(answer: bool) -> Json { + object(vec![("valid", Json::Bool(answer))]) +} + +fn same(a: &Json, b: &Json) -> bool { + match (a, b) { + (Json::Null, Json::Null) => true, + (Json::Bool(x), Json::Bool(y)) => x == y, + (Json::Str(x), Json::Str(y)) => x.value == y.value, + (Json::Array(x), Json::Array(y)) => x.len() == y.len() && x.iter().zip(y).all(|(p, q)| same(p, q)), + (Json::Object(x), Json::Object(y)) => x.len() == y.len() && x.iter().all(|(k, v)| y.iter().any(|(k2, v2)| k.value == k2.value && same(v, v2))), + _ => matches!((a.as_number(), b.as_number()), (Some(p), Some(q)) if p == q), + } +} + +fn field<'a>(input: &'a Json, name: &str) -> &'a Json { + input.get(name).unwrap_or(&Json::Null) +} + +fn names(input: &Json) -> Json { + let value = field(input, "value"); + valid(match field(input, "field").as_text().map(|t| t.value.as_str()) { + Some("name") => valid_name(value), + Some("client") => valid_client(value), + _ => false, + }) +} + +fn code_routing(input: &Json) -> Json { + let typed = field(input, "code").as_text().filter(|t| !t.unpaired).map(|t| t.value.as_str()).unwrap_or_default(); + let Some(code) = code::normalize(typed) else { + return object(vec![("error", string("invalid_code"))]); + }; + let relays: Vec = match field(input, "relays") { + Json::Array(entries) => entries + .iter() + .map(|entry| Relay { + id: field(entry, "id").as_text().map(|t| t.value.clone()).unwrap_or_default(), + name: String::new(), + url: String::new(), + prefixes: field(entry, "prefixes").as_text().map(|t| t.value.clone()).unwrap_or_default(), + }) + .collect(), + _ => Vec::new(), + }; + let relay = code::relay_for(typed, &relays).map_or(Json::Null, |relay| string(&relay.id)); + object(vec![("code", string(&code)), ("relay", relay)]) +} + +fn relay_list(input: &Json) -> Json { + match relays::validate(field(input, "list")) { + Some(list) => object(vec![( + "relays", + Json::Array( + list.iter() + .map(|r| object(vec![("id", string(&r.id)), ("name", string(&r.name)), ("url", string(&r.url)), ("prefixes", string(&r.prefixes))])) + .collect(), + ), + )]), + None => object(vec![("error", string("invalid_list"))]), + } +} + +fn media_check(input: &Json) -> Json { + let direction = match field(input, "on").as_text().map(|t| t.value.as_str()) { + Some("send") => Direction::Send, + _ => Direction::Receive, + }; + valid(media::check(field(input, "media"), direction).is_ok()) +} + +fn same_title(input: &Json) -> Json { + let (a, b) = (field(input, "a"), field(input, "b")); + let forward = media::same_title(a, b); + assert_eq!(forward, media::same_title(b, a), "same-title is symmetric"); + object(vec![("same", Json::Bool(forward))]) +} + +fn room_check(input: &Json) -> Json { + valid(valid_snapshot(field(input, "room"), Snapshot::Room)) +} + +fn clock_sync(input: &Json) -> Json { + let mut clock = ClockSync::new(); + let mut pongs = Vec::new(); + let events = match field(input, "events") { + Json::Array(events) => events.as_slice(), + _ => &[], + }; + for event in events { + let at_ms = field(event, "atMs").as_int().unwrap_or(0); + let mut outcomes = Vec::new(); + if let Some(id) = field(event, "ping").as_int() { + clock.step(ClockEvent::PingSent { id, at_ms }, &mut outcomes); + continue; + } + let id = field(event, "pong").as_int().unwrap_or(-1); + match field(event, "serverTime").as_int().filter(|time| *time >= 0) { + Some(server_time) => clock.step(ClockEvent::PongReceived { id, server_time, at_ms }, &mut outcomes), + None => outcomes.push(PongOutcome::Ignored), + } + for outcome in outcomes { + let best = clock.best(); + let result = match outcome { + PongOutcome::Accepted => "accepted", + PongOutcome::Stepped => "stepped", + PongOutcome::Ignored => "ignored", + }; + pongs.push(object(vec![ + ("result", string(result)), + ("offsetMs", best.map_or(Json::Null, |b| Json::Int(b.offset_ms))), + ("rttMs", best.map_or(Json::Null, |b| Json::Int(b.rtt_ms))), + ])); + } + } + object(vec![("pongs", Json::Array(pongs))]) +} + +fn timeline(input: &Json) -> Json { + let room = field(input, "room"); + let int = |value: &Json| value.as_int().unwrap_or(0); + let timeline = Timeline { + phase: field(room, "phase").as_text().and_then(|t| Phase::parse(&t.value)).unwrap_or(Phase::Idle), + position_ms: int(field(room, "positionMs")), + at_ms: int(field(room, "atMs")), + rate: field(room, "rate").as_number().unwrap_or(1.0), + }; + let position = timeline.at(int(field(input, "durationMs")), int(field(input, "serverNowMs"))); + object(vec![("positionMs", Json::Int(position.position_ms)), ("running", Json::Bool(position.running))]) +} + +fn run_table(name: &str, runner: Runner) { + let table = load(fixtures().join("vectors").join(format!("{name}.json"))); + assert!(matches!(table.get("table"), Some(Json::Str(t)) if t.value == name)); + let Some(Json::Array(cases)) = table.get("cases") else { panic!("{name}: no cases") }; + let failed: Vec = cases + .iter() + .filter(|case| !same(&runner(field(case, "input")), field(case, "expect"))) + .map(|case| field(case, "name").as_text().map(|t| t.value.clone()).unwrap_or_default()) + .collect(); + assert!(!cases.is_empty() && failed.is_empty(), "{name}: {} of {} cases fail: {failed:?}", failed.len(), cases.len()); +} + +#[test] +fn every_vendored_table_has_a_runner() { + let mut vendored: Vec = std::fs::read_dir(fixtures().join("vectors")) + .unwrap() + .map(|entry| entry.unwrap().file_name().to_string_lossy().trim_end_matches(".json").to_owned()) + .collect(); + vendored.sort(); + let mut run: Vec = RUNNERS.iter().map(|(name, _)| (*name).to_owned()).collect(); + run.sort(); + assert_eq!(vendored, run); +} + +#[test] +fn names_table() { + run_table("names", names); +} + +#[test] +fn code_routing_table() { + run_table("code-routing", code_routing); +} + +#[test] +fn relay_list_table() { + run_table("relay-list", relay_list); +} + +#[test] +fn media_check_table() { + run_table("media-check", media_check); +} + +#[test] +fn same_title_table() { + run_table("same-title", same_title); +} + +#[test] +fn room_check_table() { + run_table("room-check", room_check); +} + +#[test] +fn clock_sync_table() { + run_table("clock-sync", clock_sync); +} + +#[test] +fn timeline_table() { + run_table("timeline", timeline); +} + +fn descriptor_examples(dir: &str) -> Vec<(String, Json)> { + let mut out = Vec::new(); + for entry in std::fs::read_dir(fixtures().join("examples").join(dir)).unwrap() { + let name = entry.unwrap().file_name().to_string_lossy().into_owned(); + if name.contains("invalid-utf8") { + continue; + } + let document = load(fixtures().join("examples").join(dir).join(&name)); + if name.starts_with("descriptor.") { + out.push((name, document)); + } else if let Some(descriptor) = document.get("media") { + out.push((name, descriptor.clone())); + } + } + out.sort_by(|a, b| a.0.cmp(&b.0)); + out +} + +#[test] +fn every_valid_descriptor_example_passes_the_send_checks() { + let examples = descriptor_examples("valid"); + let refused: Vec<_> = examples.iter().filter(|(_, d)| media::check(d, Direction::Send).is_err()).map(|(n, _)| n).collect(); + assert_eq!(examples.len(), 13); + assert!(refused.is_empty(), "{refused:?}"); +} + +#[test] +fn every_invalid_descriptor_example_fails_the_send_checks() { + let examples = descriptor_examples("invalid"); + let accepted: Vec<_> = examples.iter().filter(|(_, d)| media::check(d, Direction::Send).is_ok()).map(|(n, _)| n).collect(); + assert_eq!(examples.len(), 31); + assert!(accepted.is_empty(), "{accepted:?}"); +} + +fn room_with_padding(bytes: usize) -> String { + format!( + r#"{{"type":"room","rev":2,"code":"K7MQ2X","epoch":0,"phase":"idle","positionMs":0,"atMs":0,"rate":1,"control":"host","locked":false,"waitingOn":[],"participants":[{{"peerId":"p1","name":"Edde","client":"Example/1.0","host":true,"connected":true,"player":"idle","match":null,"offsetMs":0}}],"pad":"{}"}}"#, + "x".repeat(bytes) + ) +} + +fn room_of_length(length: usize) -> String { + let text = room_with_padding(length - room_with_padding(0).len()); + assert_eq!(text.len(), length); + text +} + +#[test] +fn a_relay_message_of_32768_bytes_and_more_is_read() { + for length in [32_768, 40_000, MAX_RELAY_MESSAGE_BYTES] { + assert!(matches!(decode(&room_of_length(length)), Received::Message(Incoming::Room { .. })), "{length}"); + } +} + +#[test] +fn a_relay_message_over_the_cap_is_refused_before_the_scan() { + assert_eq!(decode(&room_of_length(MAX_RELAY_MESSAGE_BYTES + 1)), Received::TooLarge); + assert_eq!(decode(&"x".repeat(MAX_RELAY_MESSAGE_BYTES + 1)), Received::TooLarge); +} + +#[test] +fn ints_go_out_without_a_fraction_even_from_a_double() { + let media = read(r#"{"kind":"video","title":"Clip","durationMs":1000.0,"year":2.0e3}"#).unwrap().value; + let sent = Outgoing::SetMedia { media, position_ms: Some(0) }.encode().unwrap(); + assert_eq!(sent, r#"{"type":"setMedia","media":{"kind":"video","title":"Clip","year":2000,"durationMs":1000},"positionMs":0}"#); + assert_eq!(Outgoing::Seek { position_ms: 61_234 }.encode().unwrap(), r#"{"type":"seek","positionMs":61234}"#); +} + +#[test] +fn values_out_of_bounds_are_refused_before_sending() { + assert_eq!(Outgoing::Seek { position_ms: -1 }.encode(), Err(InvalidMessage("positionMs"))); + assert!(Outgoing::Seek { position_ms: MAX_SAFE_INT + 1 }.encode().is_err()); + assert!(Outgoing::Rate { rate: 2.5 }.encode().is_err()); + assert!(Outgoing::Rate { rate: f64::NAN }.encode().is_err()); + let status = |offset_ms| Outgoing::Status { epoch: 0, player: PlayerState::Idle, report: None, offset_ms, rtt_ms: None }; + assert!(status(MAX_OFFSET_MS).encode().is_ok()); + assert!(status(MAX_OFFSET_MS + 1).encode().is_err()); +} + +#[test] +fn unpaired_surrogates_are_refused_before_sending() { + let title = read(r#"{"kind":"video","title":"Clip\ud800","durationMs":1000}"#).unwrap().value; + assert_eq!(Outgoing::SetMedia { media: title, position_ms: None }.encode(), Err(InvalidMessage("media"))); + let ext = read(r#"{"kind":"video","title":"Clip","durationMs":1000,"ext":{"a.b":{"k\udc00":1}}}"#).unwrap().value; + assert!(Outgoing::SetMedia { media: ext, position_ms: None }.encode().is_err()); +} + +#[test] +fn unknown_members_of_a_descriptor_are_not_sent() { + let media = read(r#"{"kind":"video","title":"Clip","durationMs":1,"rating":5,"file":{"name":"c.mp4","hash":"x"}}"#).unwrap().value; + let sent = Outgoing::SetMedia { media, position_ms: None }.encode().unwrap(); + assert_eq!(sent, r#"{"type":"setMedia","media":{"kind":"video","title":"Clip","durationMs":1,"file":{"name":"c.mp4"}}}"#); +} + +#[test] +fn a_message_over_8192_bytes_is_not_sent() { + let media = read(&format!(r#"{{"kind":"video","title":"{}","durationMs":1}}"#, "x".repeat(4000))).unwrap().value; + assert!(Outgoing::SetMedia { media, position_ms: None }.encode().is_ok()); + let padded = Outgoing::Ping { id: PingId::Text("p".repeat(9000)) }; + assert_eq!(padded.encode(), Err(InvalidMessage("message size"))); +} + +#[test] +fn a_descriptor_that_repeats_a_member_name_is_not_sent() { + let ext = read(r#"{"kind":"movie","title":"Arrival","durationMs":6960000,"ext":{"com.example":{"server":"1a2b3c","server":"9z8y7x"}}}"#).unwrap().value; + assert_eq!(Outgoing::SetMedia { media: ext.clone(), position_ms: None }.encode(), Err(InvalidMessage("media"))); + assert_eq!(media::check(&ext, Direction::Receive), Ok(())); + let ids = read(r#"{"kind":"movie","title":"Heat","durationMs":1,"ids":{"imdb":"tt1","\u0069mdb":"tt2"}}"#).unwrap().value; + assert_eq!(media::check(&ids, Direction::Send), Err(MediaRule::RepeatedName)); +} + +const EPISODE: &str = r#"{"kind":"episode","title":"Pilot","year":2004,"ids":{"tvdb":"127131"},"series":{"title":"Lost","year":2004,"ids":{"tvdb":"73739"}},"season":1,"episode":1,"durationMs":2520000,"file":{"sizeBytes":1,"oshash":"8e245d9679d31e12","name":"Lost.S01E01.mkv"},"ext":{"com.example":{"item":"4711"}}}"#; + +fn set(json: &mut Json, path: &[&str], value: Json) { + let (Json::Object(members), Some((name, rest))) = (json, path.split_first()) else { panic!("no object at {path:?}") }; + match (members.iter_mut().find(|(key, _)| key.value == *name), rest.is_empty()) { + (Some((_, member)), true) => *member = value, + (Some((_, member)), false) => set(member, rest, value), + (None, true) => members.push((Text { value: (*name).into(), unpaired: false }, value)), + (None, false) => panic!("no member {name}"), + } +} + +fn checked(document: &str) -> [Result<(), MediaRule>; 2] { + let media = read(document).unwrap().value; + [media::check(&media, Direction::Receive), media::check(&media, Direction::Send)] +} + +#[test] +fn a_descriptor_that_fails_names_the_rule_it_breaks() { + let cases: [(&[&str], &str, MediaRule); 16] = [ + (&["kind"], r#""show""#, MediaRule::Kind), + (&["title"], r#""""#, MediaRule::Title), + (&["year"], "1.5", MediaRule::Year), + (&["ids", "tvdb"], r#""""#, MediaRule::Ids), + (&["series"], "null", MediaRule::Series), + (&["series", "title"], "7", MediaRule::SeriesTitle), + (&["series", "year"], r#""2004""#, MediaRule::SeriesYear), + (&["series", "ids"], "[]", MediaRule::SeriesIds), + (&["season"], "-1", MediaRule::Season), + (&["episode"], "-1", MediaRule::Episode), + (&["durationMs"], "0", MediaRule::DurationMs), + (&["file"], r#""Lost.mkv""#, MediaRule::File), + (&["file", "sizeBytes"], "-1", MediaRule::FileSizeBytes), + (&["file", "oshash"], r#""8E245D9679D31E12""#, MediaRule::FileOshash), + (&["file", "name"], r#""..""#, MediaRule::FileName), + (&["ext", "example"], "1", MediaRule::Ext), + ]; + assert_eq!(checked(EPISODE), [Ok(()), Ok(())]); + for (path, value, rule) in cases { + let mut media = read(EPISODE).unwrap().value; + set(&mut media, path, read(value).unwrap().value); + let broken = [media::check(&media, Direction::Receive), media::check(&media, Direction::Send)]; + assert_eq!(broken, [Err(rule), Err(rule)], "{path:?} = {value}"); + } + assert_eq!(checked("[]"), [Err(MediaRule::Object), Err(MediaRule::Object)]); + assert_eq!(checked(r#"{"kind":"episode","title":"Pilot","durationMs":1}"#), [Err(MediaRule::Series), Err(MediaRule::Series)]); +} + +#[test] +fn a_descriptor_that_breaks_several_rules_names_the_first() { + assert_eq!(checked(r#"{"kind":"show","title":"","durationMs":0}"#)[1], Err(MediaRule::Kind)); + assert_eq!(checked(r#"{"kind":"movie","title":"","durationMs":0}"#)[1], Err(MediaRule::Title)); + assert_eq!(checked(r#"{"kind":"movie","title":"Heat","durationMs":0,"file":7}"#)[1], Err(MediaRule::DurationMs)); +} + +#[test] +fn the_size_rules_apply_only_to_sending() { + let ext = "x".repeat(MAX_EXT_BYTES); + let title = "x".repeat(MAX_MEDIA_BYTES); + let long_ext = format!(r#"{{"kind":"video","title":"Clip","durationMs":1,"ext":{{"a.b":"{ext}"}}}}"#); + let long_title = format!(r#"{{"kind":"video","title":"{title}","durationMs":1}}"#); + let both = format!(r#"{{"kind":"video","title":"{title}","durationMs":1,"ext":{{"a.b":"{ext}"}}}}"#); + assert_eq!(checked(&long_ext), [Ok(()), Err(MediaRule::ExtSize)]); + assert_eq!(checked(&long_title), [Ok(()), Err(MediaRule::Size)]); + assert_eq!(checked(&both), [Ok(()), Err(MediaRule::ExtSize)]); +} + +#[test] +fn a_number_json_cannot_carry_in_ext_is_not_sent() { + let infinite = r#"{"kind":"video","title":"Clip","durationMs":1,"ext":{"a.b":{"n":[1e400]}}}"#; + assert_eq!(checked(infinite), [Ok(()), Err(MediaRule::ExtNumber)]); + assert_eq!(checked(r#"{"kind":"video","title":"Clip","durationMs":1,"ext":{"a.b":-1e400}}"#), [Ok(()), Err(MediaRule::ExtNumber)]); + assert_eq!(checked(r#"{"kind":"video","title":"Clip","durationMs":1,"ext":{"a.b":{"n":1e400,"n":1}}}"#)[1], Err(MediaRule::RepeatedName)); + let ext = "x".repeat(MAX_EXT_BYTES); + let long = format!(r#"{{"kind":"video","title":"Clip","durationMs":1,"ext":{{"a.b":[1e400,"{ext}"]}}}}"#); + assert_eq!(checked(&long)[1], Err(MediaRule::ExtNumber)); + let media = read(infinite).unwrap().value; + assert_eq!(Outgoing::SetMedia { media, position_ms: None }.encode(), Err(InvalidMessage("media"))); +} + +const JOINED: &str = r#"{"type":"joined","code":"D4XN7P","you":{"peerId":"p1","token":"q3Jm8f0lYc2Kx9T4bWz7RuNs6dVhA1eGpLo5iCyZk0E"},"room":{"rev":1,"code":"D4XN7P","epoch":0,"phase":"idle","positionMs":0,"atMs":15023,"rate":1,"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde","client":"Example/1.31.0","host":true,"connected":true,"player":"idle","match":null,"offsetMs":0}],"action":{"kind":"join","by":"p1"}},"media":null,"serverTime":15023}"#; + +#[test] +fn an_action_in_a_joined_room_is_an_unknown_member() { + assert!(matches!(decode(JOINED), Received::Message(Incoming::Joined { .. }))); +} + +#[test] +fn a_joined_descriptor_keeps_only_its_known_members() { + let media = r#"{"futureField":1,"kind":"episode","title":"Pilot","ids":{"tvdb":"127131","trakt":"4"},"series":{"futureField":"x","title":"Lost","ids":{"tvdb":"73739","trakt":"5"}},"season":1,"episode":1,"durationMs":2520000,"file":{"sizeBytes":1,"futureField":{"x":1}},"ext":{"com.example":{"future":[1],"x":{"y":null}}}}"#; + let known = r#"{"kind":"episode","title":"Pilot","ids":{"tvdb":"127131","trakt":"4"},"series":{"title":"Lost","ids":{"tvdb":"73739","trakt":"5"}},"season":1,"episode":1,"durationMs":2520000,"file":{"sizeBytes":1},"ext":{"com.example":{"future":[1],"x":{"y":null}}}}"#; + let joined = JOINED.replace(r#""media":null"#, &format!(r#""media":{media}"#)); + let Received::Message(Incoming::Joined { media: Some(kept), .. }) = decode(&joined) else { panic!("not a joined with media: {joined}") }; + assert_eq!(kept, read(known).unwrap().value); +} + +#[test] +fn a_peer_id_or_token_off_its_pattern_is_not_sent() { + let token = "q3Jm8f0lYc2Kx9T4bWz7RuNs6dVhA1eGpLo5iCyZk0E"; + let resume = |peer_id: &str, token: &str| Outgoing::Resume { code: "D4XN7P".into(), peer_id: peer_id.into(), token: token.into() }.encode(); + assert!(resume("p_1-A", token).is_ok()); + assert_eq!(resume("", token), Err(InvalidMessage("peerId"))); + assert_eq!(resume("p 1", token), Err(InvalidMessage("peerId"))); + assert_eq!(resume("p1", &token[1..]), Err(InvalidMessage("token"))); + assert_eq!(resume("p1", &format!("{}!", &token[1..])), Err(InvalidMessage("token"))); + assert_eq!(Outgoing::TransferHost { peer_id: "p".repeat(17) }.encode(), Err(InvalidMessage("peerId"))); + assert_eq!(Outgoing::Kick { peer_id: "p/1".into() }.encode(), Err(InvalidMessage("peerId"))); + assert!(Outgoing::Kick { peer_id: "p".repeat(16) }.encode().is_ok()); +} + +#[test] +fn relay_messages_that_fail_their_rules_are_malformed_and_others_ignored() { + assert!(matches!(decode(r#"{"type":"pong","id":1}"#), Received::Malformed("pong"))); + assert!(matches!(decode(r#"{"type":"error","code":"forbidden","message":"x"}"#), Received::Malformed("error"))); + assert!(matches!(decode(r#"{"type":"closed","reason":""}"#), Received::Malformed("closed"))); + assert!(matches!(decode(r#"{"type":"future"}"#), Received::Ignored)); + assert!(matches!(decode(r#"[1]"#), Received::Ignored)); + assert!(matches!(decode(r#"{"type":"pong","id":"a-17","serverTime":918273001}"#), Received::Message(Incoming::Pong { .. }))); +} + +fn room_with(member: &str) -> String { + room_with_padding(0).replace(r#""pad":"""#, member) +} + +#[test] +fn unknown_members_are_ignored_at_every_depth() { + let pong = r#"{"type":"pong","id":1,"serverTime":5,"future":{"a":[1,2]}}"#; + assert_eq!(decode(pong), Received::Message(Incoming::Pong { id: PingId::Number(1), server_time: 5 })); + let room = room_with_padding(0).replace(r#""offsetMs":0}"#, r#""offsetMs":0,"badge":"gold"}"#); + assert!(matches!(decode(&room), Received::Message(Incoming::Room { .. }))); +} + +#[test] +fn escaped_names_and_values_read_as_their_text() { + let pong = r#"{"type":"pong","id":"a\"b\\c","serverTime":5}"#; + assert_eq!(decode(pong), Received::Message(Incoming::Pong { id: PingId::Text(r#"a"b\c"#.into()), server_time: 5 })); +} + +#[test] +fn a_lone_surrogate_fails_a_checked_field_and_not_an_unknown_one() { + assert_eq!(decode(&room_with_padding(0).replace(r#""peerId":"p1""#, r#""peerId":"p\ud800""#)), Received::Malformed("room")); + assert!(matches!(decode(r#"{"type":"pong","id":1,"serverTime":5,"note":"\ud800"}"#), Received::Message(Incoming::Pong { .. }))); +} + +#[test] +fn error_closed_and_action_kind_keep_a_lone_surrogate_as_a_replacement() { + let error = r#"{"type":"error","code":"busy\ud800","message":"\udc00","re":"join\ud83d"}"#; + let replaced = Incoming::Error { code: "busy\u{fffd}".into(), message: "\u{fffd}".into(), re: Some("join\u{fffd}".into()) }; + assert_eq!(decode(error), Received::Message(replaced)); + assert_eq!(decode(r#"{"type":"closed","reason":"kicked\ud800"}"#), Received::Message(Incoming::Closed { reason: "kicked\u{fffd}".into() })); + let room = room_with(r#""action":{"kind":"\ud800","by":"p1"}"#); + assert!(matches!(decode(&room), Received::Message(Incoming::Room { .. }))); +} + +#[test] +fn a_relay_message_that_repeats_a_member_name_is_malformed_under_its_type() { + assert_eq!(decode(r#"{"type":"pong","id":1,"id":2,"serverTime":5}"#), Received::Malformed("pong")); + assert_eq!(decode(&room_with_padding(0).replace(r#""locked":false"#, r#""locked":false,"locked":true"#)), Received::Malformed("room")); + let ext = room_with(r#""media":{"kind":"video","title":"Clip","durationMs":1,"ext":{"a.b":{"k":1,"k":2}}}"#); + assert_eq!(decode(&ext), Received::Malformed("room")); + let joined = r#"{"type":"joined","code":"D4XN7P","code":"D4XN7P","you":{"peerId":"p1","token":"q3Jm8f0lYc2Kx9T4bWz7RuNs6dVhA1eGpLo5iCyZk0E"},"media":null,"serverTime":1}"#; + assert_eq!(decode(joined), Received::Malformed("joined")); +} + +#[test] +fn a_repeated_name_in_an_unknown_type_or_a_non_object_is_ignored() { + assert_eq!(decode(r#"{"type":"future","x":1,"x":2}"#), Received::Ignored); + assert_eq!(decode(r#"[{"a":1,"a":2}]"#), Received::Ignored); + assert_eq!(decode(r#"{"x":1,"x":2}"#), Received::Ignored); +} + +#[test] +fn numbers_past_their_range_fail_their_field() { + assert_eq!(decode(r#"{"type":"pong","id":1,"serverTime":1e400}"#), Received::Malformed("pong")); + assert_eq!(decode(r#"{"type":"pong","id":1,"serverTime":9007199254740992}"#), Received::Malformed("pong")); + assert_eq!(decode(&room_with_padding(0).replace(r#""rev":2"#, r#""rev":1e400"#)), Received::Malformed("room")); + assert_eq!(decode(&room_with_padding(0).replace(r#""rev":2"#, r#""rev":9007199254740992"#)), Received::Malformed("room")); + let ext = room_with(r#""media":{"kind":"video","title":"Clip","durationMs":1,"ext":{"a.b":{"n":1e400}}}"#); + assert!(matches!(decode(&ext), Received::Message(Incoming::Room { .. }))); +} + +#[test] +fn a_deep_ext_reads_up_to_the_recursion_limit() { + let media = |depth: usize| { + let nested = format!("{}1{}", r#"{"a":"#.repeat(depth), "}".repeat(depth)); + room_with(&format!(r#""media":{{"kind":"video","title":"Clip","durationMs":1,"ext":{{"a.b":{nested}}}}}"#)) + }; + assert!(matches!(decode(&media(100)), Received::Message(Incoming::Room { .. }))); + assert_eq!(decode(&media(5_000)), Received::Ignored); +} + +#[test] +fn unknown_error_codes_closed_reasons_and_action_kinds_stay_strings() { + let error = r#"{"type":"error","code":"queue_full","message":"later","re":"join"}"#; + assert_eq!(decode(error), Received::Message(Incoming::Error { code: "queue_full".into(), message: "later".into(), re: Some("join".into()) })); + assert_eq!(decode(r#"{"type":"closed","reason":"maintenance"}"#), Received::Message(Incoming::Closed { reason: "maintenance".into() })); + let text = room_with(r#""action":{"kind":"confetti","by":"p1"}"#); + let Received::Message(Incoming::Room { room, .. }) = decode(&text) else { panic!("{text}") }; + let kind = room.get("action").and_then(|action| action.get("kind")).and_then(Json::as_text).map(|kind| kind.value.as_str()); + assert_eq!(kind, Some("confetti")); +} diff --git a/rust-modules/ui/src/rec/strict_json.rs b/rust-modules/ui/src/rec/strict_json.rs index 7967759fac..40a76db33a 100644 --- a/rust-modules/ui/src/rec/strict_json.rs +++ b/rust-modules/ui/src/rec/strict_json.rs @@ -5,7 +5,8 @@ //! same visitor and the same budget charges, but an object keeps DOCUMENT ORDER and KEEPS DUPLICATES, //! so the HUD package parser can name the duplicate key's own JSON pointer, and can honour "the first //! condition in document order wins" for a state-keyed value. (`serde_json::Map` is a `BTreeMap` in -//! this build, so a `Value` loses both.) There is no second duplicate-key reader in the tree. +//! this build, so a `Value` loses both.) The only other reader that keeps duplicates is `plx_owp::json`, a layer +//! below `ui`, which also has to read the unpaired surrogates and overflowing numbers serde_json refuses. use serde::de::{DeserializeSeed, Deserializer, MapAccess, SeqAccess, Visitor}; use std::marker::PhantomData; diff --git a/tools/build-bench.py b/tools/build-bench.py index 1820ba0ac6..a7c42682a6 100755 --- a/tools/build-bench.py +++ b/tools/build-bench.py @@ -59,7 +59,7 @@ leaf-inc `leaf` with CARGO_INCREMENTAL=1 in rust-modules/target-fast (the `make test-fast` tree). hub-inc `hub`, incremental. The two -inc rows are skipped with a note when target-fast is absent, unless `--cold` (which builds it, untimed, first). - tests the default-feature unit suite (`cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens`, run through + tests the default-feature unit suite (`cargo test --lib -p plxnative-modules -p plx_base -p plx_machine -p plx_platform -p plx_gfx -p plx_net -p plx_ui -p plx_plex -p plx_telemetry -p plx_data -p plx_session -p plx_media -p plx_playback_contract -p plx_play_uri -p plx_play_feed -p plx_media_codecs -p plx_appkit -p plx_screens -p plx_owp`, run through tools/cargo-test-parallel.py exactly as the Makefile's recipes do) on a warm tree; the `test result:` counts of every crate are summed. arm the ARM staticlib line (`cargo rustc ... --crate-type staticlib`) after touching lib.rs, @@ -161,7 +161,7 @@ # The cargo subcommand skeletons the Makefile's recipes use. Everything else (toolchain, dirs, # feature flags, RUSTFLAGS) comes from `make -s print-bench-config`. ci/test_build_bench.py compares # these to the recipes in the Makefile. -HOST_TEST_ARGS = ("test", "--lib", "-p", "plxnative-modules", "-p", "plx_base", "-p", "plx_machine", "-p", "plx_platform", "-p", "plx_gfx", "-p", "plx_net", "-p", "plx_ui", "-p", "plx_plex", "-p", "plx_telemetry", "-p", "plx_data", "-p", "plx_session", "-p", "plx_media", "-p", "plx_playback_contract", "-p", "plx_play_uri", "-p", "plx_play_feed", "-p", "plx_media_codecs", "-p", "plx_appkit", "-p", "plx_screens") +HOST_TEST_ARGS = ("test", "--lib", "-p", "plxnative-modules", "-p", "plx_base", "-p", "plx_machine", "-p", "plx_platform", "-p", "plx_gfx", "-p", "plx_net", "-p", "plx_ui", "-p", "plx_plex", "-p", "plx_telemetry", "-p", "plx_data", "-p", "plx_session", "-p", "plx_media", "-p", "plx_playback_contract", "-p", "plx_play_uri", "-p", "plx_play_feed", "-p", "plx_media_codecs", "-p", "plx_appkit", "-p", "plx_screens", "-p", "plx_owp") HOST_TEST_BUILD_ARGS = HOST_TEST_ARGS + ("--no-run", "--message-format=json") ARM_ARGS_HEAD = ("rustc",) # then the Makefile's ARM_PROFILE_FLAG (`--release` / `--profile tvdev`) ARM_ARGS_TARGET = ("--target",) # then the target triple diff --git a/tools/fuzz-hud.py b/tools/fuzz-hud.py old mode 100755 new mode 100644 index 72fca9eb66..7d36901b9c --- a/tools/fuzz-hud.py +++ b/tools/fuzz-hud.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 -"""Build and run the `cargo fuzz` package over the HUD package and registry parsers and the WebSocket codec (`fuzz/`). +"""Build and run the `cargo fuzz` package over the HUD package and registry parsers, the WebSocket codec and the +Open Watch Party reader (`fuzz/`). python3 tools/fuzz-hud.py list python3 tools/fuzz-hud.py seed # fuzz/seeds/: seed corpora and dictionaries, from files in the tree @@ -56,6 +57,7 @@ ORIGIN = "https://huds.plxnative.com" # data/src/hudpacks/catalog.rs, ORIGIN CATALOG = ROOT / "rust-modules/data/src/hudpacks/catalog.rs" CATALOG_TESTING = ROOT / "rust-modules/data/src/hudpacks/catalog/testing.rs" +OWP_FIXTURES = ROOT / "rust-modules/owp/fixtures" # target -> (dictionary, -max_len). max_len is above the bound the parser checks first (a bundle's 2 MiB is a # plain length compare, covered in-crate; an SVG's 16 KiB and an address's 2048 bytes are reached), because @@ -70,6 +72,7 @@ "catalog_verify": ("catalog", 65536), "catalog_cache": ("catalog", 65536), "ws_frame": ("ws", 20000), + "owp_json": ("owp", 70000), } WS_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" @@ -137,6 +140,26 @@ def ws_seeds(): } +OWP_ROOM = ('{"type":"room","rev":2,"code":"K7MQ2X","epoch":0,"phase":"idle","positionMs":0,"atMs":0,"rate":1,' + '"control":"host","locked":false,"waitingOn":[],"participants":[{"peerId":"p1","name":"Edde",' + '"client":"Example/1.0","host":true,"connected":true,"player":"idle","match":null,"offsetMs":0}],' + '"action":{"kind":"join","by":"p1"}}') + + +def owp_seeds(): + seeds = {f"{path.parent.name}-{path.name}": path.read_bytes() for path in sorted(OWP_FIXTURES.glob("examples/*/*.json"))} + seeds["relays"] = (OWP_FIXTURES / "relays.json").read_bytes() + seeds.update({ + "room": OWP_ROOM, + "pong": '{"type":"pong","id":"a-17","serverTime":918273001}', + "error": '{"type":"error","code":"room_full","message":"full","re":"join"}', + "closed": '{"type":"closed","reason":"kicked"}', + "lone-surrogates": r'{"\ud800":["\udc00x","\\ud83d\ude00","\\\ud83d"]}', + "overflow": '[1e400,-1e400,"1e400",2,9007199254740992,1.79769313486231581e308]', + }) + return seeds + + def byte_entries(entries): return "".join('"%s"\n' % "".join("\\x%02x" % b for b in entry) for entry in entries) @@ -355,6 +378,9 @@ def write_seeds(): for name, data in ws_seeds().items(): put(seeds / "ws_frame", name, data) + for name, data in owp_seeds().items(): + put(seeds / "owp_json", name, data) + words = schema_words() dicts = seeds / "dict" put(dicts, "hud.dict", dict_entries(words) + '"PK\\x03\\x04"\n"PK\\x01\\x02"\n"PK\\x05\\x06"\n"manifest.json"\n"hud.json"\n"assets/"\n') @@ -374,6 +400,12 @@ def write_seeds(): b"Upgrade: websocket\r\n", b"Connection: Upgrade\r\n", b"Sec-WebSocket-Accept: ", b"Sec-WebSocket-Extensions: ", b"Sec-WebSocket-Protocol: ", ])) + put(dicts, "owp.dict", dict_entries([ + "type", "joined", "room", "pong", "error", "closed", "code", "you", "peerId", "token", "media", "serverTime", + "rev", "epoch", "phase", "positionMs", "atMs", "rate", "control", "locked", "waitingOn", "participants", + "action", "kind", "by", "ext", "ids", "title", "durationMs", "\\ud800", "\\udc00", "\\ud83d\\ude00", + "\\u0000", "\\\\", "\\\"", "1e400", "-1e400", "9007199254740992", "null", "true", + ])) put(dicts, "catalog.dict", dict_entries([ "format", "entries", "revoked", "id", "name", "version", "author", "license", "package_format", "hud_format", "app", "min", "max", "sha256", "bytes", "url", "previews", "unfit", "state", "lang", "file", "from", "langs",