Skip to content

refactor(recording): move video validation policy to recording ownership #2145

Description

@thymikee

Parent: #2129

Blocked by: #2144. Wave 2; the video validator consumes the final recording Swift-cache seam.

Scope — exact tracked files

Production:

  • src/utils/video.ts
  • src/utils/video-webm.ts

Tests:

  • src/utils/video.test.ts
  • src/utils/video-webm.test.ts

Destination and importer edits

Move to the existing recording owner:

  • src/recording/video.ts
  • src/recording/video-webm.ts
  • src/recording/video.test.ts
  • src/recording/video-webm.test.ts

Update exactly these production importers:

  • src/platform-runtime-screen-recording-android-host.ts
  • src/platform-runtime-screen-recording-finalizer-host.ts
  • src/recording/overlay.ts

Update the moved video.ts import of the #2144 Swift cache path. Do not move video validation into host-kit or platform packages; platform hosts consume this recording policy.

Behavior invariants

Preserve stable-file waiting, playable-file polling, MP4 atom checks, WebM EBML probe limits/document-type/segment/video-track/media checks, Swift AVFoundation validation, missing-validator typed unavailability behavior, timeout/retry budgets, and all recording finalizer/overlay outcomes. Preserve the exact accepted/rejected container decisions and filesystem cleanup behavior.

Do not change recording duration, frame rate, host process execution, Swift compilation, or platform discovery. This is an ownership move only.

Focused validation

Run:

  • pnpm vitest run src/recording/video.test.ts src/recording/video-webm.test.ts
  • pnpm vitest run src/recording/__tests__/overlay.test.ts
  • the existing screen-recording finalizer/Android host tests
  • pnpm check:affected --run

Planted-red proof

No new structural rule is added. Temporarily reject a known playable WebM fixture or bypass the stable-file wait and observe the independent moved test fail; restore the original behavior before the green run. Keep tests fixture-based and independent from implementation constants.

Dependency order

Start only after #2144. The terminal child is blocked by this child.

Shrink target

Delete both old production modules and both old tests. Preserve one recording implementation with no compatibility wrapper; after discounting the physical move, production LOC must not grow.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions