Skip to content

fix(preview): honor non-FHS media runtime configuration - #2098

Merged
l0gicgate merged 5 commits into
mainfrom
fix/2097-nix-media-runtime
Nov 9, 2026
Merged

l0gicgate merged 5 commits into
mainfrom
fix/2097-nix-media-runtime

Conversation

@JoeJoeflyn

@JoeJoeflyn JoeJoeflyn commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Honor the configured absolute STRATA_SANDBOX_PRLIMIT in media and artwork helpers instead of searching PATH. Lower waveform/storyboard helper priority directly, removing their external nice dependency while preserving decoder limits and sandbox isolation.

Includes runtime regression coverage and the workaround for already-published 1.2.0 binaries. CodeScene was skipped with explicit owner authorization (“no need codescene”); no code-health score was verified.

Visual evidence

Before:
nix-preview-bug
After:
nix-preview-fixed

How to test

  1. Package a build of this branch with a non-FHS runtime, such as Nix. Set STRATA_SANDBOX_ROOT=/nix/store, put FFmpeg/ffprobe in STRATA_SANDBOX_PATH without the util-linux/coreutils directories, and set STRATA_SANDBOX_PRLIMIT to the absolute store path of prlimit. Keep bubblewrap available in a trusted system directory.
  2. Preview and play a local H.264/AAC video lasting at least six seconds. Check its waveform and storyboard; also preview audio with embedded artwork.
  3. Restart with an unavailable absolute limiter path, observe the preview failure, then restore the valid limiter and retry playback.

Expected result: Media, artwork and background previews work without locating prlimit or nice through PATH. An unavailable configured limiter fails closed; restoring it restores playback.

Related issue

Closes #2097

Pass the resolved resource limiter into media and artwork helpers, and lower background helper scheduling priority directly instead of looking up nice. Keep per-decoder limits and accelerated helper policy intact.

Add real decoder coverage with prlimit and nice absent from PATH, and exercise configured limiter failure and recovery through the existing video QA scenario.

Refs #2097
CI exports only relocated test executables, so CARGO_BIN_EXE_strata points to an application binary absent from the shard.

Move the regression beside the media helper tests and re-execute the current test binary to dispatch the real helper entry point. Preserve actual decoder output, absolute limiter, and inherited priority assertions for all five operations.

Verify the relocated executable with both Cargo build directories hidden.
The GIO handler is process-wide and can capture missing-attribute diagnostics emitted by an unrelated metadata test running in parallel.

Only record diagnostics from the thread measuring this fixture, retaining the original missing-attribute and summary assertions. The two-test reproducer failed before this fix and passed twenty consecutive runs afterwards.
@JoeJoeflyn

Copy link
Copy Markdown
Collaborator Author

CI fixes

Main was already merged/up to date at e9a8993b; no conflicts or production media changes were needed for these follow-ups.

  • 3918530d — CI exports only test executables. The new integration regression used CARGO_BIN_EXE_strata, which pointed at an absent build-tree application. Reproduced the exact failure using the downloaded CI binary with its build directory hidden; execve traced the missing application path. Moved the regression to sandbox_helper::media::tests::runtime and made it re-execute its current test binary to call the real helper entry point in a fresh process. All five decoder operations, output-content checks, absolute limiter checks, and inherited scheduling-priority checks remain. No tests were deleted or disabled; the coverage owner moved. The boundary is now the real helper dispatcher rather than the application CLI wrapper.
  • d2e4690b — the next CI run passed the media regression but exposed an existing parallel-test race. measure_entry_reads_no_unset_optional_attributes installed a process-wide GIO handler and collected diagnostics from the parallel creation-time metadata test. Its exact isolated run passed; the two-test selection failed on attempt two with the same four captured messages as CI. Restricting collection to the measuring thread preserves the original missing-attribute and summary assertions without counting another test's diagnostics.

Scoped validation

All executable checks below ran inside the verified pinned container, with private Xvfb/private D-Bus and accessibility bridging disabled. No desktop display/session bus or host toolkit was used.

./scripts/test-headless.py --locked sandbox_helper::media::tests::runtime::media_runtime_overrides_decode_without_prlimit_or_nice_on_path -- --exact
  1 passed.

Relocated test executable, with both target/debug and target/quality-container/build hidden:
  test-strata --exact sandbox_helper::media::tests::runtime::media_runtime_overrides_decode_without_prlimit_or_nice_on_path --nocapture
    1 passed.
  test-strata sandbox_helper::media:: --test-threads 1 --nocapture
    12 passed.
  test-strata sandbox::tests::command:: --test-threads 1 --nocapture
    13 passed.

