fix(scripts): 校验规则去假阳性——前端/修复类条目合法化+路径参数不误判占位符
- CHANGE_TYPES 扩:修复/前端缺陷/前端优化/前端修复(文件名+frontmatter 同步);纯前端条目 issue 段允许 frontend 字面量、backend_status 允许 not_required(接口类仍禁)
- E_PLACEHOLDER 只拦双花括号/TODO/待补充,不再误杀 {orderId} 等 REST 路径参数
- E_SECTIONS 仅约束接口类条目,章节名宽匹配(变更接口/变更清单/接口变化/行为变化等)
- 核心门禁保持硬:接口类必须 backend_status=deployed 才允许发布(E_BACKEND_PENDING)
- 背景:规则假阳性致 CI 长期常红被忽略,真违规(未部署即推送)淹没其中;npm test 46/46 绿
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
这个提交包含在:
@@ -8,7 +8,7 @@ const CONTROLLED_ROOTS = new Map([
|
||||
['changelogs-v2', '管理后台'],
|
||||
['changelogs-v2-mp', '小程序端'],
|
||||
]);
|
||||
const CHANGE_TYPES = new Set(['新增接口', '修改接口', '删除接口']);
|
||||
const CHANGE_TYPES = new Set(['新增接口', '修改接口', '删除接口', '修复', '前端缺陷', '前端优化', '前端修复']);
|
||||
const PATH_ALIAS_MANIFEST = 'changelog-path-aliases.json';
|
||||
|
||||
function ruleError(code, path, message, expected) {
|
||||
@@ -180,7 +180,7 @@ export function validateChangelogPath(inputPath, now = new Date()) {
|
||||
'E_CHANGE_TYPE',
|
||||
changelogPath,
|
||||
`变更类型为 ${actualType || '(缺失)'}`,
|
||||
'新增接口 / 修改接口 / 删除接口',
|
||||
[...CHANGE_TYPES].join(' / '),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -203,8 +203,8 @@ export function validateChangelogPath(inputPath, now = new Date()) {
|
||||
if (day !== expectedDate.day) {
|
||||
errors.push(ruleError('E_DAY', changelogPath, `日前缀为 ${day}`, expectedDate.day));
|
||||
}
|
||||
if (!/^[1-9]\d*$/.test(issue)) {
|
||||
errors.push(ruleError('E_ISSUE', changelogPath, `Issue 号为 ${issue || '(缺失)'}`, '不带 # 的十进制正整数'));
|
||||
if (!/^[1-9]\d*[a-z]?$/.test(issue) && issue !== 'frontend') {
|
||||
errors.push(ruleError('E_ISSUE', changelogPath, `Issue 号为 ${issue || '(缺失)'}`, '不带 # 的十进制正整数(可带一位小写字母后缀),或纯前端条目用 frontend'));
|
||||
}
|
||||
if (title.trim() === '') {
|
||||
errors.push(ruleError('E_TITLE', changelogPath, '业务标题为空', '非空业务标题'));
|
||||
|
||||
在新工单中引用
屏蔽一个用户