技能圖譜SKILLSGROVE
技能圖譜/影片製作/AIEraDev/Clypra/clypra-media-regression-testing

clypra-media-regression-testing

安裝

$npx skills add https://github.com/AIEraDev/Clypra --skill clypra-media-regression-testing
$git clone --depth 1 https://github.com/AIEraDev/Clypra.git /tmp/Clypra && mkdir -p ~/.claude/skills && cp -r /tmp/Clypra/.kiro/skills/clypra-media-regression-testing ~/.claude/skills/clypra-media-regression-testing
請幫我安裝這個 Agent Skill:https://github.com/AIEraDev/Clypra/tree/4c204bb27fc3717e4a88801c4d3743a75498ba0b/.kiro/skills/clypra-media-regression-testing ,先閱讀它的 SKILL.md 和指令碼,確認安全後再安裝到我的技能目錄。

簡介

原文描述 · MITGuides 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.
以下 SKILL.md 內容轉載自 AIEraDev/Clypra(提交 4c204bb),依據 MIT 許可證轉載正文(文字未改動;僅省略檔案頭後設資料、將圖片顯示為連結,超長內容會截斷);版權歸 2026 Clypra Contributors 所有。許可證:LICENSE。僅展示說明檔案,附帶指令碼請在原倉庫檢視。

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.

[!IMPORTANT] Single-Task Platform Discipline — Regression test suite design follows the same phased protocol as all engineering work:

  1. Discuss the failing scenario and the proposed test strategy (trade-offs only, no code yet).
  2. Agree on the test scope, fixture strategy, and acceptance criteria.
  3. Produce an atomic task list of test cases to add.
  4. Author and execute one test case at a time, confirming each passes (or fails as a negative control) before proceeding.

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

# 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
檢視許可證全文(MIT)
MIT License

Copyright (c) 2026 Clypra Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.