Skip to content

test(sessions): add replay consistency harness across session, memory and summary backends#162

Open
k0mondor wants to merge 5 commits into
trpc-group:mainfrom
k0mondor:feat/replay-consistency-harness
Open

test(sessions): add replay consistency harness across session, memory and summary backends#162
k0mondor wants to merge 5 commits into
trpc-group:mainfrom
k0mondor:feat/replay-consistency-harness

Conversation

@k0mondor

Copy link
Copy Markdown

Summary

This PR adds a reusable replay consistency harness for Session / Memory / Summary backends.

It replays the same deterministic cases across InMemory, SQLite, and optional Redis, then compares normalized snapshots for events, state, memory, and summaries.

Design Note

本框架使用统一 ReplayCase/ReplayStep 驱动 InMemorySQLite 与可选 Redis,回放同一条对话轨迹后抽取 event/state/memory/summary 快照做归一化比较。归一化仅消除非业务噪声,如时间戳精度、自动生成 id 与序列化顺序,不忽略真实语义差异。summary 比较分为内容语义与存储元数据两层,严格校验 session_idsummary_idversionreplaces。持久化后端在快照前支持重启读回,Redis 通过环境变量启用,轻量模式默认运行 InMemory + SQLite

Coverage

  • supports InMemory vs persistent backend comparison (SQLite, optional Redis)
  • includes the public 10 replay acceptance cases
  • detects summary missing, summary overwrite, and summary/session binding errors
  • reports diffs with field path, backend values, and session / event / summary identifiers
  • supports lightweight mode and env-controlled integration mode

How To Test

pytest tests/sessions/test_replay_consistency.py -q
TRPC_AGENT_REPLAY_REDIS_URL=redis://localhost:6379/0 pytest tests/sessions/test_replay_consistency.py -q

k0mondor added 2 commits July 11, 2026 19:13
Add reusable replay cases and backend adapters for session, memory, and summary consistency checks across InMemory, SQLite, and optional Redis.

Cover cross-session memory, mid-replay restart, and state namespace round-trips, and fix summary lineage persistence plus Redis app/user state compatibility uncovered by the new suite.
Extend replay snapshots to retain all session aliases, preserve memory query observations across restarts, and allow runtime faults to target non-active sessions.

Add cross-user isolation coverage plus targeted harness tests for duplicate query names and restart-stable memory observations.
@github-actions

github-actions Bot commented Jul 11, 2026

Copy link
Copy Markdown

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

@k0mondor

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 11, 2026
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.20879% with 8 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@e113610). Learn more about missing BASE report.

Files with missing lines Patch % Lines
trpc_agent_sdk/sessions/_sql_session_service.py 73.33333% 4 Missing ⚠️
trpc_agent_sdk/sessions/_summarizer_manager.py 93.54839% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main        #162   +/-   ##
==========================================
  Coverage        ?   87.56283%           
==========================================
  Files           ?         467           
  Lines           ?       44166           
  Branches        ?           0           
==========================================
  Hits            ?       38673           
  Misses          ?        5493           
  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.

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.

1 participant