Skip to content

refactor(editor): extract smoke export progress sampler#550

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

refactor(editor): extract smoke export progress sampler#550
meiiie merged 1 commit into
mainfrom
refactor/editor-export-progress-sampling

Conversation

@meiiie
Copy link
Copy Markdown
Collaborator

@meiiie meiiie commented May 22, 2026

Description

Extracts the smoke-export progress sampling logic out of VideoEditor.tsx into a small smokeExportProgress module with focused unit coverage.

Motivation

handleExport is one of the remaining orchestration-heavy areas in VideoEditor.tsx. The smoke-export progress sampler is a low-risk extraction target because it is local, deterministic, and does not touch exporter construction, save/finalize behavior, native export, or rendering.

Type of Change

  • Bug fix
  • Refactor
  • Feature
  • Documentation

Changes Made

  • Added createSmokeExportProgressSampler for smoke export report sampling.
  • Added tests for disabled/no-start behavior, first sample, interval sampling, phase changes, and final-frame sampling.
  • Replaced the inline sampler state inside handleExport with the extracted module.

Scope

This PR intentionally does not refactor exporter config construction, save handling, native export, or runtime rendering paths.

Testing Guide

  1. Run the targeted Vitest tests.
  2. Run TypeScript typecheck.
  3. Run scoped Biome checks.
  4. Optionally run smoke export and confirm .report.json still includes progress samples.

Verification

  • npm test -- src/components/video-editor/smokeExportProgress.test.ts src/components/video-editor/smokeExportConfig.test.ts
  • npx tsc --noEmit --pretty false
  • npx biome check src/components/video-editor/smokeExportProgress.ts src/components/video-editor/smokeExportProgress.test.ts
  • npx biome lint src/components/video-editor/VideoEditor.tsx
  • git diff --check

Summary by CodeRabbit

  • Refactor

    • Improved video export progress tracking with refined sampling logic.
  • Tests

    • Added comprehensive test suite for export progress functionality.

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: ab2a2e2b-7264-4402-93a6-a8259a6e6e66

📥 Commits

Reviewing files that changed from the base of the PR and between 7b3eaaa and f4a68ca.

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

📝 Walkthrough

Walkthrough

Introduces a new smoke export progress sampling utility that conditionally records export state transitions and collects timestamped samples based on phase changes, elapsed time intervals, and completion. VideoEditor integrates the sampler to replace inline progress tracking during MP4 export. Tests validate all sampling conditions.

Changes

Smoke Export Progress Sampling

Layer / File(s) Summary
Smoke export progress sampler implementation
src/components/video-editor/smokeExportProgress.ts
SmokeExportProgressSample type and createSmokeExportProgressSampler factory record timestamped export state based on enabled flag, phase changes, configurable sampling interval, and completion state.
Sampler tests and progress helpers
src/components/video-editor/smokeExportProgress.test.ts
Test helper factory constructs ExportProgress objects with defaults. Test suite validates disabled mode, unknown start time, first-update defaults, same-phase skipping within interval, phase-change sampling, and final-frame inclusion.
VideoEditor integration
src/components/video-editor/VideoEditor.tsx
Imports sampler factory and instantiates it during MP4 export, replacing inline sampling state and callback with the sampler's record method and samples array.

Sequence Diagram

sequenceDiagram
  participant VideoEditor
  participant Sampler as Smoke Sampler
  participant Samples as Sample Array
  
  VideoEditor->>Sampler: createSmokeExportProgressSampler({enabled, startedAtMs})
  activate Sampler
  Sampler->>Samples: initialize empty array
  deactivate Sampler
  
  loop on each export progress update
    VideoEditor->>Sampler: record(exportProgress)
    activate Sampler
    alt sampling triggered
      note over Sampler: phase changed OR<br/>interval elapsed OR<br/>isLastFrame
      Sampler->>Samples: append timestamped sample
    end
    Sampler-->>VideoEditor: return { record, samples }
    deactivate Sampler
  end
  
  VideoEditor->>VideoEditor: use samples for telemetry
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

Checked

Poem

🐰 A sampler hops through export time,
Collecting progress, phase by phase,
Each interval marks a milestone fine,
While VideoEditor keeps steady pace,
Tests ensure no sample falls behind!

🚥 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 clearly and specifically describes the main refactoring: extracting smoke export progress sampler logic into a dedicated module.
Description check ✅ Passed The description covers all essential template sections: purpose, motivation, type of change, related changes, testing guide, and verification steps with specific commands.
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-export-progress-sampling

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 5924f92 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