Refactor VideoRecorderSessionHandler.cs into partial class files#9618
Refactor VideoRecorderSessionHandler.cs into partial class files#9618Evangelink wants to merge 1 commit into
VideoRecorderSessionHandler.cs into partial class files#9618Conversation
Split the 656-line VideoRecorderSessionHandler.cs into focused partial files matching the FfmpegVideoRecorder pattern: - VideoRecorderSessionHandler.cs (wiring + lifecycle) - VideoRecorderSessionHandler.DataConsumer.cs - VideoRecorderSessionHandler.VideoProduction.cs - VideoRecorderSessionHandler.SegmentPruning.cs - VideoRecorderSessionHandler.Helpers.cs No logic changes; each file is under 300 lines. Fixes #9592 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
/backport to rel/4.3 |
|
Started backporting to rel/4.3: https://github.com/microsoft/testfx/actions/runs/28736336631 |
There was a problem hiding this comment.
Pull request overview
This PR is a pure file reorganization that splits the 656-line VideoRecorderSessionHandler.cs into five focused partial-class files, mirroring the existing FfmpegVideoRecorder split in the same directory. Because partial classes compile to the same type, there are no logic or API changes. It resolves issue #9592.
Changes:
- Split
VideoRecorderSessionHandlerinto per-concern partial files (data consumption, video production, segment pruning, helpers) while the primary file retains fields, constructor, interface properties, and session lifecycle. - Trimmed
usingdirectives per file and added thepartialkeyword; removed the now-unusedMicrosoft.Testing.Platformimport from the primary file. - No behavioral, public, or internal API changes.
Show a summary per file
| File | Description |
|---|---|
VideoRecorderSessionHandler.cs |
Reduced to fields, constructor, interface properties, and session lifecycle; declaration made partial; unused using removed. |
VideoRecorderSessionHandler.DataConsumer.cs |
New partial holding ConsumeAsync, ResolveTiming, IsTerminal, OutcomeText. |
VideoRecorderSessionHandler.VideoProduction.cs |
New partial holding video-production methods and EscapeMetadata. |
VideoRecorderSessionHandler.SegmentPruning.cs |
New partial holding TryPruneOldSegments, WarnBufferDropOnce, OverlapsAnyFailedWindow. |
VideoRecorderSessionHandler.Helpers.cs |
New partial holding file-name/artifact helpers, CLI overrides, and nested TestRecord. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Medium
There was a problem hiding this comment.
Note
🤖 Automated review by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
✅ 22/22 dimensions clean — no findings.
This is a well-executed pure file reorganization:
- Partial class split matches the existing
FfmpegVideoRecorder.{cs,ProcessManagement.cs,WindowCapture.cs}convention in the same directory. - No logic changes — code was relocated verbatim; the only functional edit is adding the
partialkeyword and trimming usings per file (e.g.,using Microsoft.Testing.Platform;moved toHelpers.cswhereRoslynStringis used). - Thread safety preserved —
_stateGatelocking pattern spans partial files correctly since they compile to the same type. - No API surface change — type remains
internal sealed partial. - Cross-TFM
#if NET9_0_OR_GREATERforLockstays in the main file with the field declarations. - File sizes all under 180 lines — well within the stated 300-line cap.
- Build glob picks up the new
.csfiles automatically — no.csprojedits needed.
Clean refactoring, no issues.
Overview
Splits the 656-line
VideoRecorderSessionHandler.csinto focused partial-class files, matching the pattern already used byFfmpegVideoRecorderin the same directory. This is a pure file reorganization — partial classes compile to the same type, so there are no logic or API changes.Fixes #9592
Changes
VideoRecorderSessionHandler.csOnTestSessionStarting/Finishing)VideoRecorderSessionHandler.DataConsumer.csConsumeAsync,ResolveTiming,IsTerminal,OutcomeTextVideoRecorderSessionHandler.VideoProduction.csProduceVideosAsync, per-test/session production, chapter metadata,EscapeMetadataVideoRecorderSessionHandler.SegmentPruning.csTryPruneOldSegments,WarnBufferDropOnce,OverlapsAnyFailedWindowVideoRecorderSessionHandler.Helpers.csBuildFileName,Sanitize,PublishArtifactAsync,DeleteDirectoryQuietly,ApplyCommandLineOverrides, nestedTestRecordVerification
netstandard2.0,net8.0, andnet9.0with 0 warnings, 0 errors (including IDE0005 unused-using checks — usings were trimmed per file).internal sealed partial— no public/internal API surface change.Acceptance Criteria
FfmpegVideoRecorder)TypeName.Concern.csconvention