clypra-media-regression-testing
AIEraDev/Clypra/.agents/skills/clypra-media-regression-testing/SKILL.md
Guides AI agents through authoring, running, and diagnosing media, audio, timeline, and rendering regression tests in Clypra. Activate when changing media probing, audio-video synchronization, timeline gap/placement engines, EvaluatedScene generation, export pipeline, or native hardware surface interactions.
Skill3.3k starsChanged 7 days ago
What's in it
- Clypra Media & Audio Regression Testing Workflow
- Overview
- When to Use This Skill
- When NOT to Use This Skill
- Testing Priorities & Scenarios
- 1. Audio Synchronization & Hydration Testing
- 2. Timeline Geometry & Invariants
- 3. Rendering & EvaluatedScene
- 4. Export & Native Process Management
- Fixture & Determinism Strategy
- Execution Commands
--- name: clypra-media-regression-testing description: >- Guides AI agents through authoring, running, and diagnosing media, audio, timeline, and rendering regression tests in Clypra. Activate when changing media probing, audio-video synchronization, timeline gap/placement engines, EvaluatedScene generation, export pipeline, or native hardware surface interactions. --- # Clypra Media & Audio Regression Testing Workflow ## Overview This skill provides specific testing methodologies for Clypra's media, audio, timeline, and rendering subsystems. Clypra coordinates between a TypeScript/React frontend and a Rust/wgpu/CPAL backend. Testing must prevent regressions across timeline mathematics, audio synchronization, clip boundaries, decoder readiness, and export encoding. --- ## When to Use This Skill - Adding regression tests for timeline clip placement, snapping, trimming, or splitting. - Verifying audio behavior for embedded video audio, detached audio, and standalone music tracks. - Testing media probing, hydration timing, and missing/corrupted file fallbacks. - Testing export pipeline logic, frame batching, and resolution calculations. - Verifying PlaybackClock state transitions and AV drift prevention. ## When NOT to Use This Skill - Simple UI styling or component layout tweaks unrelated to media playback. - Pure documentation updates. --- ## Testing Priorities & Scenarios ### 1. Audio Synchronization & Hydration Testing Ensure both Web Audio and native CPAL audio paths are validated: - **Video with Embedded Audio**: Must resolve audio stream and populate active audio clips once probed. - **Silent Video (No Audio Track)**: Must not block playback clock; `markNativeAudioUnavailable()` must allow video playback to proceed without stalling for audio clock positions. - **Standalone Audio Tracks**: Must start, seek, and loop accurately alongside video tracks. - **Hydration Race Conditions**: Test behavior when playback begins while `asset.path === ""` or `asset.streams === undefined`. Verify that clips are safely queued and synchronized once probe completes without freezing the UI or resetting playback time to 0. ### 2. Timeline Geometry & Invariants Test pure timeline models without instantiating UI: - **Clip Boundaries**: Verify `startTime`, `duration`, `sourceOffset` math across trims, slips, slides, and splits. - **Gap Engine**: Test `detectGaps()`, `insertGapWithRipple()`, `removeGapWithRipple()`, and `packTrack()`. Ensure no negative clip durations or overlapping collisions on non-overlapping tracks. - **SMPTE Timecode & Rational Time**: Test frame-accurate timecode conversions at 23.976, 24, 25, 29.97, 30, 59.94, and 60 fps. ### 3. Rendering & EvaluatedScene - Test that `evaluateTimelineSceneCached(time)` produces the exact expected `EvaluatedScene`: - Active video/audio clips at time $T$. - Transform matrices, opacity, blend modes, and active keyframes. - Video transitions bridging incoming and outgoing clips. - Verify scene immutability: tests must confirm that rendering does not alter store state. ### 4. Export & Native Process Management - **Preflight Checks**: Verify `exportPreflight()` detects missing assets, zero-byte files, and invalid dimensions before launching FFmpeg. - **Batching & Cancellation**: Verify that cancelling an export halts frame production, cleans up temporary directories, and does not deadlock. - **Process Cleanup**: Ensure failed FFmpeg subprocesses terminate and release file locks. --- ## Fixture & Determinism Strategy - **Synthetic Test Fixtures**: Prefer creating small, deterministic in-memory fixtures or minimal video/audio files generated via FFmpeg scripts (`scripts/generate-bench-fixtures.sh`). - **Never Check In Large Media Files**: Keep repository size small and free from licensing conflicts. - **Validate Properties, Not Binary Hashes**: Media encoding outputs can vary slightly across OS versions and FFmpeg builds. Assert stream metadata (duration, resolution, audio channels, codec, keyframe intervals) rather than brittle SHA256 checksums of encoded containers. --- ## Execution Commands ```bash # Run timeline mathematical unit tests npx vitest run src/lib/timeline/__tests__/ npx vitest run src/core/timeline/__tests__/ # Run audio synchronization unit tests npx vitest run src/core/audio/__tests__/ npx vitest run src/core/media/__tests__/ # Run export pipeline tests npx vitest run src/lib/export/__tests__/ # Run full render loop and playback clock regression suite npx vitest run src/components/editor/preview/__tests__/ProgramPreview.renderLoop.test.ts ```
More agent context in AIEraDev/Clypra
19 other files this repository gives its agents.
AGENTS.md
Cursor rule
Skill
- architecture-design-review.agents/skills/architecture-design-review/SKILL.md
- behavior-coverage.agents/skills/behavior-coverage/SKILL.md
- bugfix-regression.agents/skills/bugfix-regression/SKILL.md
- clypra-bug-hunter.agents/skills/clypra-bug-hunter/SKILL.md
- clypra-dev.agents/skills/clypra-dev/SKILL.md
- clypra-performance-log-analysis.agents/skills/clypra-performance-log-analysis/SKILL.md
- clypra-preview-performance-engineering.agents/skills/clypra-preview-performance-engineering/SKILL.md
- clypra-ui-ux-engineering.agents/skills/clypra-ui-ux-engineering/SKILL.md
- code-review.agents/skills/code-review/SKILL.md
- feature-implementation.agents/skills/feature-implementation/SKILL.md
- i18n-localization-engineering.agents/skills/i18n-localization-engineering/SKILL.md
- nle-domain-engineering.agents/skills/nle-domain-engineering/SKILL.md
- performance-reliability-engineering.agents/skills/performance-reliability-engineering/SKILL.md
- release-readiness.agents/skills/release-readiness/SKILL.md
- senior-engineer-decision-making.agents/skills/senior-engineer-decision-making/SKILL.md
- tauri-cross-platform-engineering.agents/skills/tauri-cross-platform-engineering/SKILL.md
- tauri-native-thread-safety.agents/skills/tauri-native-thread-safety/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
Reports can't be read right now.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

