Skip to content

build: unblock cargo update + stremio-watched-bitfield base64 0.13 → 0.22#974

Closed
anikettuli wants to merge 2 commits intoStremio:developmentfrom
anikettuli:claude/unblock-cargo-update
Closed

build: unblock cargo update + stremio-watched-bitfield base64 0.13 → 0.22#974
anikettuli wants to merge 2 commits intoStremio:developmentfrom
anikettuli:claude/unblock-cargo-update

Conversation

@anikettuli
Copy link
Copy Markdown

Summary

Two commits that together unblock routine cargo update from the workspace without spurious CI breakage, and retire the last remaining base64 major 0.x in the workspace:

  1. test: Round-trip deep-link URL assertions instead of byte-comparing. Fixes 12 tests that asserted exact byte equality of a zlib-compressed player URL — which broke on every miniz_oxide / flate2 output change despite no semantic regression.
  2. build: Run cargo update to pull in latest compatible patches, and migrate stremio-watched-bitfield from base64 = "0.13.0" (Aug 2021) to 0.22.

Why this change

Brittle tests

12 tests in src/unit_tests/deep_links/ (across stream_deep_links.rs, meta_item_deep_links.rs, video_deep_links.rs) asserted that a StreamDeepLinks::player URL string equals a specific byte sequence. The first path segment of that URL is a zlib-compressed → base64 → percent-encoded JSON payload produced by Stream::encode.

