Repository navigation
fix: position/filter 样式统计只在标签内匹配,修正英文正文子串误报 - #19
Merged
Merged
Conversation
preflight 与推送后回检都用裸字符串匹配统计 position:/filter:, 参考文献标题里的 "predisposition:" 被数成 1 处 position 样式: 本地 preflight 阻断且 --auto-fix 修不了,relay 回检写出 position: 1。 - harness/preflight.mjs、scripts/create_wechat_draft.mjs:改为只在标签内部统计 CSS 声明 - 新增 harness/test-css-declaration-count.mjs,同一组用例钉住两份实现,并接入 npm run check - 25 个已推送版本回归:只有触发误报的那一篇结论由 1 变 0,其余不变
leether
added a commit
that referenced
this pull request
Nov 25, 2026
PR #19 新增的 test-css-declaration-count.mjs 只接入了 npm run check, Lint workflow 的测试列表是写死的,CI 并不会跑到它。 - Run generated check tests 增加该测试 - push / pull_request 的 paths 增加 .github/workflows/lint.yml: 否则只改 workflow 时 CI 不会运行,这次改动也无法在合并前被验证
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
harness/preflight.mjs(本地推送前检查)和scripts/create_wechat_draft.mjs(relay 上的推送后回检)都用裸字符串匹配统计position:/filter:。正文里的英文单词子串会被数成 CSS 声明,例如参考文献标题DICER1-related tumor predisposition: identification…含子串position:。现场表现(2026-11-25):本地 preflight 报
html_compliance失败并阻断推送,--auto-fix无法修复;relay 回检写出position: 1 ❌,而style内的 position 样式数实际为 0。改动
countCssDeclarations(html, property),只在标签内部统计 CSS 声明(属性名前必须是行首、分号、引号或空白)。两份实现逐字相同,因为 relay 上运行的那份不能 importharness/。harness/test-css-declaration-count.mjs:同一组用例跑两份实现并要求结果一致,另有本地 preflight 与推送后回检各一条端到端用例;已接入npm run check。此前这两段匹配没有任何测试覆盖。验证
npm run check全过,privacy-check.sh --full通过。scripts/create_wechat_draft.mjs的这份改动已通过sync_relay_scripts.mjs --apply部署到 relay(备份create_wechat_draft.mjs.bak-20261125-063413),并在 relay 上直接调用analyzeDraftContent确认:参考文献标题数出 0,真实违规数出 1。行为变化
position :absolute)旧逻辑漏判,新逻辑会计入。position:开头的文本(如title="position: …")会被计入,方向保守。