Skip to content

Session/Memory/Summary 跨后端回放一致性测试框架的添加#117

Open
ZUNr1 wants to merge 6 commits into
trpc-group:mainfrom
ZUNr1:main
Open

Session/Memory/Summary 跨后端回放一致性测试框架的添加#117
ZUNr1 wants to merge 6 commits into
trpc-group:mainfrom
ZUNr1:main

Conversation

@ZUNr1

@ZUNr1 ZUNr1 commented Jul 4, 2026

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@530a5b3). Learn more about missing BASE report.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ZUNr1

ZUNr1 commented Jul 4, 2026

Copy link
Copy Markdown
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
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.

构建 Session / Memory 多后端回放一致性测试框架

2 participants