Skip to content

test: four-model review-report sample for audit fixtures - #2

Merged
wangcan26 merged 1 commit into
creativedswork:mainfrom
yangfei222666-9:fix/add-audit-fixtures
Aug 19, 2026
Merged

wangcan26 merged 1 commit into
creativedswork:mainfrom
yangfei222666-9:fix/add-audit-fixtures

Conversation

@yangfei222666-9

Copy link
Copy Markdown
Contributor

按 Issue #1 确认的契约提交(参见 #1 及 wangcan26 的确认评论)。

内容

新增 tests/fixtures/audit/ 首批四类 fixture,以及消费它们的测试 tests/audit-fixtures.test.mjs:

fixture 断言
fx-04 Loader 不得静默丢记录 archive/experience/ 出现损坏 JSON 或未知版本记录时,list() 必须报错并列出相对路径,而不是跳过
fx-05 单记录原子写入/中断恢复 .tmp 残留不得被读作记录、不得造成数据丢失;正常写入只落一个完整 .json
fx-07 无合格证据不能从 candidate 升级 四模型 review-report 单独作为 evidence 时,claim 停在 candidate 且无 verification
fx-08 删除后只留最小 tombstone tombstone 仅含 id + deletedAt + reasonCode,不含正文与证据

另附一份脱敏 review-report 样本:schemaVersion 为 review-report@1,证据链接保存 schemaVersion / reportId / location / sha256 / targetSha256(location 与哈希双保留);内容全部用占位符,不含任何真实私有数据,哈希为全零占位。

与真实 API 的关系(如实说明)

  • fx-04 / fx-05 已由当前 FileExperienceArchive 实现,测试对照真实 API 行为断言,pnpm test 全绿(8/8)。
  • fx-07 / fx-08 属于 0.3.0 Schema(candidate 状态机、tombstone)的输入契约,当前 0.2.0 运行时尚未实现(现有 expmem_forget 为硬删除、无状态机),故这两类 fixture 目前只校验数据契约,运行时断言待 0.3.0 落地后再接入。

Refs #1

@wangcan26

Copy link
Copy Markdown

@yangfei222666-9,已审阅。这个 PR 先保持开放,请基于当前 main rebase 后改成增量贡献。

PR 创建后,ExpMem 0.3.0 已发布,主分支已经加入 tests/audit-fixtures.test.mjs 和 fx-04/05/07/08 的运行时 fixture。因此当前分支存在 add/add 冲突,原测试放到 0.3.0 上时,fx-04 也会因 Loader 契约变化而失败。

建议这样调整:

  1. 保留这次提交中有增量价值的四模型 review-report 样本,将它合并到现有 tests/fixtures/audit/review-report-v1/report.json。
  2. 保持外部 report 和 ExpMem evidence link 分文件;根据脱敏 report 的准确字节更新 evidence-link.json.sha256,并用 claimSha256() 生成真实的 targetSha256。
  3. 在现有 audit test 中补充四个 provider、verdict 和 cannotClaim 的结构断言。
  4. 删除重复的 fx-04/05/07/08 目录和整份替换版 audit-fixtures.test.mjs,主分支已经通过真实 API 覆盖这些行为。

对齐最终 Schema 时请注意:记录字段是 evidence,并要求 authoredBy;每条 evidence 需要 id 和 observedAt。tombstone 包含 schemaVersion / id / kind / deletedAt / reasonCode,合法 reason code 包括 user-request,不包括 user-requested。

这样改完后,这个 PR 会成为对 0.3.0 外部审计报告样本的有效补充,而不会重复或削弱现有运行时测试。

Replace the placeholder reviewer with the four-model review (glm-5, claude-opus-5, gemini-3.1-pro, codex), re-bind evidence-link.json.sha256 to the exact report bytes, and assert the four providers, verdicts, and cannotClaim lists in the existing audit test.
@yangfei222666-9

Copy link
Copy Markdown
Contributor Author

@wangcan26 已按你的审阅意见改成增量贡献:

  1. 基于当前 main rebase 完成,add/add 冲突已解决(测试文件保留 0.3.0 版本)。
  2. 四模型 review-report 样本已合并进 tests/fixtures/audit/review-report-v1/report.json(glm-5 / claude-opus-5 / gemini-3.1-pro / codex,verdictCounts 同步为 support 1 / mixed 3)。外部 report 与 ExpMem evidence link 保持分文件:evidence-link.json.sha256 已按脱敏 report 的准确字节更新为 sha256:98c951c6…,targetSha256 用 claimSha256() 生成(与固定 claim 一致,未变)。
  3. 在现有 audit test 的 review-report 用例内补了四个 provider、verdict 与 cannotClaim 的结构断言,未整份替换测试文件。
  4. 删除了我们重复的 fx-04/05/07/08 目录、review-report.sample.json 与整份替换版 audit-fixtures.test.mjs。

本地 pnpm run check 全绿(typecheck + build + 12/12 测试)。请再 review。

@yangfei222666-9 yangfei222666-9 changed the title test: audit fixtures fx-04/05/07/08 + review-report sample test: four-model review-report sample for audit fixtures Aug 19, 2026

@wangcan26 wangcan26 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审通过。已核对 report 的准确字节哈希和 targetSha256,本地 pnpm run check 与 GitHub CI 均通过。四模型样本现在是基于 0.3.0 的干净增量,可以合入。

@wangcan26
wangcan26 merged commit 84b7c87 into creativedswork:main Aug 19, 2026
1 check passed
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.

2 participants