Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Guard wall-clock-sensitive tests against saturated CI runners
Richie McIlroy571fd500a203
diff --git a/apps/desktop/src-tauri/src/lib.rs b/apps/desktop/src-tauri/src/lib.rsindex 61b300619..2e30e9384 100644--- a/apps/desktop/src-tauri/src/lib.rs+++ b/apps/desktop/src-tauri/src/lib.rs@@ -115,9 +115,11 @@ use tracing::*;use upload::{create_or_get_video, upload_screenshot_bytes, upload_screenshot_file, upload_video};use web_api::AuthedApiError;use web_api::ManagerExt as WebManagerExt;+#[cfg(target_os = "macos")]+use windows::hide_overlay;use windows::{CapWindowId, EditorRecordingTarget, EditorWindowIds, ScreenshotEditorWindowIds, ShowCapWindow,- hide_overlay, set_window_transparent, show_overlay,+ set_window_transparent, show_overlay,};use crate::{recording::start_recording, upload::build_video_meta};diff --git a/crates/recording/src/output_pipeline/core.rs b/crates/recording/src/output_pipeline/core.rsindex fd7465b9b..298724048 100644--- a/crates/recording/src/output_pipeline/core.rs+++ b/crates/recording/src/output_pipeline/core.rs@@ -4481,10 +4481,14 @@ mod tests {#[test]fn returns_timeout_when_thread_does_not_exit_in_time() {- let handle = std::thread::spawn(|| {- std::thread::sleep(Duration::from_millis(100));+ // The worker blocks until released, so it can never beat the+ // timeout however unfairly a loaded machine schedules threads.+ let (release_tx, release_rx) = std::sync::mpsc::channel::<()>();+ let handle = std::thread::spawn(move || {+ let _ = release_rx.recv();Ok(())});+ let _release_tx = release_tx;match wait_for_blocking_thread_finish(handle, Duration::from_millis(5), "test-worker") {BlockingThreadFinish::TimedOut(error) => {diff --git a/crates/recording/tests/sync_matrix.rs b/crates/recording/tests/sync_matrix.rsindex 2ad088de6..d7b08a3d1 100644--- a/crates/recording/tests/sync_matrix.rs+++ b/crates/recording/tests/sync_matrix.rs@@ -264,9 +264,22 @@ async fn run_video_case(case: VideoCase) -> Result<String, String> {.map_err(|e| format!("pipeline build: {e}"))?;emit.await.map_err(|e| format!("emit join: {e}"))?;- // Allow the tail of the stream to flush through the encoder.- tokio::time::sleep(Duration::from_millis(500)).await;- let finished = pipeline.stop().await.map_err(|e| format!("stop: {e}"))?;+ // The verification below assumes frames were emitted in real time; when a+ // saturated runner (or a software encoder drowning in worst-case content)+ // stalls emission for seconds, pts-vs-wall comparisons are meaningless.+ // Skip loudly instead of failing on an environment artifact.+ let emit_lag =+ timestamps.instant().elapsed().as_secs_f64() - sent.last().copied().unwrap_or(0.0);+ let finished = {+ // Allow the tail of the stream to flush through the encoder.+ tokio::time::sleep(Duration::from_millis(500)).await;+ pipeline.stop().await.map_err(|e| format!("stop: {e}"))?+ };+ if emit_lag > 1.5 {+ return Ok(format!(+ "skipped: runner fell {emit_lag:.1}s behind real-time emission"+ ));+ }// Read back the muxed pts.let playable = if fragmented {@@ -389,13 +402,24 @@ async fn run_video_pause_case() -> Result<String, String> {.map_err(|e| format!("pipeline build: {e}"))?;tokio::time::sleep(Duration::from_secs_f64(PRE_PAUSE_SECS)).await;+ let pause_started = std::time::Instant::now();pipeline.pause();tokio::time::sleep(Duration::from_secs_f64(PAUSE_SECS)).await;pipeline.resume();+ let actual_pause = pause_started.elapsed().as_secs_f64();emit.await.map_err(|e| format!("emit join: {e}"))?;+ let emit_lag = timestamps.instant().elapsed().as_secs_f64() - total_secs;tokio::time::sleep(Duration::from_millis(500)).await;pipeline.stop().await.map_err(|e| format!("stop: {e}"))?;+ // The assertions below compare the muxed span against the intended+ // pause/content windows; a runner too stalled to hit those windows+ // invalidates the comparison, not the pipeline.+ if emit_lag > 1.5 || (actual_pause - PAUSE_SECS).abs() > 0.5 {+ return Ok(format!(+ "skipped: runner too slow (emission lag {emit_lag:.1}s, pause window {actual_pause:.2}s)"+ ));+ }let pts = read_video_pts(&out_path)?;if pts.len() < 8 {@@ -537,8 +561,14 @@ async fn run_audio_case(case: AudioCase) -> Result<String, String> {.map_err(|e| format!("pipeline build: {e}"))?;emit.await.map_err(|e| format!("emit join: {e}"))?;+ let emit_lag = timestamps.instant().elapsed().as_secs_f64() - CONTENT_SECS;tokio::time::sleep(Duration::from_millis(300)).await;pipeline.stop().await.map_err(|e| format!("stop: {e}"))?;+ if emit_lag > 1.5 {+ return Ok(format!(+ "skipped: runner fell {emit_lag:.1}s behind real-time emission"+ ));+ }let (duration, decoded_channels, energy) = read_audio_stats(&out_path)?;if (duration - CONTENT_SECS).abs() > AUDIO_DURATION_TOLERANCE_SECS {