Skip to content

SecScore 自动化测试已实现并提交,134 项全通过。 - #17

Open
opencode-agent[bot] wants to merge 1 commit into
masterfrom
opencode/issue7-20260901124642
Open

SecScore 自动化测试已实现并提交,134 项全通过。#17
opencode-agent[bot] wants to merge 1 commit into
masterfrom
opencode/issue7-20260901124642

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Sep 1, 2026

Copy link
Copy Markdown

已完成 SecScore 操作的自动化测试实现并提交(分支 opencode/issue7-20260901124642,commit e7c0fc5)。

改动内容

新增 src/secscore-connector.test.ts(5 个用例,随 npm test 运行)

按上轮方案采用「双层 mock」:模型层用脚本化 OpenAI 兼容 SSE(工具调用→回答),SecScore 后端层用内存 fake Sync Server(node:http 实现 /v1/classes/v1/snapshot/v1/sync/v1/operations)。插件通过 SECSCORE_SYNC_SERVER_URL 指向本地 fake server,PluginManager 注入 fake authBridgegetSession 返回测试 token),并删除 SECTL_OFFICIAL_API_URL 跳过 Relay introspection。

用例 提示词 断言重点
1 小明有几分 隐藏工具契约(add_score 可见、其余 4 个隐藏)、find_students 查询、回答含 12 分
2 给小明小张和小泽加两份… 3 次 add_score(score=2、reason=「昨天主动帮忙值日了」)、fake server 积分 12→14/10→12/9→11、3 条审计记录
3 给一组所有人加一分 list_group_members("一组") 后逐个 add_score(1)、一组 4 人各 +1、二组不变
4 总积分超过50的有哪些人 Skill 自动加载(secscore-connector/secscore 出现在首个模型请求系统消息)、只查询不加分、回答只含 55/60 分者
5 同名同学 加分失败、错误信息回传模型、云端积分不变、无审计记录

新增 src/test-fixtures/secscore-connector/:插件三件套副本(main.mjssecagent-plugin.json v2.1.6、skills/secscore/SKILL.md + icon.svg),SHA-256 与上游 SECTL/SecScore-SecAgent-Connector 主分支完全一致;测试内动态打包→PluginManager.install(),插件侧契约一旦改动测试即失败。

验证结果

  • npm run build:cli 编译通过(严格 TS)。
  • npm test 全量:134 tests,133 pass,0 fail,1 skipped(skip 为既有 Windows-only 用例)。
  • 新测试文件单独运行 3 次均稳定通过,无 flaky。
  • 未改动任何运行时源码(runtime.ts/plugin-manager.ts 等保持不动)。

说明

  • 计划中「用例 1 断言 Skill 自动加载」经实际验证不成立:小明有几分 不命中插件的自动加载正则(加/减/扣/奖励…分积分 等),只有用例 4 的「总积分…」和用例 3 的「加一分」会命中,断言已按真实行为调整。
  • npm test 运行时会由其它既有测试(classisland/iccce/secrandom)在 Linux 上生成 \tmp\… 临时文件(win32 路径写法),与本改动无关,已清理、未纳入提交。
  • 插件仓库侧(SECTL/SecScore-SecAgent-Connector)的单元测试本次未加(方案中标记为可选),如需可另行提交。

Closes #7

New%20session%20-%202026-09-01T12%3A46%3A39.482Z
opencode session  |  github run

Add secscore-connector.test.ts covering the four user-facing prompts
from the issue (query score, batch add points, group add points, top
scores) plus a duplicate-name error branch. The connector is a pure
Sync-Server client, so the tests mock both layers: the model (scripted
OpenAI-compatible SSE tool-call turns) and the SecScore backend (an
in-memory fake Sync Server implementing /v1/classes, /v1/snapshot,
/v1/sync and /v1/operations). The plugin package under test is pinned
as fixtures under src/test-fixtures/secscore-connector/ so upstream
changes to tool keys, argument names or Skill auto-load patterns fail
these tests.
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.

计划增加操作SecScore的自动化测试

0 participants