fix(欠账): RESULT 行同时打"登记 vs 实测"(副本漂移可见 + 不等即红);共享树 stash 纪律与两条推广入册

pi 2026-09-14 三条。

1. **可见的那个数字是副本**:`docs/DEBTS.json` 手可编辑,而它唯一的守卫是 Go 那条断言
   —— 相位耦合(打印它的相位里 Go 断言未必跑过)+ 副本会漂移(我自己 §12 那句话)。
   现在 RESULT 行同时给出:

   `debts=9(registered) measured_static=5==登记 ✓(…;本相位只有 static 有权威实测,其余由 go test 侧判据比对)`

   即:**本相位能实测的(static,权威来源就是代码)当场比对并标注 ✓/✗**;
   **测不了的明说由谁比对**,不冒充已实测。并新增判据:**static 的登记值 ≠ 实测值即红**。

2. **共享树上不要用 `git stash` / `--autostash`**(pi:同一台机器,只是自动化了)——
   它把**别人**未提交的改动也收走,冲突/中断时可能留在 stash 里,而 ta 只看到"我的改动不见了"。
   入册 CRITERIA §8.1:优先 `git worktree add`;必须原地操作就先约定窗口;事后核对别人的文件还在原处。

3. **两条推广入册**(各只出现过一次,但形状会复发):
   · §15 **判据必须自足**:不许通过共享可变状态在判据之间传递结论 —— 顺序依赖的显形方式
     永远是**假绿**(我踩过:余额由 SKIP 那支写入、登记判据去读 ⇒ 同包按文件顺序跑 ⇒ 读到 0);
   · §16 **"要提醒人的"输出必须走默认路径**(`TestMain` 收尾打印在常态 `go test` 里不存在),
     配套动作是 pi 那句:**写完"可打印的余额"之后,去看一眼默认路径实际打出来的样子**。
This commit is contained in:
2026-09-14 17:21:26 +08:00
parent 512b3f8f80
commit b16e2d24fd
3 changed files with 85 additions and 3 deletions

View File

@ -512,12 +512,30 @@ if (skippedByPhase.length) {
* 所以 Go 那边的 Skip 余额必须在**这边**可见。两边读**同一个**登记(docs/DEBTS.json),
* 于是"三笔欠账一处看全"且有余额、有到期。
*/
/*
* 欠账余额:**登记值与实测值一起打**(pi 2026-09-14 裁定 §1)。
*
* 为什么不能只打登记值:`docs/DEBTS.json` 是**手可编辑的副本**,而"可见的那个数字就是副本"
* 恰好违反我自己写进 §12 的那句 —— 比较的对象必须是权威来源,不是手边那份会过期的副本。
* 所以这一行同时给出:
* · `registered`:登记值(副本,谁都能改);
* · `measured`:**本相位能实测的部分**(这里有权威来源的只有 static:`STATIC_ONLY.length`);
* · 本相位测不了的(Go 侧那几笔)**明说由谁比对**,不冒充已实测。
* 不等即红:下面这条判据就是这一行(static 的登记值必须等于实测值)。
*/
const DEBTS_PATH = join(HERE, '..', '..', '..', 'docs', 'DEBTS.json');
let debtsLine = '';
let debtRegStatic = null;
try {
const led = JSON.parse(prose(join(HERE, '..', '..', '..', 'docs', 'DEBTS.json')));
const items = led.debts.map(d => `${d.id}:${d.count}`).join(',');
const led = JSON.parse(prose(DEBTS_PATH));
const total = led.debts.reduce((n, d) => n + d.count, 0);
debtsLine = ` debts=${total}(${items})`;
const items = led.debts.map(d => `${d.id}:${d.count}`).join(',');
const regStatic = led.debts.find(d => d.id === 'static-criteria');
debtRegStatic = regStatic ? regStatic.count : null;
const measuredStatic = STATIC_ONLY.length;
debtsLine = ` debts=${total}(registered) measured_static=${measuredStatic}` +
`${debtRegStatic === null ? '(登记无此项)' : debtRegStatic === measuredStatic ? '==登记 ✓' : `≠登记${debtRegStatic} ✗`}` +
`(${items};本相位只有 static 有权威实测,其余由 go test 侧判据比对)`;
} catch (e) {
debtsLine = ` debts=登记读不到(${e.code || e.message})`;
}