feat(tests): add Session replay consistency test harness#106
Closed
Xkzx520 wants to merge 1 commit into
Closed
Conversation
Add cross-backend replay harness with 12 replay cases, normalization pipeline, deep comparison engine, and corruption injection detection. Supports lightweight mode (InMemory vs SQLite) and integration mode via environment variables.
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request |
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.
Summary
Add a Session / Memory / Summary Replay Consistency Test Harness that validates cross-backend consistency for the core stateful components in tRPC-Agent-SDK.
Motivation
When storing session events, state, memory, and summaries across different backends (InMemory, SQL, Redis), subtle inconsistencies can arise from serialization differences, missing fields, ghost writes, or race conditions. This harness provides a systematic way to catch these issues before they reach production.
Changes
tests/sessions/replay_cases.py— 12 replay case definitions covering:function_call+function_response)tests/sessions/replay_harness.py— Core execution framework:compare_events,compare_state,compare_memory,compare_summarieswith recursive field-level diffingTRPC_REPLAY_SQL_URL,TRPC_REPLAY_REDIS_URL)tests/sessions/test_replay_consistency.py— 15 pytest test cases:Design Principles
0.0during comparison""session_id,original_event_count,compressed_event_countmust match exactlyevent.id,event.timestamp,session.last_update_time,session.save_key,summary.summary_timestampDiff Report Format
Each diff entry in
session_memory_summary_diff_report.jsoncontains:session_id— which session the diff belongs tocomponent—events,state,memory, orsummaryevent_indexorsummary_id— pinpoint the exact itemfield_path— dot-separated path (e.g.events[2].content.parts[0].text)value_a/value_b— actual values from both backendsallowed— whether this diff is an expected backend variationnote— human-readable explanationAcceptance Criteria Met
session_id,event_index/summary_id,field_path, and valuesHow to Run