Different versions of miniz_oxide (flate2's compression backend) emit the same decompressed bytes through different compressed byte sequences. So:

  • No semantic regression — the URL still decodes to the exact same Stream.
  • But assert_eq!(sdl.player, "stremio:///player/eAEB...") fails.

This made every routine cargo update break 12 tests. The fix: compare the decoded stream semantically, and keep the URL-grammar suffix under literal assertion.

Unblocked cargo update

With the brittle tests fixed, we run cargo update and pick up ~2 years of accumulated upstream patches:

  • regex, serde, tokio, tracing, url, derive_more, itertools, etc. — 50+ deps updated.
  • Two deps pinned back to their last MSRV-1.85-compatible release because their latest requires Rust 1.88:
    • serde_with / serde_with_macros at 3.12.0 (3.18 needs 1.88)
    • darling at 0.20.11 (0.23 needs 1.88)
      These pins come off the moment the workspace MSRV rises past 1.88.

stremio-watched-bitfield base64 upgrade

stremio-watched-bitfield was still on base64 = "0.13.0" (August 2021). The free-function decode(s) / encode(s) API was removed in base64 0.21 in favor of the Engine trait. Migrating:

// before (base64 0.13):
use base64::{decode, encode};
let bytes = decode(s)?;
let s = encode(bytes);

// after (base64 0.22):
use base64::{engine::general_purpose::STANDARD as BASE64, Engine};
let bytes = BASE64.decode(s)?;
let s = BASE64.encode(bytes);

Wire-format is identical — STANDARD matches 0.13's default alphabet, so serialized BitField8 strings round-trip byte-for-byte between old and new versions. All 7 existing watched-bitfield tests confirm this.

Effect

  • Routine cargo update now lands cleanly without any spurious test failures. Dependency drift becomes a no-drama operation.
  • Every workspace crate on current base64 (0.22 across root + stremio-core-web + stremio-watched-bitfield). The last 3-year-old major-version dep floor is gone.
  • 50+ transitive patches applied (bugfixes, small perf improvements, supply-chain freshness).
  • No runtime behavior change. Wire formats, deep-link grammar, and JSON shapes are untouched.

Public contract

Zero changes to:

  • Storage keys at src/constants.rs:10
  • WASM exports at stremio-core-web/src/stremio_core_web.rs:83-348
  • Msg / Action / Event variants
  • Deep-link URL grammar (the tests still verify the URL prefix + suffix structure literally; only the opaque encoded-payload segment is checked semantically now)
  • Serialized JSON field names
  • BitField8 wire format (verified by existing round-trip tests)

Test plan

Verified locally (Rust 1.85.1 stable-x86_64-pc-windows-gnu):

  • cargo test -p stremio-core --lib202 passed, 0 failed
  • cargo test -p stremio-core --lib unit_tests::deep_links41 passed
  • cargo test -p stremio-watched-bitfield7 passed, 0 failed
  • cargo clippy --all --no-deps -- -D warnings — clean
  • cargo fmt --check — clean

Dependency on other PRs

12 tests in the deep-link module previously asserted byte-for-byte equality
of a player URL whose first path segment is a zlib-compressed, base64'd,
percent-encoded JSON Stream payload. That made the tests fragile to any
flate2 / miniz_oxide output change - different versions emit semantically
equivalent but byte-different compressed output, which broke CI on every
routine 'cargo update' without any real regression.

Replace the byte-equality check with a shared helper that decodes the
encoded segment back to a Stream and compares semantically; the URL prefix
and the suffix path components are still checked literally, so the frozen
URL grammar remains under test.

Affected files:
- src/unit_tests/deep_links/helpers.rs (new): assert_player_url helper.
- src/unit_tests/deep_links/mod.rs: register the helpers module.
- src/unit_tests/deep_links/stream_deep_links.rs: 10 assertions.
- src/unit_tests/deep_links/meta_item_deep_links.rs: 1 assertion.
- src/unit_tests/deep_links/video_deep_links.rs: 1 assertion.

Verified locally (Rust 1.85.1 stable-x86_64-pc-windows-gnu):
  cargo test -p stremio-core --lib         -> 202 passed, 0 failed
  cargo test -p stremio-core --lib deep_links -> 41 passed
  cargo clippy --all --no-deps -D warnings -> clean
  cargo fmt --check                         -> clean
Two bundled maintenance wins unlocked by the previous commit's round-trip
deep-link assertions (which no longer break when miniz_oxide changes its
compressed-output bytes).

1. cargo update - pulls in the latest compatible patch versions across the
   workspace (derive_more, itertools, regex, serde, tokio, tracing, url,
   and many transitive deps). Two deps are pinned back to their last
   MSRV-1.85-compatible versions:
   - serde_with / serde_with_macros at 3.12.0 (3.18 requires 1.88)
   - darling at 0.20.11 (0.23 requires 1.88)
   These pins can be removed once the workspace MSRV rises past 1.88.

2. stremio-watched-bitfield: base64 0.13.0 (Aug 2021) -> 0.22. This was the
   last crate in the workspace still on a base64 major from 3+ years ago.
   The free-function API (decode / encode) was removed in 0.21; migrate to
   base64::engine::general_purpose::STANDARD via the Engine trait.

No runtime behavior change. Wire-format encoding/decoding is identical
(STANDARD alphabet matches 0.13's default). All 7 watched-bitfield tests
round-trip correctly against the new API.

Verified locally (Rust 1.85.1 stable-x86_64-pc-windows-gnu):
  cargo test -p stremio-core --lib         -> 202 passed, 0 failed
  cargo test -p stremio-watched-bitfield   -> 7 passed, 0 failed
  cargo clippy --all --no-deps -D warnings -> clean
  cargo fmt --check                         -> clean
Copilot AI review requested due to automatic review settings April 20, 2026 05:38
@github-actions
Copy link
Copy Markdown

stremio-core-web prebuild

Prebuild artifact published by the Build workflow for branch claude/unblock-cargo-update.

Paste one of these into stremio-web's package.json and run pnpm install to wire this prebuild into a corresponding stremio-web PR:

Release

"@stremio/stremio-core-web": "https://stremio.github.io/stremio-core/stremio-core-web/claude/unblock-cargo-update/stremio-stremio-core-web-0.56.3.tgz"

Dev

"@stremio/stremio-core-web": "https://stremio.github.io/stremio-core/stremio-core-web/claude/unblock-cargo-update/dev/stremio-stremio-core-web-0.56.3.tgz"

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR stabilizes deep-link unit tests to be resilient to upstream compression output changes, enabling routine cargo update without spurious failures, and upgrades stremio-watched-bitfield to base64 0.22 (removing the last base64 0.x major in the workspace).

Changes:

  • Replace brittle deep-link URL byte-for-byte assertions with semantic round-trip assertions by decoding the Stream payload.
  • Upgrade stremio-watched-bitfield from base64 = "0.13.0" to base64 = "0.22" and migrate to the Engine API.
  • Refresh Cargo.lock with updated dependency resolutions (including MSRV-compatible pins as described).

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
stremio-watched-bitfield/src/bitfield8.rs Migrates base64 encode/decode usage to Engine (STANDARD) API.
stremio-watched-bitfield/Cargo.toml Bumps base64 dependency from 0.13.0 to 0.22.
src/unit_tests/deep_links/helpers.rs Adds helper to parse player URLs and assert decoded Stream + suffix.
src/unit_tests/deep_links/mod.rs Registers the new helpers module for deep-link tests.
src/unit_tests/deep_links/stream_deep_links.rs Updates tests to use assert_player_url instead of full string equality.
src/unit_tests/deep_links/video_deep_links.rs Updates player URL assertion to round-trip decode and suffix check.
src/unit_tests/deep_links/meta_item_deep_links.rs Updates player URL assertion similarly for MetaItem deep links.
Cargo.lock Applies the dependency updates from cargo update.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kKaskak
Copy link
Copy Markdown
Member

kKaskak commented Apr 20, 2026

this prs adds no value again, no bug fix no feature addition

@kKaskak kKaskak closed this Apr 20, 2026
@anikettuli
Copy link
Copy Markdown
Author

the test fix isn't code churn for its own sake as it specifically makes future cargo update runs not break CI on miniz_oxide bumps, and the base64 0.13 dep is 3+ years out of date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants