关于 servicing-pr
用于准备面向发布分支的 EF Core 维护拉取请求的开发技能,涵盖目标分支选择、PR 格式要求,以及何时适合使用 AppContext 开关。
主要功能
- 01维护分支选择
- 02发布 PR 标题与描述模板
- 03AppContext 开关指导
- 04PR 描述验证
适用场景
- 01准备面向发布分支的缺陷修复回移
- 02检查维护 PR 描述是否包含必需章节
- 03判断修复是否需要退出开关
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ dotnet/ efcore --skill servicing-pr安装后在 Claude Code 中输入/servicing-pr确认已加载。
详细介绍
服务维护 PR
针对 release/* 分支的 PR 需要使用特定的描述格式,并应在适用时包含一个兼容开关(AppContext switch)。更新服务维护 PR 的进度时,请确保描述仍符合模板。
回移目标分支
- 如果指定了版本,请以
release/XX.0为目标(例如,backport to 10→release/10.0) - 否则,查找最新的
release/XX.0分支(忽略release/11.0-preview2等预览分支) - 创建 PR 前,确认该分支存在
PR 标题
[release/XX.0] <原始 PR 标题>
PR 描述模板
Fixes #{issue_number}
Backports #{source_pr_number_if_applicable}
**Description**
Provide information on the bug, why it occurs and how it was introduced. Put it in terms that developers can understand without knowledge of EF Core internals.
**Customer impact**
How the bug affects users without internal technical detail. Include a short (3-4 lines) code sample if possible. If data corruption occurs, state that explicitly. If a feasible workaround exists, briefly describe it and how discoverable it is, otherwise mention that there's no workaround.
**How found**
How the bug was discovered based on the information in the issue description. If user-reported, mention "User reported on <version>". If multiple users are affected, note that. Count the number of upvotes and comment authors to estimate impact.
**Regression**
Whether this is a regression from an earlier EF version. Add a link to the PR that introduced the regression if known. If it only affects a feature introduced in the same major version, it is not a regression.
**Testing**
State the number of new or modified tests, don't go into details. If test coverage is unfeasible, briefly explain the alternative validation approach that was used.
**Risk**
Brief risk assessment ranked from "extremely low" to "high". Note amount of code changed. If the fix is a one-liner, mention that. If a quirk was added, mention "Quirk added".
兼容开关(AppContext Switch)
兼容开关允许用户在运行时选择不使用此修复,从而降低补丁风险。如果修复完全明确且没有风险,或者无法使用兼容开关(例如在工具或分析器中),则跳过。
添加兼容开关
在包含代码更改的类中添加:
private static readonly bool UseOldBehavior37585 =
AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue37585", out var enabled) && enabled;
- 将
37585替换为相应的问题编号 - 使用
!UseOldBehavior37585条件包裹更改,以便启用开关时绕过修复;尽量减少检查开关的次数 - 如果 PR 关闭了多个问题,请为开关名称选择最合适的问题编号
- 区分建议与已分阶段实施的内容。除非源代码更改确实包含该开关,否则不要说“已添加兼容开关”。
验证
- PR 描述完整遵循模板(所有部分均已填写)
- 在适当情况下添加兼容开关,且问题编号与 PR 描述一致
评论
支持 Markdown