[file-diet] Refactor AzureDevOpsSummaryReporter.Lifecycle.cs (537 lines) into focused files
维护者通常 1 天内回复
评估
调研方向
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 内容生成。
描述
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): consumesTestNodeUpdateMessage, 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:
-
AzureDevOpsSummaryReporter.Lifecycle.cs(kept)- Contents:
OnTestSessionStartingAsync,OnTestSessionFinishingAsync - Responsibility: session start/finish lifecycle
- Contents:
-
AzureDevOpsSummaryReporter.Consume.cs- Contents:
ConsumeAsyncand its local helpers (timing/dependency collection) - Responsibility: ingesting test node updates into rows
- Contents:
-
AzureDevOpsSummaryReporter.FlakyRows.cs(if needed)- Contents:
ClearFlakyRowsand related flaky/record bookkeeping helpers - Responsibility: flaky-row tracking and cleanup
- Contents:
Implementation Guidelines
- 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. - 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.
- 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.
- 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.
- 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.
- 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.
- New
.csfiles 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 小时 36 分钟
- 30 天内合并 PR
- 345
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/testfx 的其他 Issue
-
needs/triage
难度 3/5 1-2 天 新手友好度 56/100
维护者通常 1 天内回复
-
type/automation type/tech-debt
难度 3/5 1-2 天 新手友好度 48/100
维护者通常 1 天内回复
-
area/assertion needs/triage
难度 5/5 一周以上 新手友好度 42/100
维护者通常 1 天内回复
-
type/automation type/test-gap
难度 3/5 半天 新手友好度 15/100
维护者通常 1 天内回复
-
The productive version of Microsoft.Testing.Extensions.HangDump must not reference to a preview version of Microsoft.Diagnostics.NETCore.Client可能已有人在做 @Evangelink 于 13 天前认领。 未关闭area/dump external/other
难度 2/5 1-3 小时 新手友好度 45/100
microsoft/testfx#11981 · 6 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
A: Art Beginner Friendly P3: Standard T: Bugfix
难度 2/5 1-3 小时 新手友好度 76/100
space-wizards/space-station-14#46728 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 77/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
juandresrodca/AdminForge#54 ·