Repository navigation
门禁: 完成 ZCE-7 注释治理、D26–D28 归档与借口注释静态检查 - #19
Merged
Merged
Conversation
清理 lib/ 与 dsh-plugin/src/ 中过渡期旧项目对比、内部评审流水号与源码 权宜 注释,避免过时注解误导维护;将真实协议、运行期、闲时配额与 DSH 面板边界取舍统一归档至 docs/decisions.md(D26–D28)并更新 docs/RULES.md;在 scripts/check-boundaries.mjs 增加词法级借口注释检查(检查 5)与回归单测 test/check-boundaries.test.mjs,把规范沉淀为提交门禁;同步重建 dsh-plugin/lib/。全量业务代码去注释 AST 零变化。
The static excuse-comment check scanned TSX pages as plain JavaScript:
an apostrophe in JSX text opened a phantom string that swallowed the rest
of the file (real comments in later braces were missed), and // inside a
bare URL in JSX text was read as a comment opener (legal copy failed the
gate). Both directions were stable repros, no timing involved.
The lexer now tracks jsxtext/jsxtag regions: apostrophes and URLs in JSX
text are copy, only comments inside {} code regions are extracted. Tag
detection is heuristic (whitespace/bracket/keyword-preceded '<' followed
by a letter or '>') — generics like useState<string> and comparisons stay
code. Element depth is balanced across open/close/self-close so trailing
code after a closed element is scanned as code again.
Regression: auditor's eight positive/negative cases all pass (mismatches=0);
two repo test cases added (JSX copy with bare TODO URL exits 0, real TODO
comment inside braces exits 1); existing four gate cases stay green.
The R1 lexer only popped a jsxtext layer when the global element depth returned to zero, so nested elements never released their inner text state: everything after a nested close was scanned as JSX copy and real comments went unreported (nested elements, nested fragments, conditional children, and the production panel with a trailing TODO all slipped through — exit 0 where the gate should have failed). Root cause of the missed pops: the '/' of a closing tag was also consumed by the self-close handler, double-decrementing the depth in the original design. Closing tags now open in a dedicated jsxclosetag mode: each close pops exactly its own text layer and restores the parent state — parent JSX text when nested, the surrounding code expression at the outermost close. Self-closing tags still open no text layer and leave the parent untouched. Regression: auditor's 12 edge cases all pass (mismatches=0, panel copy now hits line 267), the original 8 positive/negative cases stay green, two nested-JSX cases added to the repo gate tests (6->7); full npm test 903/903.
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.
目标与背景
完成 ZCE-7 注释治理,清理
lib/与dsh-plugin/src/中旧项目对比(coder-mcp-bridge/ 非版权zcode-acp)、内部评审流水号与源码权宜注释,保留 Apache-2.0 版权声明与协议字段映射注记。主要改动
docs/decisions.md新增D26–D28归档运行期、闲时配额与 DSH/观察面板边界;更新docs/RULES.md第 4 节。scripts/check-boundaries.mjs新增词法级借口注释检查(检查 5)与test/check-boundaries.test.mjs(4 条回归单测)。lib/(45 文件)与dsh-plugin/src/(15 文件)注释并重建dsh-plugin/lib/(29 文件);TypeScript 6.0.3removeComments: true验证 60/60 源文件零非注释 AST 差异。验证
npm test:900/900 通过,sync-doc-version --check通过,5 项check-boundaries全部通过。npm run verify:7 个目标文件checkJs零错误。cd dsh-plugin && npm run verify && npm run build && node --test test:112/112 通过,只读 Neon 复验 PASS。