test: Streamline's consent checks run on Linux CI, and build() refuses Streamline without its licence under test #381

Open
opened 2026-11-30 12:18:17 +00:00 by Jiro113 · 1 comment
Member

#344 adds Frame Generation through Streamline to the DLSS card, behind its own licence. A cold review of it found two gaps in its tests, kept out of that PR on purpose: on Linux CI, nothing would catch a change that records the licence, or takes Streamline, without the player's consent. Line numbers below are at #344's head 7e5b06a.

The Streamline half of module_tests::inspecting_a_version_preserves_activation_and_targets_its_modules (src/game/actions.rs) sits in if cfg!(windows) blocks, because the code it drives reads the platform directly: show_license (cfg!(windows) at lines 458 and 489, through streamline_offered) and the accept handler. Streamline is offered only on Windows, so on Linux the dialog never opens and these checks are skipped. .forgejo/workflows/ci.yml runs on ubuntu-24.04 only.

These mutations of the accept handler pass CI today. Only a cargo test on Windows catches them:

  • dropping the ensure! that turns Streamline on only for a builder known to place it (g.get_streamline_support() == 1, line 564);
  • recording Streamline's licence before the choice is saved (lines 570 to 580), which leaves the licence accepted where the choice couldn't be saved;
  • dropping the unusable check (line 642), which then shows Streamline's dialog after DLSS for a builder known not to place it.

Proposal: pass the platform in rather than reading cfg!(windows) inside: a windows: bool argument to show_license and to the accept path (or a test-only override, as set_streamline_on already takes windows in src/game/versions/modules.rs), so the same assertions run on Linux with windows = true. The test's if cfg!(windows) blocks then become unconditional for the Streamline part.

B. build()'s licence check for Streamline has no test

src/game/wizard.rs lines 500 to 503:

ensure!(
    !options.streamline || versions::accepted_streamline(&settings),
    "Accept the licence for Frame Generation through Streamline first."
);

No test reaches it: the wizard tests build Options by hand and don't go through build(). Removing this ensure! fails no test. Without it, a build that takes Streamline would go on to streamline_flag (line 833), which writes the licence receipt licenses.streamline into the profile without the licence accepted in the launcher. The Build page normally keeps the choice and the licence together, so this check is the last guard rather than the only one.

Proposal: move the computation of Options and its licence checks out of build() into a pure function (the window's choices, the release tag and the settings in; Result<Options> out), and test it: Streamline without its licence is refused, Streamline on a Stable tag or off Windows is dropped, and DLSS off drops Streamline.

Not in scope

  • The Versions card's Streamline FG reading the build record (src/game/mod.rs), and Play's can("streamline") call (src/game/versions.rs, line 449), are also untested. They are smaller and could go in the same change.
  • Nothing here changes what the launcher does: these are tests and the refactoring they need.
[#344](https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/344) adds Frame Generation through Streamline to the DLSS card, behind its own licence. A cold review of it found two gaps in its tests, kept out of that PR on purpose: on Linux CI, nothing would catch a change that records the licence, or takes Streamline, without the player's consent. Line numbers below are at #344's head `7e5b06a`. ## A. The consent tests run on Windows only, and CI runs on Linux only The Streamline half of `module_tests::inspecting_a_version_preserves_activation_and_targets_its_modules` (`src/game/actions.rs`) sits in `if cfg!(windows)` blocks, because the code it drives reads the platform directly: `show_license` (`cfg!(windows)` at lines 458 and 489, through `streamline_offered`) and the accept handler. Streamline is offered only on Windows, so on Linux the dialog never opens and these checks are skipped. `.forgejo/workflows/ci.yml` runs on `ubuntu-24.04` only. These mutations of the accept handler pass CI today. Only a `cargo test` on Windows catches them: - dropping the `ensure!` that turns Streamline on only for a builder known to place it (`g.get_streamline_support() == 1`, line 564); - recording Streamline's licence before the choice is saved (lines 570 to 580), which leaves the licence accepted where the choice couldn't be saved; - dropping the `unusable` check (line 642), which then shows Streamline's dialog after DLSS for a builder known not to place it. **Proposal:** pass the platform in rather than reading `cfg!(windows)` inside: a `windows: bool` argument to `show_license` and to the accept path (or a test-only override, as `set_streamline_on` already takes `windows` in `src/game/versions/modules.rs`), so the same assertions run on Linux with `windows = true`. The test's `if cfg!(windows)` blocks then become unconditional for the Streamline part. ## B. `build()`'s licence check for Streamline has no test `src/game/wizard.rs` lines 500 to 503: ```rust ensure!( !options.streamline || versions::accepted_streamline(&settings), "Accept the licence for Frame Generation through Streamline first." ); ``` No test reaches it: the `wizard` tests build `Options` by hand and don't go through `build()`. Removing this `ensure!` fails no test. Without it, a build that takes Streamline would go on to `streamline_flag` (line 833), which writes the licence receipt `licenses.streamline` into the profile without the licence accepted in the launcher. The Build page normally keeps the choice and the licence together, so this check is the last guard rather than the only one. **Proposal:** move the computation of `Options` and its licence checks out of `build()` into a pure function (the window's choices, the release tag and the settings in; `Result<Options>` out), and test it: Streamline without its licence is refused, Streamline on a Stable tag or off Windows is dropped, and DLSS off drops Streamline. ## Not in scope - The Versions card's **Streamline FG** reading the build record (`src/game/mod.rs`), and Play's `can("streamline")` call (`src/game/versions.rs`, line 449), are also untested. They are smaller and could go in the same change. - Nothing here changes what the launcher does: these are tests and the refactoring they need.
Member

Possibly related, for context:

  • PR #344 feat(settings): NVIDIA DLSS's card offers Frame Generation through Streamline on Windows — Open feature PR whose consent and build guards need these tests
Possibly related, for context: - PR #344 feat(settings): NVIDIA DLSS's card offers Frame Generation through Streamline on Windows — Open feature PR whose consent and build guards need these tests
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher#381
No description provided.