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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ jobs:
# found" and prove nothing.
env:
VAPOURBOX_WORKER: ${{ github.workspace }}/worker/target/debug/vapourbox-worker
# A failing output conformance case keeps its output, job and log
# here, uploaded below (task #99).
VAPOURBOX_CONFORMANCE_KEEP: ${{ github.workspace }}/conformance-failures
# Not @Tags(['gpu']): the hosted runners have no GPU (dart_test.yaml).
# `sweep` tests are also `heavy`; each leg takes its own.
run: >-
Expand All @@ -163,6 +166,18 @@ jobs:
if: ${{ !cancelled() && matrix.suite == 'heavy' && steps.build.outcome == 'success' }}
run: cd worker && cargo test --test subtitle_integration_test -- --ignored --nocapture

- name: Failing conformance cases (task #99)
# Each failing case of integration_output_conformance_test.dart: its
# output file, job and log, so an intermittent failure can be measured
# offline.
if: ${{ failure() && matrix.suite == 'heavy' }}
uses: actions/upload-artifact@v5
with:
name: conformance-failures-${{ matrix.asset }}
path: conformance-failures/
if-no-files-found: ignore
retention-days: 14

- name: Format sweep results
# Every row's outcome, time and differences (integration_format_sweep_test.dart).
if: ${{ always() && matrix.suite == 'sweep' }}
Expand Down Expand Up @@ -289,6 +304,9 @@ jobs:
# `flutter test`, where the running executable is the test runner.
env:
VAPOURBOX_WORKER: ${{ github.workspace }}\worker\target\debug\vapourbox-worker.exe
# A failing output conformance case keeps its output, job and log
# here, uploaded below (task #99).
VAPOURBOX_CONFORMANCE_KEEP: ${{ github.workspace }}/conformance-failures
# Not @Tags(['gpu']): the hosted runners have no GPU (dart_test.yaml).
# `sweep` tests are also `heavy`; each leg takes its own.
run: >-
Expand All @@ -302,6 +320,18 @@ jobs:
if: ${{ !cancelled() && matrix.suite == 'heavy' && steps.build.outcome == 'success' }}
run: cd worker && cargo test --test subtitle_integration_test -- --ignored --nocapture

- name: Failing conformance cases (task #99)
# Each failing case of integration_output_conformance_test.dart: its
# output file, job and log, so an intermittent failure can be measured
# offline.
if: ${{ failure() && matrix.suite == 'heavy' }}
uses: actions/upload-artifact@v5
with:
name: conformance-failures-${{ matrix.asset }}
path: conformance-failures/
if-no-files-found: ignore
retention-days: 14

- name: Format sweep results
# Every row's outcome, time and differences (integration_format_sweep_test.dart).
if: ${{ always() && matrix.suite == 'sweep' }}
Expand Down Expand Up @@ -415,6 +445,9 @@ jobs:
# found" and prove nothing.
env:
VAPOURBOX_WORKER: ${{ github.workspace }}/worker/target/debug/vapourbox-worker
# A failing output conformance case keeps its output, job and log
# here, uploaded below (task #99).
VAPOURBOX_CONFORMANCE_KEEP: ${{ github.workspace }}/conformance-failures
# Not @Tags(['gpu']): the hosted runners have no GPU (dart_test.yaml).
# `sweep` tests are also `heavy`; each leg takes its own.
run: >-
Expand All @@ -428,6 +461,18 @@ jobs:
if: ${{ !cancelled() && matrix.suite == 'heavy' && steps.build.outcome == 'success' }}
run: cd worker && cargo test --test subtitle_integration_test -- --ignored --nocapture

- name: Failing conformance cases (task #99)
# Each failing case of integration_output_conformance_test.dart: its
# output file, job and log, so an intermittent failure can be measured
# offline.
if: ${{ failure() && matrix.suite == 'heavy' }}
uses: actions/upload-artifact@v5
with:
name: conformance-failures-${{ matrix.asset }}
path: conformance-failures/
if-no-files-found: ignore
retention-days: 14

- name: Format sweep results
# Every row's outcome, time and differences (integration_format_sweep_test.dart).
if: ${{ always() && matrix.suite == 'sweep' }}
Expand Down
202 changes: 202 additions & 0 deletions .github/workflows/repro-output-conformance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
name: Reproduce an output conformance flake (macOS)

# Task #99: AV1-into-MP4 cases of integration_output_conformance_test.dart
# failed now and then on the macOS x64 nightly (99 pictures for 100; a case
# that hung past the test's 3 minutes). This runs the suspects in a loop on
# the nightly's runners, layer by layer. Phases (space-separated `phases`):
# versions the bundle's FFmpeg, SVT-AV1 and AV1 decoders (B0)
# b1 the cases matching `name`, `iterations` times each, in one
# flutter test process (VAPOURBOX_CONFORMANCE_REPEAT)
# b1load every mp4+av1 case, `load_iterations` times each, with every
# core but one busy, as nightly's concurrent test files are
# b2 the encoder alone: one job's captured Y4M fed to its exact
# encoder command `replays` times, from a file and throttled,
# then 4 at once under load (scripts/replay_encoder.py)
# b3 the test's own decodes of that output (and of any output b1
# kept failing), `replays` times per decoder variant
# (scripts/measure_decode.py)
# Scripts: docs/reports/task-99-av1-conformance-flake/scripts. Every failing
# case's output, job and log are uploaded (VAPOURBOX_CONFORMANCE_KEEP).
#
# Dispatch it, or push a change to this file on a `stuart/99-probe-*`
# branch: a workflow that is not on the default branch cannot be dispatched,
# and a push then runs it with the defaults below.

on:
workflow_dispatch:
inputs:
name:
description: 'b1: --name regex of the cases to loop'
default: 'mp4\+av1/passthrough/delayed-avi/(untrimmed|near-start)'
iterations:
description: 'b1: runs of each case'
default: '60'
load_iterations:
description: 'b1load: runs of each mp4+av1 case under load'
default: '15'
replays:
description: 'b2/b3: runs per mode or decoder variant'
default: '300'
phases:
description: 'Space-separated: versions b1 b1load b2 b3'
default: 'versions b1 b1load b2 b3'
push:
branches: ['stuart/99-probe-*']
paths: ['.github/workflows/repro-output-conformance.yml']

permissions:
contents: read
actions: read

jobs:
repro:
strategy:
fail-fast: false
matrix:
include:
- {arch: x64, runner: macos-15-intel, asset: macos-x64}
- {arch: x64, runner: macos-15-intel, asset: macos-x64-v2}
# The control: arm64 never failed these cases.
- {arch: arm64, runner: macos-15, asset: macos-arm64}
name: repro (${{ matrix.asset }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 200
env:
VAPOURBOX_DEPS_DIR: ${{ github.workspace }}/deps/macos-${{ matrix.arch }}
VAPOURBOX_WORKER: ${{ github.workspace }}/worker/target/debug/vapourbox-worker
NAME: ${{ inputs.name || 'mp4\+av1/passthrough/delayed-avi/(untrimmed|near-start)' }}
ITER: ${{ inputs.iterations || '60' }}
LOAD_ITER: ${{ inputs.load_iterations || '15' }}
REPLAYS: ${{ inputs.replays || '300' }}
PHASES: ${{ inputs.phases || 'versions b1 b1load b2 b3' }}
S: ${{ github.workspace }}/docs/reports/task-99-av1-conformance-flake/scripts
R: ${{ github.workspace }}/repro-out
steps:
- uses: actions/checkout@v5

- name: Resolve deps tag
id: deps
run: |
TAG=$(python3 -c "import json;print(json.load(open('app/assets/deps-version.json'))['releaseTag'])")
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "ver=${TAG#deps-v}" >> "$GITHUB_OUTPUT"

- uses: subosito/flutter-action@v2
with:
channel: stable
cache: false
pub-cache-path: ${{ runner.temp }}/pub-cache

- uses: dtolnay/rust-toolchain@stable

- name: Download dependencies (${{ matrix.asset }})
env:
GH_TOKEN: ${{ github.token }}
run: |
bash .github/scripts/install-deps-bundle.sh "${{ matrix.asset }}" \
"${{ steps.deps.outputs.tag }}" "${{ steps.deps.outputs.ver }}" "deps/macos-${{ matrix.arch }}"
xattr -cr "deps/macos-${{ matrix.arch }}" 2>/dev/null || true

- name: Build worker and generate Dart serialization
run: |
(cd worker && cargo build)
cd app && flutter pub get && dart run build_runner build --delete-conflicting-outputs

- name: B0 versions
if: contains(env.PHASES, 'versions')
run: |
mkdir -p "$R"
FF="$VAPOURBOX_DEPS_DIR/ffmpeg/ffmpeg"; [ -x "$FF" ] || FF=$(find "$VAPOURBOX_DEPS_DIR" -name ffmpeg -type f -perm +111 | head -1)
{
echo "cpu: $(sysctl -n machdep.cpu.brand_string) cores $(sysctl -n hw.ncpu)"
"$FF" -hide_banner -version | head -3
"$FF" -hide_banner -buildconf | grep -iE 'svt|dav1d|aom' || true
echo "AV1 decoders:"; "$FF" -hide_banner -decoders | grep -i av1
echo "SVT-AV1 banner:"
SVT_LOG=4 "$FF" -hide_banner -v info -f lavfi -i testsrc2=s=160x120:r=25:d=0.2 \
-c:v libsvtav1 -preset 10 -f null - 2>&1 | grep -iE 'svt|version|lib' | head -12
echo "decoder ffmpeg picks for AV1:"
"$FF" -hide_banner -v error -y -f lavfi -i testsrc2=s=160x120:r=25:d=0.2 -c:v libsvtav1 "$RUNNER_TEMP/v.mp4"
"$FF" -hide_banner -nostats -v verbose -i "$RUNNER_TEMP/v.mp4" -f null - 2>&1 | grep -E 'Stream #0:0 ->|dav1d|libaom' | head -5
} 2>&1 | tee "$R/versions.txt"

- name: B1 the cases in a loop
if: contains(env.PHASES, 'b1 ') || endsWith(env.PHASES, 'b1')
run: |
mkdir -p "$R/kept-b1"
cd app
VAPOURBOX_CONFORMANCE_REPEAT=$ITER VAPOURBOX_CONFORMANCE_KEEP="$R/kept-b1" \
flutter test --tags heavy test/integration_output_conformance_test.dart \
--name "$NAME" --reporter compact --file-reporter "json:$R/b1.json" > "$R/b1.log" 2>&1 || true
tail -5 "$R/b1.log"
python3 "$S/summarize_flutter_json.py" "$R/b1.json" "B1 $NAME x$ITER" | tee "$R/b1-summary.txt"

- name: B1 every mp4+av1 case under load
if: contains(env.PHASES, 'b1load')
run: |
mkdir -p "$R/kept-b1load"
N=$(sysctl -n hw.ncpu); for i in $(seq $((N - 1))); do yes > /dev/null & done
cd app
VAPOURBOX_CONFORMANCE_REPEAT=$LOAD_ITER VAPOURBOX_CONFORMANCE_KEEP="$R/kept-b1load" \
flutter test --tags heavy test/integration_output_conformance_test.dart \
--name 'mp4\+av1/' --reporter compact --file-reporter "json:$R/b1load.json" > "$R/b1load.log" 2>&1 || true
pkill yes || true
tail -5 "$R/b1load.log"
python3 "$S/summarize_flutter_json.py" "$R/b1load.json" "B1 load mp4+av1 x$LOAD_ITER" | tee "$R/b1load-summary.txt"

- name: B2 the encoder alone
if: contains(env.PHASES, 'b2')
run: |
VS="$VAPOURBOX_DEPS_DIR/vapoursynth"
bash "$S/capture-vspipe-stdout.sh" install "$VS" "$R/capture"
(cd app && VAPOURBOX_CONFORMANCE_KEEP="$R/kept-b2" VAPOURBOX_CONFORMANCE_KEEP_ALL=1 \
flutter test --tags heavy test/integration_output_conformance_test.dart \
--plain-name 'mp4+av1/passthrough/delayed-avi/untrimmed' --reporter compact) || true
bash "$S/capture-vspipe-stdout.sh" uninstall "$VS"
Y4M=$(ls "$R"/capture/run.*/out.y4m | head -1)
LOG=$(ls "$R"/kept-b2/*/log.txt | head -1)
echo "y4m $Y4M ($(wc -c < "$Y4M") bytes), log $LOG"
FF="$VAPOURBOX_DEPS_DIR/ffmpeg/ffmpeg"; FP="$VAPOURBOX_DEPS_DIR/ffmpeg/ffprobe"
for mode in file throttled; do
python3 -I "$S/replay_encoder.py" --log "$LOG" --y4m "$Y4M" --ffmpeg "$FF" --ffprobe "$FP" \
--out "$R/b2-$mode" --runs "$REPLAYS" --mode "$mode" | tee "$R/b2-$mode.txt"
done
N=$(sysctl -n hw.ncpu); for i in $(seq $((N - 1))); do yes > /dev/null & done
python3 -I "$S/replay_encoder.py" --log "$LOG" --y4m "$Y4M" --ffmpeg "$FF" --ffprobe "$FP" \
--out "$R/b2-load" --runs "$REPLAYS" --mode throttled --parallel 4 | tee "$R/b2-load.txt"
pkill yes || true
rm -rf "$R/capture"

- name: B3 the test's own decodes
if: contains(env.PHASES, 'b3')
run: |
FF="$VAPOURBOX_DEPS_DIR/ffmpeg/ffmpeg"; FP="$VAPOURBOX_DEPS_DIR/ffmpeg/ffprobe"
GOOD=$(ls "$R"/kept-b2/*/*.mp4 2>/dev/null | head -1)
BAD=$(ls "$R"/kept-b1*/*/*.mp4 2>/dev/null | head -1)
for f in $GOOD $BAD; do
tag=$( [ "$f" = "$GOOD" ] && echo good || echo bad )
python3 -I "$S/measure_decode.py" --file "$f" --ffmpeg "$FF" --ffprobe "$FP" \
--out "$R/b3-$tag" --runs "$REPLAYS" | tee "$R/b3-$tag.txt"
N=$(sysctl -n hw.ncpu); for i in $(seq $((N - 1))); do yes > /dev/null & done
python3 -I "$S/measure_decode.py" --file "$f" --ffmpeg "$FF" --ffprobe "$FP" \
--out "$R/b3-$tag-load" --runs "$REPLAYS" --parallel 4 | tee "$R/b3-$tag-load.txt"
pkill yes || true
done

- name: Summary
if: always()
run: |
for f in "$R"/versions.txt "$R"/*summary.txt "$R"/b2-*.txt "$R"/b3-*.txt; do
[ -f "$f" ] && { echo "=== $(basename "$f")"; tail -30 "$f"; }
done

- name: Upload
if: always()
uses: actions/upload-artifact@v5
with:
name: repro-output-conformance-${{ matrix.asset }}
path: |
repro-out/
!repro-out/capture/
if-no-files-found: ignore
retention-days: 14
22 changes: 22 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2784,6 +2784,21 @@ table. Rules:
`flutter test --tags heavy test/integration_output_conformance_test.dart
--plain-name 'avi/convert-aac/delayed-avi/near-start'`. The shared
measuring helpers are `test/support/av_sync.dart`.
**Every subprocess the matrix runs is bounded (task #99)**:
`test/support/bounded_process.dart`'s `runBounded` kills it at its limit
and names it, the job's limit (`jobTimeout`) is below the case's
(`caseTimeout`), and a hang is sampled (`describeHang`: `sample` on
macOS, gdb on Linux) before its tree is killed; never `Process.run` there
(`conformance_timeouts_test.dart`). A failing case prints its job log
tail, packet and decoded counts and the job, and is kept under
`$VAPOURBOX_CONFORMANCE_KEEP` (the nightly uploads it as
`conformance-failures-<bundle>`); `VAPOURBOX_CONFORMANCE_REPEAT=N` runs
each case N times in one process, which
`.github/workflows/repro-output-conformance.yml` uses to loop a case on
the nightly's runners. The two `mp4+av1` failures of 2026-11-19/21 on
macOS x64 did not reproduce in 960 case runs, 1,800 encoder replays
and 9,600 decodes there (docs/reports/task-99-av1-conformance-flake);
never retry a case or list an intermittent one in `knownFailures`.

### Audio Restoration

Expand Down Expand Up @@ -3436,6 +3451,13 @@ cd worker && cargo run --release -- --config test_job.json
> (task #64). The worker now probes the format, but only the assertion makes
> a test fail if its depth stops reaching the pass.

> **A heavy test that runs a detector or several encodes states its
> timeout, sized by the slowest platform (macOS x64's 4-core runner).**
> package:test's default is 30 s; `--detect-native` on a small ProRes took
> 23-30 s there and failed 8 nightly legs (task #99, as task #95 did for
> Descale). Don't raise the default in `dart_test.yaml`: it would hide real
> hangs everywhere.

> **The heavy tests run the worker BINARY, not the library**, and
> `app/lib/**/*.g.dart` is gitignored — **run `cargo build` before the heavy
> suite** and `dart run build_runner build` before any Dart test, or you'll
Expand Down
Loading
Loading