Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

test(verify): legacy caption at the timeline end repro, FFmpeg full-tier export xfail, workflow log capture

Richie McIlroy62fd2da01480
diff --git a/.github/workflows/verify-captions-tmp.yml b/.github/workflows/verify-captions-tmp.yml
index 181ab630a..1cc3d7435 100644
--- a/.github/workflows/verify-captions-tmp.yml
+++ b/.github/workflows/verify-captions-tmp.yml
@@ -175,5 +175,9 @@ jobs:
elif [[ "$RUNNER_OS" == "Linux" ]]; then
export LD_LIBRARY_PATH="$GITHUB_WORKSPACE/target/native-deps/lib:$GITHUB_WORKSPACE/target/debug:$GITHUB_WORKSPACE/target/${{ matrix.target }}/debug${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
- cargo +1.95.0 test --manifest-path apps/desktop-gpui/Cargo.toml --locked --target ${{ matrix.target }} --bin cap-gpui transcription:: -- --nocapture 2>&1 | grep -E "^\[cap-verify\]|^ |^test |panicked|^error" | cut -c1-600 | head -200
- exit ${PIPESTATUS[0]}
+ set +e
+ cargo +1.95.0 test --manifest-path apps/desktop-gpui/Cargo.toml --locked --target ${{ matrix.target }} --bin cap-gpui transcription:: -- --nocapture > app-tests.log 2>&1
+ code=$?
+ grep -E "^\[cap-verify\]|^ [a-z0-9(]|^test |panicked|^error" app-tests.log | grep -v "Downloaded\|Compiling" | cut -c1-600
+ tail -5 app-tests.log
+ exit $code
diff --git a/crates/verify/expectations.toml b/crates/verify/expectations.toml
index 1afb08705..5b8314a71 100644
--- a/crates/verify/expectations.toml
+++ b/crates/verify/expectations.toml
@@ -194,3 +194,15 @@ case = "captions/app/segmentation/unicode"
class = "caption-segments"
reason = "NEW (minor): caption chunking decides that a boundary word is a weak one-letter word with String::len() (bytes), so a one-letter word outside ASCII such as the French preposition 'à' is not weak and a caption can end on it (apps/desktop-gpui/src/transcription.rs caption_boundary_word_is_weak). Repro: cargo test --manifest-path apps/desktop-gpui/Cargo.toml --bin cap-gpui segmentation_matches_reference_unicode -- --nocapture"
link = ""
+
+[[xfail]]
+case = "captions/legacy-migration/ends-at-timeline-end"
+class = "caption-migration"
+reason = "NEW (minor): loading a legacy (output-timed) project drops a caption that ends exactly at the timeline end: synchronize_captions maps each end through source_start + (end - start) / timescale, which rounds just below the timeline end after a clip transition (clips 41/15 s and 82/15 s, 0.2 s transition: 7.9999999 < 8.0), so the end does not map and the whole caption is discarded"
+link = ""
+
+[[xfail]]
+case = "editing/export/multi-segment/seed-7"
+class = "stale"
+reason = "FFmpeg decoder (full tier): after the timeline played clip 0 from 1.68 s to its end and then transitions back into clip 0 at 0 s, the 10 frames after the transition show source frame 0 instead of 20-29 (deterministic). Same mechanism as the seek/*/storm*/ffmpeg xfail: backward seeks near the start answer frame 0"
+link = ""
diff --git a/crates/verify/tests/captions.rs b/crates/verify/tests/captions.rs
index f9c2932c8..9c97cb9b1 100644
--- a/crates/verify/tests/captions.rs
+++ b/crates/verify/tests/captions.rs
@@ -616,7 +616,11 @@ fn migration_problems(
let mut config = edits::replay(base, ops);
set_captions(&mut config, captions.to_vec(), true);
cap_project::synchronize_captions(&mut config, durations);
- let shown = edits::timeline(&config).caption_segments.clone();
+ let mut shown = edits::timeline(&config).caption_segments.clone();
+ // Captions ending exactly at the timeline end are covered by
+ // `legacy_migration_caption_at_timeline_end`.
+ let end = TimeModel::new(&config).duration();
+ shown.retain(|t| (t.end - end).abs() > TIME_TOLERANCE);
let legacy = track_as_captions(&shown);
config
.timeline
@@ -693,6 +697,64 @@ fn migration_problems(
problems
}
+/// A legacy caption that ends exactly where the timeline ends (its last
+/// word ran to the end of the recording) must survive loading.
+#[test]
+fn legacy_migration_caption_at_timeline_end() {
+ let id = "captions/legacy-migration/ends-at-timeline-end";
+ if !report::selected(id) {
+ return;
+ }
+ let durations = [41.0 / 15.0, 82.0 / 15.0];
+ let mut config = edits::base_config(&durations);
+ common::add_transition(&mut config, 1, 0.2);
+ let end = edits::timeline(&config).duration() as f32;
+ let legacy = vec![CaptionSegment {
+ id: "last".into(),
+ start: end - 2.2,
+ end,
+ text: "until the end".into(),
+ words: vec![
+ CaptionWord {
+ text: "until".into(),
+ start: end - 2.2,
+ end: end - 1.5,
+ },
+ CaptionWord {
+ text: "the".into(),
+ start: end - 1.5,
+ end: end - 1.0,
+ },
+ CaptionWord {
+ text: "end".into(),
+ start: end - 1.0,
+ end,
+ },
+ ],
+ }];
+ let expected = model_migrate(&legacy, &config, &durations);
+ set_captions(&mut config, legacy, false);
+ cap_project::synchronize_captions(&mut config, &durations);
+ let mut case = Case::new(id);
+ let migrated = &config.captions.as_ref().expect("captions").segments;
+ if migrated.len() == expected.len() && expected.len() == 1 {
+ case.note(format!(
+ "caption ending at {end:.4}s kept at source {:.4}-{:.4}",
+ migrated[0].start, migrated[0].end
+ ));
+ } else {
+ case.problem(
+ "caption-migration",
+ format!(
+ "a legacy caption ending at the {end:.4}s timeline end: {} captions after loading, the model keeps {}",
+ migrated.len(),
+ expected.len()
+ ),
+ );
+ }
+ finish(case);
+}
+
#[test]
fn legacy_migration() {
let id = "captions/legacy-migration";