[file-diet] Refactor AzureDevOpsSummaryReporter.Lifecycle.cs (537 lines) into focused files

オープン
#12,232 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
csharp
領域
backend

調査の方向性

Read AzureDevOpsSummaryReporter.Lifecycle.cs and the behavior-preserving-refactor skill at .github/skills/behavior-preserving-refactor/SKILL.md; inspect the existing AzureDevOpsSummaryReporter.*.cs partials and relevant tests. Move coherent method groups unchanged into focused partial files, checking project includes and consumers. Run focused builds and tests for affected consumers and compare behavior, including duplicate and malformed inputs; finish with each new file under 300 lines or report the remaining size and blocker.

索引モデルが issue の本文から書いたものです。

説明

type/automation type/tech-debt
Overview

The file src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsSummaryReporter.Lifecycle.cs has grown to 537 lines, making it harder to navigate and maintain. This task involves refactoring it into smaller, more focused files.

Current State
  • File: src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsSummaryReporter.Lifecycle.cs
  • Size: 537 lines
  • Language: C#
Structural Analysis

The file is a partial-class slice of internal sealed partial class AzureDevOpsSummaryReporter. From a bounded sample it contains:

  • OnTestSessionStartingAsync (~line 19): resets state and emits the "requires TF_BUILD" warning.
  • ConsumeAsync (~line 62): consumes TestNodeUpdateMessage, collects timing/dependency metadata, and records rows.
  • OnTestSessionFinishingAsync (~line 179): finalization and summary emission (~190 lines).
  • ClearFlakyRows (~line 366) and trailing helpers for flaky-row/record handling.

Other AzureDevOpsSummaryReporter.*.cs partials (Markdown.*) already exist; this file is the largest remaining slice.

Refactoring Strategy
Proposed File Splits

Based on the bounded structural sample, investigate these provisional splits. Confirm their safety during implementation preflight before moving code:

  1. AzureDevOpsSummaryReporter.Lifecycle.cs (kept)

    • Contents: OnTestSessionStartingAsync, OnTestSessionFinishingAsync
    • Responsibility: session start/finish lifecycle
  2. AzureDevOpsSummaryReporter.Consume.cs

    • Contents: ConsumeAsync and its local helpers (timing/dependency collection)
    • Responsibility: ingesting test node updates into rows
  3. AzureDevOpsSummaryReporter.FlakyRows.cs (if needed)

    • Contents: ClearFlakyRows and related flaky/record bookkeeping helpers
    • Responsibility: flaky-row tracking and cleanup
Implementation Guidelines
  1. Establish Equivalence: Follow .github/skills/behavior-preserving-refactor/SKILL.md. Before editing, read the complete affected bodies, inventory baseline behavior and relevant tests, and identify distinguishing cases.
  2. Preserve Selection and Evaluation: Keep iteration order, short-circuit evaluation, exact type selection, first/last-match semantics, defaults, exceptions, and side effects. Cover reachable duplicate and malformed inputs; similar-looking helpers are not automatically interchangeable.
  3. Trace All Consumers: Check partial declarations, source-linked consumers, owning/consuming project includes, target-framework guards, and tracked public/internal API surfaces. Keep names, accessibility, attributes, and native interop contracts unchanged.
  4. Move Before Modernizing: Move bodies unchanged first, one coherent responsibility at a time. Preserve allocation and performance behavior on hot paths; do not mix adjacent modernization or bug fixes into the split.
  5. Use Focused Checks: Run the smallest affected project/TFM builds and relevant tests before and after each coherent split. Add distinguishing equivalence cases where coverage is missing; a pure file move does not require the full solution. Report exact checks and outcomes, including unavailable checks.
  6. Surface Constraints: Measure resulting line counts. If a safe structural split cannot meet the size goal without changing semantics, report the remaining size and blocker rather than forcing behavior changes.
  7. New .cs files must be UTF-8 with BOM.
Acceptance Criteria
  • Original file is split into focused modules
  • Each new file is under 300 lines, or a concrete behavior-preservation blocker and remaining size are reported
  • Baseline semantics, including reachable duplicate/malformed cases and evaluation order, are preserved by focused equivalence checks
  • Relevant builds and tests pass for affected consumers/TFMs; exact checks and any validation gaps are reported
  • Public and tracked internal API contracts, attributes, and conditional compilation are preserved
  • Project includes, source links, and package layout still include the moved code for every affected consumer

Priority: Medium
Effort: Small
Expected Impact: Improved code navigability, easier testing, reduced merge conflicts

🤖 Automated content by GitHub Copilot. Generated by the Daily File Diet workflow. · copilot · auto · ~25 AIC · ⌖ ~1 AIC · ⊞ 7.4K · ◷

  • expires on Nov 7, 2026, 6:53 PM UTC
主要言語
C#
スター
1.1k
フォーク
312
平均マージ
10時間 39分
マージ済み PR(30日)
349

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/testfx のほかの issue

microsoft/testfx の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。