From 4bbf15915fe84c31bd117f3186a937f9198caf18 Mon Sep 17 00:00:00 2001 From: zsxh1990 <445655361@qq.com> Date: Tue, 15 Sep 2026 18:02:59 +0800 Subject: [PATCH] fix(guard): exempt test files from markdown leak detection (Rule 3) Test files legitimately contain markdown data (triple backticks, ## headers) which triggers false positives in Rule 3. Add test file exemption. Fixes #1538 Signed-off-by: zsxh1990 <445655361@qq.com> --- .github/workflows/pr-shape-guard.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-shape-guard.yml b/.github/workflows/pr-shape-guard.yml index 3d7884f293..7509689d42 100644 --- a/.github/workflows/pr-shape-guard.yml +++ b/.github/workflows/pr-shape-guard.yml @@ -58,7 +58,9 @@ jobs: } // Rule 3: source file contains pasted markdown/diff - if (/\.(py|js|ts|go)$/.test(name) && f.patch) { + // Skip test files — they legitimately contain markdown test data + const isTestFile = /^tests?\//.test(name) || /test[_]?/.test(name.split('/').pop()); + if (/\.(py|js|ts|go)$/.test(name) && f.patch && !isTestFile) { const added = f.patch .split('\n') .filter(line => line.startsWith('+') && !line.startsWith('+++'))