Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

chatcops test: calls-tool and no-tool-call assertions

已关闭
#412 2 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@bhushan4work 已经在做这个了。

开始于 2026年10月28日。

  • #446 来自 @bhushan4work —— 已合并

评估

这个 Issue 还没有评估数据。

描述

enhancement good first issue hacktoberfest testing

Lets an eval check that the bot called the right tool with the right input, or that it called none.

How assertions work
chatcops test (#394, with replays from #395 and the judge from #400) checks each turn's reply with the assertions in the eval file. They're registered by name in ASSERTIONS (packages/cli/src/test/assertions/index.ts:11). Each one is an AssertionCheck (packages/cli/src/test/types.ts): it gets the value from the YAML, the turn's TurnResult (text, toolCalls, sources, leads, usage, costUsd, latencyMs), the conversation so far, and a context with the eval file's path, and returns { pass, reason }. Throw for a bad value (see asStrings in assertions/values.ts), and the runner turns it into a failure with your message. The not- prefix works for every name without extra code.

contains in assertions/text.ts is the reference: one file per kind of assertion, added to the map. Write reasons a person can act on, such as the reply doesn't contain "$19".

What to add (new assertions/tools.ts)

  • calls-tool: a tool name (calls-tool: lookup_order), or { name, args }. args is a partial deep match against the call's input: every key in args has to be there with an equal value, and extra keys in the input are fine. Nested objects match the same way, and arrays have to be equal.
  • no-tool-call: true means the turn called no tool at all. A tool name means it didn't call that one.

The calls are in turn.toolCalls as { name, input }. The reason for a failure should list the calls that did happen, so people see what went wrong.

Acceptance criteria

  • Unit tests: name only, partial args, nested args, a mismatch that lists the actual calls, no-tool-call both ways, bad values
  • An end to end test with a tool mock (see "answers tools from mocks" in test-command.test.ts)
  • Documented in website/src/content/docs/core/testing.mdx, with a changeset for @chatcops/cli (minor)
  • pnpm test:coverage and pnpm lint pass
主要语言
TypeScript
星标
13
派生
7
平均合并
3 小时 39 分钟
30 天内合并 PR
275

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codercops/chatcops 的其他 Issue

查看 codercops/chatcops 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。