Skip to content

refactor(editor): extract MP4 export routing#564

Merged
meiiie merged 1 commit into
mainfrom
refactor/editor-mp4-export-routing
May 22, 2026
Merged

refactor(editor): extract MP4 export routing#564
meiiie merged 1 commit into
mainfrom
refactor/editor-mp4-export-routing

Conversation

@meiiie
Copy link
Copy Markdown
Collaborator

@meiiie meiiie commented May 22, 2026

Description

Extract the MP4 export route decision from VideoEditor.tsx into a small pure resolveMp4ExportRouting module.

Motivation

VideoEditor.tsx still owns too much export orchestration inline. This slice moves the MP4 pipeline/backend/NVIDIA gate decision into a named domain helper so the editor component can assemble export config without embedding routing policy details.

Type of Change

  • Refactor
  • Tests

Related Issue(s)

Changes Made

  • Added src/components/video-editor/mp4ExportRouting.ts with a pure resolveMp4ExportRouting helper.
  • Added focused tests covering normal modern exports, legacy exports, smoke export native on/off behavior, and NVIDIA CUDA gating.
  • Replaced the inline MP4 routing block in VideoEditor.tsx with the helper result.

Scope Note

  • No UI changes.
  • No exporter implementation changes.
  • No native helper, preload, IPC, packaging, or Linux NVIDIA behavior changes.
  • No Zustand/Redux/global store added.
  • This only names and tests an existing decision boundary.

Testing Guide

  1. Export MP4 with the default Lightning pipeline and confirm behavior is unchanged.
  2. Export MP4 with Legacy selected and confirm WebCodecs path remains selected.
  3. For smoke export URLs, verify smokeUseNativeExport=1 still chooses the native-capable smoke route while omitted/false stays WebCodecs.
  4. On Windows NVIDIA test hardware, feat(export): add NVIDIA opt-in detection #562's CUDA switch behavior should remain unchanged.

Checklist

  • One small architectural slice only
  • Behavior-preserving extraction
  • Focused tests for moved routing decisions
  • No generated binaries or local probes included
  • Ready for review

Local Checks

  • npm test -- src/components/video-editor/mp4ExportRouting.test.ts
  • npm test -- src/components/video-editor/useNvidiaCudaExportOptIn.test.ts src/lib/exporter/modernVideoExporter.nativeStaticLayout.test.ts
  • npm test -- electron/ipc/export/native-video.test.ts
  • npx tsc --noEmit --pretty false
  • npx biome check --formatter-enabled=false src/components/video-editor/VideoEditor.tsx src/components/video-editor/mp4ExportRouting.ts src/components/video-editor/mp4ExportRouting.test.ts
  • git diff --check

Runtime/Repro Evidence

Not run. This is a pure renderer-side routing-policy extraction with no native/preload/IPC contract change.

Summary by CodeRabbit

  • Refactor

    • Reorganized MP4 export configuration logic to centralize the determination of pipeline models, experimental native export toggles, NVIDIA CUDA export capabilities, and backend preferences across all export operations.
  • Tests

    • Added comprehensive test suite for MP4 export routing with detailed coverage of default behavior, legacy pipeline fallbacks, smoke export modes, and NVIDIA CUDA feature scenarios.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 407f28c6-c506-4c59-a7fb-d2d5c93c8323

📥 Commits

Reviewing files that changed from the base of the PR and between b7449d5 and 87cd251.

📒 Files selected for processing (3)
  • src/components/video-editor/VideoEditor.tsx
  • src/components/video-editor/mp4ExportRouting.test.ts
  • src/components/video-editor/mp4ExportRouting.ts

📝 Walkthrough

Walkthrough

This PR extracts MP4 export routing logic into a dedicated module. A new Mp4ExportRouting type and resolveMp4ExportRouting function centralize decisions about pipeline model, native export availability, NVIDIA CUDA capability, and backend preference. VideoEditor now imports and calls this function instead of deriving these values inline from smoke export configuration, settings, and export defaults.

Changes

MP4 Export Routing Centralization

Layer / File(s) Summary
MP4 Export Routing Contract and Logic
src/components/video-editor/mp4ExportRouting.ts, src/components/video-editor/mp4ExportRouting.test.ts
Mp4ExportRouting type standardizes resolved routing fields (pipeline model, experimental toggles, backend preference). resolveMp4ExportRouting computes these from smoke export configuration, settings, and CUDA availability, tested across default, legacy pipeline, smoke native override, and CUDA enablement scenarios.
VideoEditor Integration
src/components/video-editor/VideoEditor.tsx
Imports resolveMp4ExportRouting and replaces inline routing derivation with a function call, passing smoke export config and settings, then destructuring returned routing values for MP4 exporter configuration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • webadderallorg/Recordly#563: Provides the experimentalNvidiaCudaExport flag via useNvidiaCudaExportOptIn hook that feeds into resolveMp4ExportRouting.
  • webadderallorg/Recordly#543: Extracts smoke-export configuration parsing that supplies the smokeExportConfig input parameter to the routing resolver.
  • webadderallorg/Recordly#562: Adds NVIDIA CUDA capability probing and user opt-in that determine whether useExperimentalNvidiaCudaExport is enabled in the resolver.

Suggested labels

Checked, refactor

🐰 A routing rabbit hops in,
Consolidating all the exports clean,
Pipeline, backend, CUDA flags spin,
Smoke and modern dance on screen! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: extracting MP4 export routing logic into a dedicated module.
Description check ✅ Passed The description is comprehensive and includes all required template sections: clear purpose, motivation, type of change, related issues, testing guide, and checklist.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/editor-mp4-export-routing

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@meiiie meiiie merged commit 1db58dc into main May 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant