Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(ci): fmt + windows integration test

Louis Beaumontd394573fe5e1
diff --git a/.github/workflows/windows-integration-test.yml b/.github/workflows/windows-integration-test.yml
index dcd71baa8..a8cd94261 100644
--- a/.github/workflows/windows-integration-test.yml
+++ b/.github/workflows/windows-integration-test.yml
@@ -87,7 +87,9 @@ jobs:
[console]::beep(2000,1000)
Start-Sleep -Seconds 30 # Allow more time for processing
- Stop-Process -Id $process.Id -Force
+ if ($process -and -not $process.HasExited) {
+ Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
+ }
- name: Check for crashes and captured data
shell: pwsh
diff --git a/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx
index 9aec6da33..97d942cd6 100644
--- a/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/current-frame-timeline.tsx
@@ -3,6 +3,7 @@ import React, { FC, useState, useRef, useEffect, useCallback } from "react";
import { useFrameOcrData } from "@/lib/hooks/use-frame-ocr-data";
import { TextOverlay } from "@/components/text-overlay";
import { ImageOff, ChevronLeft, ChevronRight, Loader2 } from "lucide-react";
+import posthog from "posthog-js";
interface CurrentFrameTimelineProps {
currentFrame: StreamTimeSeriesResponse;
@@ -10,6 +11,7 @@ interface CurrentFrameTimelineProps {
canNavigatePrev?: boolean;
canNavigateNext?: boolean;
onFrameUnavailable?: () => void;
+ onFrameLoadError?: () => void;
}
export const SkeletonLoader: FC = () => {
@@ -36,6 +38,7 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({
canNavigatePrev = true,
canNavigateNext = true,
onFrameUnavailable,
+ onFrameLoadError,
}) => {
const [isLoading, setIsLoading] = useState(true);
const [hasError, setHasError] = useState(false);
@@ -63,9 +66,25 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({
// Debounce timer ref
const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
+
+ // Performance tracking refs
+ const frameLoadStartTimeRef = useRef<number | null>(null);
+ const framesSkippedRef = useRef<number>(0);
+ const lastFrameIdRef = useRef<string | null>(null);
const frameId = currentFrame?.devices?.[0]?.frame_id;
+ // Track frames skipped during fast scrolling (for analytics)
+ useEffect(() => {
+ if (frameId && lastFrameIdRef.current && frameId !== lastFrameIdRef.current) {
+ // If we're changing frames and there was a previous frame that didn't finish loading
+ if (frameLoadStartTimeRef.current !== null && debouncedFrameId !== frameId) {
+ framesSkippedRef.current += 1;
+ }
+ }
+ lastFrameIdRef.current = frameId;
+ }, [frameId, debouncedFrameId]);
+
// Debounce frame ID changes to avoid loading frames during fast scrolling
// This is critical for performance - without debouncing, every scroll step
// triggers a new HTTP request that won't be used
@@ -116,6 +135,9 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({
return;
}
+ // Start timing the frame load
+ frameLoadStartTimeRef.current = performance.now();
+
// Create new abort controller for this request
abortControllerRef.current = new AbortController();
@@ -152,6 +174,21 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({
if (!controller.signal.aborted) {
setIsLoading(false);
setHasError(true);
+ onFrameLoadError?.();
+
+ // Track frame load failure
+ if (frameLoadStartTimeRef.current !== null) {
+ const loadTime = performance.now() - frameLoadStartTimeRef.current;
+ posthog.capture("timeline_frame_load_time", {
+ duration_ms: Math.round(loadTime),
+ frame_id: debouncedFrameId,
+ success: false,
+ error: err.message,
+ frames_skipped: framesSkippedRef.current,
+ });
+ frameLoadStartTimeRef.current = null;
+ framesSkippedRef.current = 0;
+ }
}
}
});
@@ -294,6 +331,21 @@ export const CurrentFrameTimeline: FC<CurrentFrameTimelineProps> = ({
width: img.naturalWidth,
height: img.naturalHeight,
});
+
+ // Track successful frame load time
+ if (frameLoadStartTimeRef.current !== null) {
+ const loadTime = performance.now() - frameLoadStartTimeRef.current;
+ posthog.capture("timeline_frame_load_time", {
+ duration_ms: Math.round(loadTime),
+ frame_id: debouncedFrameId,
+ success: true,
+ frames_skipped: framesSkippedRef.current,
+ image_width: img.naturalWidth,
+ image_height: img.naturalHeight,
+ });
+ frameLoadStartTimeRef.current = null;
+ framesSkippedRef.current = 0;
+ }
}}
onError={() => {
console.log('Image failed to load for frame:', debouncedFrameId);
diff --git a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
index 9d22432cc..b902eb296 100644
--- a/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
+++ b/apps/screenpipe-app-tauri/components/rewind/timeline.tsx
@@ -73,6 +73,15 @@ export default function Timeline() {
start: new Date(new Date().setFullYear(new Date().getFullYear() - 1)),
end: new Date(),
});
+
+ // Performance tracking refs
+ const timelineOpenedAtRef = useRef<number>(performance.now());
+ const firstFrameDisplayedRef = useRef<boolean>(false);
+ const totalLoadingTimeRef = useRef<number>(0);
+ const loadingStartTimeRef = useRef<number | null>(null);
+ const framesViewedRef = useRef<number>(0);
+ const framesFailedRef = useRef<number>(0);
+ const dateChangesRef = useRef<number>(0);
const { currentFrame, setCurrentFrame } = useCurrentFrame((index) => {
setCurrentIndex(index);
@@ -283,10 +292,69 @@ export default function Timeline() {
}
}, [frames.length, currentFrame, setCurrentFrame]);
- // Track timeline opened
+ // Track timeline opened and setup session tracking
useEffect(() => {
+ timelineOpenedAtRef.current = performance.now();
+ firstFrameDisplayedRef.current = false;
+ totalLoadingTimeRef.current = 0;
+ framesViewedRef.current = 0;
+ framesFailedRef.current = 0;
+ dateChangesRef.current = 0;
+
posthog.capture("timeline_opened");
+
+ // Send session summary when timeline closes
+ return () => {
+ const sessionDuration = performance.now() - timelineOpenedAtRef.current;
+ const loadingPercentage = sessionDuration > 0
+ ? (totalLoadingTimeRef.current / sessionDuration) * 100
+ : 0;
+
+ posthog.capture("timeline_loading_time_total", {
+ session_duration_ms: Math.round(sessionDuration),
+ loading_time_ms: Math.round(totalLoadingTimeRef.current),
+ loading_percentage: Math.round(loadingPercentage * 10) / 10,
+ frames_viewed: framesViewedRef.current,
+ frames_failed: framesFailedRef.current,
+ date_changes: dateChangesRef.current,
+ });
+ };
}, []);
+
+ // Track loading state changes for cumulative loading time
+ useEffect(() => {
+ if (isLoading || showBlockingLoader) {
+ // Started loading
+ if (loadingStartTimeRef.current === null) {
+ loadingStartTimeRef.current = performance.now();
+ }
+ } else {
+ // Stopped loading
+ if (loadingStartTimeRef.current !== null) {
+ totalLoadingTimeRef.current += performance.now() - loadingStartTimeRef.current;
+ loadingStartTimeRef.current = null;
+ }
+ }
+ }, [isLoading, showBlockingLoader]);
+
+ // Track time to first frame
+ useEffect(() => {
+ if (currentFrame && !firstFrameDisplayedRef.current) {
+ firstFrameDisplayedRef.current = true;
+ const timeToFirstFrame = performance.now() - timelineOpenedAtRef.current;
+
+ posthog.capture("timeline_time_to_first_frame", {
+ duration_ms: Math.round(timeToFirstFrame),
+ had_cache: frames.length > 1, // If we have multiple frames, likely from cache
+ frames_count: frames.length,
+ });
+ }
+
+ // Track frames viewed
+ if (currentFrame) {
+ framesViewedRef.current += 1;
+ }
+ }, [currentFrame, frames.length]);
// Listen for open-search event from Rust (Cmd+K global shortcut)
useEffect(() => {
@@ -658,6 +726,7 @@ export default function Timeline() {
}
// Track date change
+ dateChangesRef.current += 1;
posthog.capture("timeline_date_changed", {
from_date: currentDate.toISOString(),
to_date: newDate.toISOString(),
@@ -786,6 +855,9 @@ export default function Timeline() {
}}
canNavigatePrev={currentIndex > 0}
canNavigateNext={currentIndex < frames.length - 1}
+ onFrameLoadError={() => {
+ framesFailedRef.current += 1;
+ }}
onFrameUnavailable={async () => {
// Get the current frame's frame_id
const failedFrameId = frames[currentIndex]?.devices?.[0]?.frame_id;
diff --git a/crates/screenpipe-accessibility/src/platform/macos.rs b/crates/screenpipe-accessibility/src/platform/macos.rs
index 495b4cb4e..ee0b10795 100644
--- a/crates/screenpipe-accessibility/src/platform/macos.rs
+++ b/crates/screenpipe-accessibility/src/platform/macos.rs
@@ -791,7 +791,7 @@ fn get_element_at_position(x: f64, y: f64, config: &UiCaptureConfig) -> Option<E
if y < 30.0 {
return None;
}
-
+
let sys = ax::UiElement::sys_wide();
let elem = sys.element_at_pos(x as f32, y as f32).ok()?;
diff --git a/crates/screenpipe-audio/build.rs b/crates/screenpipe-audio/build.rs
index 30cd05803..2f3519de2 100644
--- a/crates/screenpipe-audio/build.rs
+++ b/crates/screenpipe-audio/build.rs
@@ -110,7 +110,8 @@ fn install_onnxruntime() {
if !status.success() {
panic!("failed to install onnx binary");
}
- let target_dir = Path::new("../../apps/screenpipe-app-tauri/src-tauri/onnxruntime-win-x64-gpu-1.19.2");
+ let target_dir =
+ Path::new("../../apps/screenpipe-app-tauri/src-tauri/onnxruntime-win-x64-gpu-1.19.2");
if target_dir.exists() {
fs::remove_dir_all(target_dir).expect("failed to remove existing directory");
}
diff --git a/crates/screenpipe-server/src/video_utils.rs b/crates/screenpipe-server/src/video_utils.rs
index d34651b0f..df4ded23f 100644
--- a/crates/screenpipe-server/src/video_utils.rs
+++ b/crates/screenpipe-server/src/video_utils.rs
@@ -387,12 +387,18 @@ async fn get_video_fps_and_duration(ffmpeg_path: &PathBuf, video_path: &str) ->
{
let cache = VIDEO_METADATA_CACHE.read().await;
if let Some(&(fps, duration)) = cache.get(video_path) {
- debug!("Video metadata cache HIT for {}: fps={}, duration={}", video_path, fps, duration);
+ debug!(
+ "Video metadata cache HIT for {}: fps={}, duration={}",
+ video_path, fps, duration
+ );
return Ok((fps, duration));
}
}
- debug!("Video metadata cache MISS for {}, calling ffprobe", video_path);
+ debug!(
+ "Video metadata cache MISS for {}, calling ffprobe",
+ video_path
+ );
// Cache miss - call ffprobe
let (fps, duration) = get_video_fps_and_duration_uncached(ffmpeg_path, video_path).await?;
@@ -417,7 +423,10 @@ async fn get_video_fps_and_duration(ffmpeg_path: &PathBuf, video_path: &str) ->
}
/// Internal function that actually calls ffprobe - used by the cached wrapper.
-async fn get_video_fps_and_duration_uncached(ffmpeg_path: &PathBuf, video_path: &str) -> Result<(f64, f64)> {
+async fn get_video_fps_and_duration_uncached(
+ ffmpeg_path: &PathBuf,
+ video_path: &str,
+) -> Result<(f64, f64)> {
let ffprobe_path = get_ffprobe_path(ffmpeg_path);
let mut cmd = Command::new(&ffprobe_path);