Skip to content

refactor: 删除发布代码中的 test-only compatibility facades #130

Closed

Description

@tt-a1i

问题

若干 production module 为历史测试保留了没有真实运行时消费者的 API:

  • ui-customization/footer.ts::buildFooterContent,源码注释明确为 legacy test helper;
  • Direct Subagent 的 TranscriptRenderer / buildTranscriptLines compatibility wrapper,正式页面已经使用共享 AgentTranscriptRenderer;
  • TASK_TOOL_NAMES 等仅供测试或历史入口使用的 re-export;
  • subagents/src/backends/stub.ts 只被测试使用,但当前 package files 规则会把它放进发布产物。

这让测试反过来固定生产 API,并使 npm artifact 包含不参与用户行为的支持代码。

建议范围

  • 删除没有生产消费者的 legacy helper、wrapper 和 re-export。
  • 测试直接通过当前真实 owner 验证:
    • footer 测试走 renderFooter;
    • transcript 测试走共享 document/renderer;
    • constants 从其真正 owner 导入,或只在测试 fixture 中定义。
  • 将 stub backend 移入明确的 test support 路径,或内联到唯一测试 owner。
  • 检查 package artifact,确保 test-only helper 不再发布。

不做什么

  • 不删除共享 renderer、spinner、sanitization 或 tool activity projection。
  • 不为了减少 export 而复制生产逻辑到测试。
  • 不声称能够覆盖未知的、未文档化 npm deep import;若仓库对 internal deep import 有兼容承诺,应先记录。

验收标准

  • repo 内不存在 production consumer 的 compatibility facade 被删除。
  • 测试覆盖当前真实入口,而不是旧 API。
  • npm artifact 不再包含 test-only stub backend。
  • 用户可见 footer 和 Direct/Workflow transcript 快照保持等价。
  • bun run check、bun run test 通过。

Activity

  1. added
    enhancement
    on Aug 24, 2026
  2. added a commit that references this issue on Aug 26, 2026
    fbb4b35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions