fix: address review feedback for hash-reference escaping#176
Conversation
- Widen escapeHashReferences regex to cover more contexts: parentheses, brackets, angle brackets, colons, and Chinese punctuation (:,、) - Skip code blocks (triple backtick fences) during escaping - Insert zero-width space between # and digits (not after) for correct GitHub reference breaking - Extract buildLangInstruction() in reviewers.ts for readability - Add architectural comment clarifying platform layer is authoritative - Use neutral notation in source comments (#<num> -> hash-number) - Unify Chinese/English instruction text between Python and TS - Add 14 unit tests for escapeHashReferences covering line start, after punctuation, Chinese punctuation, code block exclusion, and headings Addresses suggestions from PR #175 multi-review.
|
无遗漏 经过对比 PR body 中描述的改动(针对 PR #175 review feedback 的修复)和实际实现: 1. 正则覆盖增强(
2. 代码块排除(
3.
4. 架构注释(
5. 中性命名
6. 跨语言一致性
7. 14 个新增测试(
8. 集成完整性
PR body 描述的所有审查反馈点都已完整实现,未发现遗漏项。 |
|
可合并 本 PR 核心变更为强化 阻塞项:无 建议项:
📋 各 Reviewer 详细审查结果quality可合并 本次 PR 主要目的是强化 阻塞项:无 建议项:
security安全无虞 本次 PR 的核心变更集中在
阻塞项:无 建议项:无 performance性能良好 PR 主要是文本处理逻辑的增强(扩展 阻塞项:无 建议项:
architecture(审查失败: fetch failed) |
- Handle inline code (single backtick) in escapeHashReferences - Add comprehensive JSDoc documenting coverage scope - Add comment about global flag on HASH_NUM_RE - Export escapeHashReferences for direct testing - Add 14 TS unit tests (node:test) directly testing the function - Add cross-language consistency test (ZH/EN hash-avoidance strings must match between reviewers.ts and run-github-opencode.py) - Extract hash_avoid_zh/hash_avoid_en variables in Python to match TS structure and ensure one-to-one correspondence - Add npm test script and tsx devDependency for TS testing Addresses all confirmed suggestions from PR #176 multi-review.

Summary
Addresses review suggestions from PR #175 (multi-review quality, architecture, security reviewers).
Changes
Regex coverage improvement (
platform.ts)escapeHashReferencesregex to cover(#1),[#1],>#1,:#1,,#1,、#1,:#1etc.```fences is not escaped#and digits (not after the whole token)Code quality
buildLangInstruction()function inreviewers.tsfor readability#Nin code comments)Cross-language consistency
reviewers.tsandrun-github-opencode.pyTesting
escapeHashReferencescovering:(,[,>,::,,,、##) are not escaped# headingnot escaped#1,handledTesting
npx tsc --noEmit)