SecScore 自动化测试已实现并提交,134 项全通过。 - #17
Open
opencode-agent[bot] wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
已完成 SecScore 操作的自动化测试实现并提交(分支
opencode/issue7-20260901124642,commite7c0fc5)。改动内容
新增
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注入 fakeauthBridge(getSession返回测试 token),并删除SECTL_OFFICIAL_API_URL跳过 Relay introspection。add_score可见、其余 4 个隐藏)、find_students查询、回答含 12 分add_score(score=2、reason=「昨天主动帮忙值日了」)、fake server 积分 12→14/10→12/9→11、3 条审计记录list_group_members("一组")后逐个add_score(1)、一组 4 人各 +1、二组不变secscore-connector/secscore出现在首个模型请求系统消息)、只查询不加分、回答只含 55/60 分者新增
src/test-fixtures/secscore-connector/:插件三件套副本(main.mjs、secagent-plugin.jsonv2.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 用例)。runtime.ts/plugin-manager.ts等保持不动)。说明
小明有几分不命中插件的自动加载正则(加/减/扣/奖励…分、积分等),只有用例 4 的「总积分…」和用例 3 的「加一分」会命中,断言已按真实行为调整。npm test运行时会由其它既有测试(classisland/iccce/secrandom)在 Linux 上生成\tmp\…临时文件(win32 路径写法),与本改动无关,已清理、未纳入提交。SECTL/SecScore-SecAgent-Connector)的单元测试本次未加(方案中标记为可选),如需可另行提交。Closes #7
opencode session | github run