Skip to content

test682 是一道过时的门:它断言的东西被 #698 有意删掉了(连带一个零调用方模块) #804

Description

@vansin

现象

tests/test682-uncovered-task-trace 是一道形状完整的 Docker 门,但从没被注册进
L1_TESTS,所以一直没人跑。跑起来是红的:

wiring.test.ts:9
  expect(cli.match(/sendPeerReplyTaskWithTrace\(/g)?.length).toBe(1);
  Expected: 1   Received: undefined

它不是烂了,是过时了

#698 有意把 peer reply 改成协商 send_peer_reply 原子工具,send_task 那条老路
被删掉。而且这个新形状是被另一道门锁住的 —— agent-node/src/reply-routing-source.test.ts:

describe("#698 peer reply runtime wiring", () => {
  test("peer replies negotiate the atomic tool and retain only a terminal legacy fallback", () => {
    expect(source).toContain('sendAtomic: (args) => callCommHub("send_peer_reply", {');
    expect(source).toContain('sendLegacyReply: (args) => callCommHub("send_reply", {');
    expect(source).not.toContain("sendPeerReplyTaskWithTrace({");   // ← 断言它不得出现
    expect(source).not.toContain("REPLY_VIA_SEND_TASK");
  });

两道门方向完全相反:test682 要求恰好出现 1 次,reply-routing-source 要求一次都不许有。
后者在 agent-node/src 下,现在由 test725 覆盖、在 CI 里跑着、是绿的。

所以当前 main 的行为是对的,过时的是 test682。

连带:一个零调用方的模块

agent-node/src/peer-reply-task-trace.ts 现在没有任何生产调用方:

$ git grep -l 'peer-reply-task-trace' origin/main | grep -v '\.test\.ts$\|^tests/'
<空>

它只被 test682 自己的四个文件引用(run.sh / semantics.test.ts / true-hub.ts /
wiring.test.ts)。也就是说,这个模块是被一道过时的门吊着命的死代码。

为什么值得单独提

这是孤儿门的第二种危害,和「测试烂掉没人知道」不同:

一道没人跑的门,会悄悄开始断言与当前设计相反的东西。

如果有人只看到「test682 没在 CI 里」就把它注册进去,main 会当场被它拦住,
而被拦的恰恰是正确的代码。我在 #803 里注册了另外三个孤儿门,唯独跳过它,
原因就是这个。

建议(不在 #803 里动手,等定夺)

  1. 退役 tests/test682-uncovered-task-trace,或者只保留其中仍然成立的部分;
  2. 确认 agent-node/src/peer-reply-task-trace.ts 确实该删 —— 它是 #167 的产物,
    删之前值得让当初的 owner 确认一句,而不是我按「grep 不到调用方」就动手。

范围:origin/main,证据全部可复验。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions