Skip to content

fix(doctor): report unavailable channels and computer-use share - #195

Open
titanwings wants to merge 2 commits into
atomic/pr-3-doctor-shapefrom
atomic/pr-7-doctor-unavailable
Open

titanwings wants to merge 2 commits into
atomic/pr-3-doctor-shapefrom
atomic/pr-7-doctor-unavailable

Conversation

@titanwings

Copy link
Copy Markdown
Owner

Why

doctor --json 的 unavailable 来自空的 PLANNED 表,所以永远是 []。本机到底能不能采集某个渠道,回执不说。账本里 note、本地 harvest、browser 采集和 API 采集的占比也不出现。CONTRACT §1 要求 doctor 报不可用渠道和 computer-use 占比。T48 因此一直红。

数据形状如下。

输入 调用 字面期望
空 HOME 与空 DISTILLY_HOME doctor --json unavailable 恰好四条:feishu、slack、dingtalk、x。每条 {channel, reason}。reason 以 no credential at 开头,并含 feishu_config.json 等文件名
同上,再放一个空的 slack_config.json doctor --json unavailable 不含 slack,其余三条仍在
synthetic-interview harvest 再加一条 note doctor --json provenance.model-read.entries 为 1。model-read、browser、api、file 四类 share 之和为 1。JSON 能被 /computer[-_ ]?use/i 命中
无账本工作区 doctor --json provenance 四类 entries 与 share 都是 0。退出 0
us-house 只 harvest,加 --require-shape doctor --require-shape --json 退出 1,ok 为 false,shape[0].verdict 为 FAIL。unavailable 仍在。退出码只由 shape 决定

Scope

只改 unavailable 的来源,并新增 provenance 统计。

unavailable 由 credentialed.mjs 的 CHANNELS 表乘 DISTILLY_HOME(否则 ~/.distilly)下 <ch>_config.json 是否存在得出。doctor 在 run 里动态 import("./credentialed.mjs"),不在模块顶层 import。credentialed.mjs 只把 const CHANNELS 改成 export const CHANNELS。

provenance 按账本 method 与 credentialed 分成 model-read、browser、api、file 四类,报告 entries、bytes、share。note 的 method 是 model-read。harvest 本地文件走 file。credentialed 且 method 含 browser 的走 browser。其余凭据采集走 api。browser 一类就是 computer-use 占比,回执另有 computer-use 键,指向同一对象。

人读输出保留 Unavailable / 未实现 一行,另加 Provenance / 来源 一行。退出码仍只由悬空锚点与 --require-shape 决定。

不改 corpusShape。不改 deliveredAnchors。不改 collect 路由、--mode 或 help 文案。

tests/doctor-coverage.test.mjs 加无凭据渠道与占比两条用例。

A7 补进两份测试。只改 unavailable 断言与过时注释。Object.keys(PLANNED) 为空保持。

  • tests/commands.test.mjs。渠道列表改为 ["feishu","slack","dingtalk","x"]。
  • tests/note.test.mjs。unavailable 改为四条 {channel, reason},reason 含对应配置文件名。

tests/gates/baseline/audit-tests.txt 只删这一行。

  • R48 doctor reports the channels this machine cannot collect from and the computer-use share

该行对应 tests/audit/retrospect-doctor.test.mjs 的 T48。删前数据行 16,删后 15。没有删 R08、R21、R23、R28、R56、R58。

Blast Radius

空 HOME 下 doctor --json 的 unavailable 从 [] 变成四条渠道。这是要修的行为。有配置文件的渠道不会出现在列表里。已 harvest 的 text 与账本不用迁移。

--require-shape 与悬空锚点的退出码不变。面试语料形状仍 PASS。us-house harvest 后 --require-shape 仍 FAIL,exit 1。

栈停在 dot-skill-test,dot-skill 保留。

Verification

T48 由红转绿。基线从 16 行减到 15 行。

改前,Node v22.14.0,HEAD d05717b:

PASS audit-tests  (7.4s, exit 1)
     ratchet failing 16, baseline 16

T48 失败原文:

unavailable=[]; DISTILLY_HOME holds no credential file

新用例在 base 上失败。doctor lists every CHANNELS channel this machine has no credential file for:

+ []
- [
-   'feishu',
-   'slack',
-   'dingtalk',
-   'x'
- ]

doctor reports model-read entries and a computer-use share whose four buckets sum to 1:

Cannot read properties of undefined (reading 'model-read')

改后,Node v22.14.0,HEAD 57ffcbf:

PASS audit-tests  (7.1s, exit 1)
     ratchet failing 15, baseline 15

改后,Node v20.20.2:

PASS audit-tests  (8.7s, exit 1)
     ratchet failing 15, baseline 15

node --test tests/doctor-coverage.test.mjs tests/commands.test.mjs tests/note.test.mjs 在 Node v22.14.0 上是 # tests 33、# fail 0。T48 单独跑 # pass 1。

node scripts/run-gates.mjs --without playwright 在 Node v20.20.2 与 Node v22.14.0 都是 8/8 gates passed。unit-tests 是 # tests 405、# fail 0、# cancelled 0。

DISTILLY_PLAYWRIGHT_ROOT=/tmp/pw-root node scripts/run-gates.mjs --requires playwright 在 Node v22.14.0 上是 3/3 gates passed。三份语料都是 验收结果:18/18 通过。us-house 含 FAIL · units=2744 speakers=18 attributed=85。引用上一版实测,本拍未重跑。

You see,Node v22.14.0。node bin/distilly.mjs 实测。空 HOME 与空 DISTILLY_HOME 下 doctor --json 的 unavailable 恰好 feishu、slack、dingtalk、x,reason 含 feishu_config.json。含一条 note 的工作区 provenance.model-read.entries 为 1,四类字节占比之和为 1。无账本工作区四类都是 0,退出 0。us-house --require-shape 退出 1,unavailable 仍在。人读输出有 Unavailable / 未实现 与 Provenance / 来源 两行。doctor 在已 harvest 的 us-house 工作区三次墙钟中位数 68 ms。低于 0.5 秒预算。

Rollback

回退 57ffcbf 与 f59b468。已 harvest 的 text 与账本不用迁移。栈停在 dot-skill-test,dot-skill 保留。

Doctor lists CHANNELS that lack <ch>_config.json and reports ledger provenance buckets including computer-use.
Keep PLANNED empty. Doctor lists feishu, slack, dingtalk, and x when those config files are missing.
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.

2 participants