Session/Memory/Summary 跨后端回放一致性测试框架的添加#117
Open
ZUNr1 wants to merge 6 commits into
Open
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #117 +/- ##
==========================================
Coverage ? 87.51506%
==========================================
Files ? 467
Lines ? 44005
Branches ? 0
==========================================
Hits ? 38511
Misses ? 5494
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Author
|
I have read the CLA Document and I hereby sign the CLA |
Rook1ex
added a commit
to trpc-group/cla-database
that referenced
this pull request
Jul 4, 2026
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.
Closes #89
新增了一个跨后端回放一致性测试框架,用于验证 InMemory / SQL / Redis 三种后端在 Session、Memory、Summary 三个维度上是否行为一致。
交付物
tests/sessions/harness/ — 7 个模块组成的测试框架(loader、executor、snapshot、normalizer、comparator、allowed_diff、diff_report)
tests/sessions/replay_cases/ — 18 条标准化 JSONL 操作轨迹,覆盖单轮对话、多轮对话、工具调用、state 更新、memory 读写、summary 生成和更新、事件截断、重复写入、异常恢复、多 session 隔离、大量事件等场景
tests/sessions/test_replay_consistency.py — 主测试,参数化回放 18 条 case 并做跨后端对比,同时包含 8 个注入不一致检测测试
tests/sessions/test_replay_consistency_extra.py — 66 个补充测试,覆盖 Normalizer、Comparator、DiffReport、ReplayLoader、BackendExecutor 的边界情况
tests/sessions/session_memory_summary_diff_report.json — 自动生成的差异报告,可定位到 session_id、event_index、field_path 和两个后端的具体值
用法
轻量模式,仅 InMemory,< 0.3s
pytest tests/sessions/test_replay_consistency.py -v
集成 SQL(自动使用 SQLite,无需外部数据库)
pytest tests/sessions/test_replay_consistency.py -v --run-sql
集成 Redis(需配置环境变量)
pytest tests/sessions/test_replay_consistency.py -v --run-redis