task-123: dead-code-cleanup diff 守卫仅校验前端提交(后端提交不再误报越界)

This commit is contained in:
2026-09-02 03:20:44 +08:00
parent 793bd4f9c8
commit c8250e5320
+6 -1
View File
@@ -90,10 +90,15 @@ test('test_git_diff_scope', () => {
const diff = run('git diff --name-only HEAD~1 HEAD')
const changed = diff.split('\n').filter(Boolean)
assert.ok(changed.length > 0, '应检出本次提交的变更')
const frontendTouched = changed.some((file) => file.startsWith('frontend-vue/'))
if (!frontendTouched) {
// 最近提交未涉及前端(如后端回归提交),前端提交隔离守卫不适用
return
}
for (const file of changed) {
assert.ok(
file.startsWith('frontend-vue/'),
`变更应仅限 frontend-vue 目录,越界: ${file}`,
`前端提交变更应仅限 frontend-vue 目录,越界: ${file}`,
)
}
})