./scripts/test-headless.py --locked adapters::directory_summary::tests::measure_entry_reads_no_unset_optional_attributes -- --exact
  1 passed after the capture fix.

Paired selection, --test-threads 2 --nocapture:
  adapters::directory_summary::tests::measure_entry_reads_no_unset_optional_attributes
  adapters::local_files::tests::browse::streamed_creation_time_is_filled_before_created_sorting
    Before fix: failed on attempt 2.
    After fix: 20 consecutive runs passed, 2 tests each.

test-strata adapters::directory_summary:: --test-threads 2 --nocapture
  16 passed.

./scripts/quality.sh fmt
./scripts/quality.sh clippy
  Passed after each follow-up's final code.
git diff --check
  Passed.

An earlier scoped compilation exceeded the terminal command timeout; its missing output is not counted as passing evidence. The subsequent recorded relocated-binary selections are the reported caller/regression results. No full local Rust/QA rerun was used to diagnose either isolated failure. GUI QA was intentionally not rerun for these test-only changes; previous feature validation is preserved. The normal PR workflow skips GUI QA, which is not reported as passed. CodeScene remains explicitly owner-waived and unverified as recorded for this PR.

Independent read-only review found no new recursion, decoder-priority, timeout, or runtime-configuration regression in the test relocation. No screenshots, recordings, logs, or one-off scripts were committed. Existing owner-uploaded visual evidence was left untouched.

CI: all required checks are green on d2e4690b, including all four Rust shards and exact aggregate coverage verification: https://github.com/lgse/strata/actions/runs/42605317937. GUI QA is skipped by the existing PR workflow.

@l0gicgate

Copy link
Copy Markdown
Contributor

Review and cleanup

Merged main at 1a697bbf (Hungarian catalog fixes only). No conflicts.

Review against the description and #2097.

  • Every FFmpeg decoder (playback, audio, waveform, storyboard, embedded artwork) now runs the resolved absolute STRATA_SANDBOX_PRLIMIT path instead of looking up prlimit by name. Confirmed in src/sandbox_helper/media.rs (ffmpeg_command). The host forwards only the validated value, through --setenv, to media and audio-cover helpers (src/sandbox/command.rs). Coverage: sandbox::tests::command::media_previews_use_bounded_streaming_instead_of_driver_wide_resource_limits and audio_artwork_forwards_prlimit_and_keeps_the_outer_resource_limits.
  • Waveform and storyboard helpers lower their own priority (+10, capped at 19) with setpriority before probing; decoders inherit it, so nice is no longer needed. Per-decoder --core, --fsize and software --as limits are unchanged, and the accelerated helper is still not address-space limited.
  • sandbox_helper::media::tests::runtime::media_runtime_overrides_decode_without_prlimit_or_nice_on_path was checked by mutation: switching ffmpeg_command back to Command::new("prlimit") makes it fail. The change was reverted.
  • adapters::directory_summary::tests::measure_entry_reads_no_unset_optional_attributes: the thread filter keeps the test meaningful. The missing-attribute criticals come from GFileInfo accessors run through PrivateContext::block_on on the test thread.
  • QA: the added video-preview-badges-next-video/columns-mp4 steps stay. The configured /usr/bin/false limiter step fails without the fix, and the restore step is the only QA check that video playback actually advances.
  • No inline review threads or reviews existed. The author's CI-fix comment is consistent with the current code.

Fixes pushed

  • 127bef4a refactor(preview): tighten media runtime review comments. Shortened two comments added by the PR.

Tests removed: none. Each added or changed test catches a distinct regression.

Validation

  • ./scripts/test-headless.py -- sandbox_helper::media:: sandbox::tests::command:: sandbox::runtime:: adapters::directory_summary::: 46 passed
  • ./scripts/qa.sh --test-threads 6 video-preview-badges-next-video: 6 passed in the pinned container (PR CI skips QA scenarios)
  • ./scripts/quality.sh fmt, ./scripts/quality.sh clippy: clean
  • Not run: full Rust or QA suites (bounded media change; CI ran the Rust shards). CodeScene stays owner-waived, as recorded in the PR body.

CI: all checks green on 127bef4a.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(preview): honor sandbox media runtime paths on NixOS

2 participants