sessions:构建 Session / Memory / Summary 多后端回放一致性框架#163
Open
shsaihdsaiudh wants to merge 2 commits into
Open
Conversation
Add deterministic Session, Memory, and Summary replay cases for in-memory, SQLite, and optional Redis backends. Fix summary ordering across SQL round trips and decode Redis state hashes without losing JSON value types.\n\nFixes trpc-group#89\n\nRELEASE NOTES: NONE
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
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 12, 2026
Author
Docker Redis 三后端回放实测日志以下日志对应 PR 最新提交 同时在本地执行了与 CI 相同的检查: 展开完整 Docker Redis 测试日志 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #163 +/- ##
==========================================
Coverage ? 87.55921%
==========================================
Files ? 467
Lines ? 44121
Branches ? 0
==========================================
Hits ? 38632
Misses ? 5489
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Use an explicit branch for the retained-event timestamp anchor so flake8 W504 passes without changing behavior.\n\nUpdates trpc-group#89\n\nRELEASE NOTES: NONE
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.
背景
生产环境可能从 InMemory 切换到 SQL 或 Redis。不同后端若在事件顺序、state、memory 或 summary 语义上不一致,会导致上下文回放、长期记忆和摘要更新异常。本 PR 完成 issue #89 要求的可复用回放一致性框架,并修复框架通过真实后端测试发现的两个问题。
做了什么
tests/sessions/replay_harness.py,使用同一组标准操作驱动 Session 与 Memory 后端,生成规范化快照并递归比较字段。allowed_diff必须逐项声明路径及原因。session_memory_summary_diff_report.json和 150–300 字设计说明。同时修复的问题
HGETALL返回 bytes,原实现直接拼接字符串 state 前缀会触发TypeError。现在在服务边界解码键,并用 JSON 编解码 state 值,保留布尔、数字、对象等类型。运行模式
TRPC_REPLAY_LIGHTWEIGHT=1 pytest -q tests/sessions/test_replay_consistency.pyTRPC_REPLAY_REDIS_URL后加入 Redis;本 PR 使用 Dockerredis:7-alpine实测。测试结果
Fixes #89
RELEASE NOTES: NONE