Skip to content

fix(triage): 忽略代码示例中的分诊命令 - #346

Merged
Terry-Mao merged 7 commits into
mainfrom
fix/ignore-triage-code-blocks-343
Nov 6, 2026
Merged

Terry-Mao merged 7 commits into
mainfrom
fix/ignore-triage-code-blocks-343

Conversation

@Terry-Mao

Copy link
Copy Markdown
Owner

Summary

  • 使用 Markdown 解析识别可见的 /triage 命令,跳过围栏、缩进代码、行内代码、引用及 HTML 代码示例。
  • 保留列表、HTML 容器及段落续行中的有效命令,并在 triage workflow 预检前安装解析依赖。
  • 补充命令识别与 workflow 依赖顺序的回归测试。

Fixes #343

Testing

  • PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s .github/aicodingflow-tests:544 项通过(Python 3.12,按 CI 安装依赖)。
  • PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s .github/tests:14 项通过(同一环境)。
  • actionlint .github/workflows/triage-issue.yml、Python 编译检查、git diff --check:通过。

Risk

  • triage 预检新增 Markdown 解析依赖安装步骤;依赖安装失败时,workflow 会在预检前停止。

How to revert

  • 使用 git revert 7ef9689e087409e00dbb362ff8bba35989261399 撤销本次提交并推送还原提交。

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现 1 个会漏掉有效 /triage 命令的 Markdown/HTML 解析缺陷,建议修复后再合并。

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

存在阻断问题:上一轮未解决线程(.github/scripts/prepare_issue_triage_context.py:58,comment 4478781272)指出的 HTMLParser 缓冲问题目前只对 script/style 结束标签做了 close(),多行 HTML 注释仍会延迟解析。复现 `

@codex /triage

` 时当前返回 `False`,注释后的真实命令会被跳过;而未闭合注释跨空行时,注释内的命令又可能被误判为 `True`。请在 HTML 注释结束及 HTML 块边界正确处理解析状态,并补充“多行注释后真实命令触发”和“未闭合注释不触发”的回归测试。

@Terry-Mao

Copy link
Copy Markdown
Owner Author

已在 b13497b 修复这轮审查指出的 HTML 注释问题:未闭合注释的隐藏状态会跨 Markdown 块保留,完整 --> 到达后会冲刷解析器;注释结束后的真实命令可触发,注释内命令不会触发。还覆盖了注释结束后紧接 <code> 的情况。回归测试在本机 Python 3.12.13 与 3.15.2 均通过;完整 delivered 测试各 546 项、仓库测试 14 项通过。等待本次提交的 CI 验证。

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本轮复核了上一轮 HTMLParser 缓冲问题:当前实现已补充结束标签冲刷与 script/style 回归覆盖,未再重复该行内评论。仍有两类 HTML 代码示例会被误判为可见命令,在未被要求时触发 triage,需修复后再合并。

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本轮增量(第 4 轮)仍存在可复现的误判:HTML 内的围栏代码示例跨空行拆成多个 block 后,fence_char 因每次调用重置,后续示例行会被当作真实命令。详见行内评论。

架构评估

本轮已是针对同一可见性判定的第 4 轮补丁。当前同时维护跨 block 的 HTMLParser 状态、块级 quote_depth/list_depth,以及每次调用重建的 fence 状态,边界语义不一致;新增的跨空行用例说明继续逐例打补丁会持续产生回归。建议将可见文本提取收敛为一次性 token/状态机处理,而不是在 HTML block 内继续维护独立的 Markdown 围栏解析。

既有讨论

前轮未解决线程中的 textarea、嵌套列表围栏和 script/style 缓冲问题已由当前提交的测试覆盖,未重复行内评论;本轮发现的是新的跨 block fence 状态问题。

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

第 5 轮增量审查发现当前 fence 状态恢复逻辑仍会把 HTML 容器内的一组围栏代码误判为可见命令,需要修复后再合并。此前 textarea、列表围栏和跨 block fence 状态问题在当前提交中已有对应修复。

架构上,连续多轮修补仍在 Markdown token、原始 HTML 和手写 fence 状态之间手工同步;建议统一由 token/source-map 驱动可见性判断,避免继续以局部条件叠加修复。

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

本轮增量修复将 HTML 围栏关闭后的处理改为在 Markdown token 边界停止,避免继续把新开启的围栏内容当作可见文本;新增的普通与列表围栏回归用例覆盖了此前未解决线程中的误触发。相关命令识别测试 24 项通过,未发现新的阻断级问题。

架构评估:命令识别已连续多轮围绕跨 block HTML 状态和围栏边界打补丁,Markdown token、HTMLParser 与手写状态机并存,长期维护风险偏高。本轮修复本身没有引入新的可复现缺陷,因此不阻断合并;若后续再出现同类边界问题,应改为单一的可见文本或 token 解析路径,而不是继续增加局部特判。

@Terry-Mao
Terry-Mao merged commit 3261cc0 into main Nov 6, 2026
13 checks passed
@Terry-Mao
Terry-Mao deleted the fix/ignore-triage-code-blocks-343 branch November 6, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: 波浪线围栏或缩进代码块中的 /triage 会误触发 triage

1 participant