Skip to content

docs(webui): correct twelve symbol citations, and check them on every change - #136

Merged
fengzhi09 merged 3 commits into
mainfrom
docs/architecture-symbol-locations
Sep 30, 2026
Merged

fengzhi09 merged 3 commits into
mainfrom
docs/architecture-symbol-locations

Conversation

@fengzhi09

Copy link
Copy Markdown
Collaborator

问题

packages/webui/docs/ARCHITECTURE.md 与 .zh-CN.md 自称是「构建方式唯一权威」,但它引用的 50 条「符号 → 文件」里12 条是错的——24%。

类别 数量
正确 38
文件错 4
符号已不存在 3
文件已不存在 2
表达不清 3

几条值得单独说的

同名符号张冠李戴:侧栏的 renderSessions 其实是轨迹工作室的同名符号——主 UI 是 session-tree.tsx#SessionTree。这不是「文件过时」,是读者会照着找错地方。

文档在教人往错文件里加代码:§9 让新端点加进 router.js 路由表,但多数端点已归 server/app.js(Hono)的 OWNED_ROUTES——照原文做会加错地方。

已删除的符号如实标「已移除」并写明替代(runMcode()/stopExec()/isRunning() 三个全被 ACP 重构删除,取消改走 mcode-rpc.js#cancelSession)。没有编造改名。 render.js 整文件随 vanilla-JS SPA 迁移而删除。

自动校验:手查不 scalable,所以进流水线

check-docs-alignment.mjs 新增第 7 项,三层:

子项 查什么
7a 每个裸路径存在
7b 每个 file#symbol 与 (in file) 能解析到定义(判定时剥离 import 行,否则会误判)
7c 中英双份镜像对齐

接进 scripts/verify.mjs(docs:true, windows:true)——

该脚本此前只能手工触发,无任何变更会自动跑到。不接线就是装饰品。

证伪测试(编排侧独立复跑过)

篡改 ARCHITECTURE.md:460 的 mcode-rpc.js#cancelSession → #cancelSessionXX:

篡改后 EXIT=1   ← 校验器真红
还原后 EXIT=0   ← 校验器真绿

一处自我更正:开发 agent 第一轮的证伪无效——sed 写成反引号而文档用 #,grep -c 退出 1 截断了 && 链,node 根本没跑,那轮的 FALSIFY_EXIT=1 来自 grep 而非校验器。已按行号重做。

门禁防不住什么(如实说明)

  • 无文件绑定的散文式符号(stopExec() 那句)路径门禁看不见
  • 只管存在性不管描述准确性
  • 两个白名单需人守

门禁

门禁 退出码 结果
pnpm webapp:typecheck / typecheck 0 —
pnpm test:webapp 0 1842/1842
pnpm check:source 0 4900 files
check-docs-alignment.mjs 0 7/7(提交后复跑仍为 0)

顺带发现(未改,建议另开单)

§4 载荷字段层还有失真:context.source 不存在;NormalizedEvent 结尾「See § 5」而 §5 正文恰恰否认那些帧。且 server/app.js(Hono 层)此前从未在这份「构建权威」文档中出现——整个 HTTP 层缺失。

🤖 Generated with DeepSeek Harness

s39-dev added 3 commits September 30, 2026 21:59
The architecture pair cited fifty symbols to files and twelve of them
were wrong — a 24% error rate on a document that presents itself as the
authoritative account of how the build is wired. getCachedMcodeCommands
was filed under state-bus.js when it lives in acp-client.js; three
symbols named functions the ACP refactor deleted; two files no longer
exist at all.

Checking by hand does not scale, so the citation check runs now: every
bare path must exist, every file#symbol and "(in file)" must resolve
to a definition once import lines are stripped, and the two language
copies must mirror each other. It is wired into the verifier because an
unwired check is decoration — this script previously ran only by hand
and no change would have exercised it.

It is not a complete fence: a symbol named in prose with no file
attached is invisible to it, and it proves existence, not accuracy.
Two whitelists need a human to keep honest.
The deleted ones are now recorded as removed, with the path that
replaced them, rather than given an invented rename. render.js went with
the vanilla-JS SPA; cancelSession is what cancellation uses now.

Two citations were subtler than a stale file name. The sidebar's
renderSessions is a same-named symbol in the trajectory studio — the
main UI is session-tree.tsx#SessionTree. And section 9 tells new
endpoints to join the router.js table, but most of them now live in the
Hono OWNED_ROUTES in server/app.js, so following the text would put
new work in the wrong file.
Adding a gate to verify.mjs is not self-registering. The source-sync
fixture stubs the direct-path scripts it executes, and two profiles
assert their gate list by deepEqual, so both went red the moment
check:docs-alignment joined: the fixture hit MODULE_NOT_FOUND and the
lists disagreed on one more entry.

ci-release.yml filters on scripts/verify.mjs, so touching the verifier
is what pulled that workflow in — the failure was always going to
surface there first.
@fengzhi09
fengzhi09 merged commit 2404988 into main Sep 30, 2026
18 checks passed
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.

1 participant