Summary of what was implemented: 1. Migration – test_sessions: id, reference_doc_id, source_url, tone, created_at (FK → reference_documents). test_messages: id, test_session_id, user_message, response_text, confidence, requires_escalation, escalation_reas#6
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR implements test conversation persistence for the CLI test REPL, allowing test interactions to be saved to Supabase for later inspection. The PR also includes extensive code formatting improvements (Black/Ruff).
Changes:
- Added database migration for
test_sessionsandtest_messagestables with proper foreign key constraints and indexes - Implemented
create_test_sessionandsave_test_messagerepository functions with appropriate error handling - Updated CLI
_run_test_replto create sessions and persist messages, with graceful degradation when Supabase is unavailable - Added comprehensive test coverage for new functionality
- Updated documentation (RUNBOOK and README) to explain the new feature
- Applied Black/Ruff formatting across the entire test suite
Reviewed changes
Copilot reviewed 38 out of 40 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| migrations/004_test_conversations.sql | New migration creating test_sessions and test_messages tables with proper indexes |
| src/db/repository.py | Added create_test_session (raises on error) and save_test_message (logs but doesn't raise) |
| src/cli/setup_cli.py | Updated _run_test_repl to accept reference_doc_id and source_url, create sessions, and persist messages |
| tests/unit/test_repository.py | Comprehensive tests for new repository functions |
| tests/unit/test_setup_cli.py | Tests for CLI persistence behavior (success and failure cases) |
| tests/unit/* | Black/Ruff formatting improvements across all test files |
| RUNBOOK.md | New section documenting test REPL persistence feature |
| README.md | Note about test conversation persistence in CLI setup section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| service = MessengerAgentService(model="gateway/anthropic:claude-3-5-sonnet-latest") | ||
|
|
||
|
|
||
| service = MessengerAgentService( |
There was a problem hiding this comment.
Variable service is not used.
| service = MessengerAgentService( | |
| MessengerAgentService( |
a46bad0 to
42e3379
Compare
42e3379 to
4ce9fb0
Compare
4ce9fb0 to
6495d86
Compare
6495d86 to
4a86139
Compare
4a86139 to
d47c454
Compare
1. Migration – test_sessions: id, reference_doc_id, source_url, tone, created_at (FK → reference_documents). test_messages: id, test_session_id, user_message, response_text, confidence, requires_escalation, escalation_reason, created_at (FK → test_sessions). Indexes on reference_doc_id, created_at, test_session_id. 2. Repository – create_test_session(reference_doc_id, source_url, tone) -> str: inserts into test_sessions, returns session id; raises on failure. save_test_message(...): inserts into test_messages; logs errors and does not re-raise so the REPL keeps running if Supabase fails. 3. CLI – _run_test_repl now takes reference_doc_id and source_url. Before the loop: creates a test session, prints Session ID: <uuid> — view in Supabase: test_sessions / test_messages, or a warning if creation fails. After each successful exchange: calls save_test_message when session_id is set. Both “Test the bot” (setup) and setup test pass reference_doc_id and sourceest_repl. 4. Tests Repository: TestCreateTestSession (success + failure), TestSaveTestMessage (all fields + no raise on Supabase error) in . Setup CLI: _run_test_repl assert updates in test_setup_test_bot_then_continue and test_test_cmd_with_ref_doc_runs_repl; new TestRunTestReplPersistence with test_create_test_session_and_save_test_message_called and test_when_create_test_session_fails_no_save_test_message in . 5. Docs RUNBOOK: New “Test REPL conversation persistence” under Debug Commands (tables, session ID, how to view in Supabase, behavior when Supabase is down). README: Note in CLI Setup that “Test the bot” and setup test persist conversations to test_sessions / test_messages for inspection in Supabase.
d47c454 to
4a2c628
Compare

test_sessions: id, reference_doc_id, source_url, tone, created_at (FK → reference_documents).
test_messages: id, test_session_id, user_message, response_text, confidence, requires_escalation, escalation_reason, created_at (FK → test_sessions).
Indexes on reference_doc_id, created_at, test_session_id.
create_test_session(reference_doc_id, source_url, tone) -> str: inserts into test_sessions, returns session id; raises on failure.
save_test_message(...): inserts into test_messages; logs errors and does not re-raise so the REPL keeps running if Supabase fails.
_run_test_repl now takes reference_doc_id and source_url.
Before the loop: creates a test session, prints Session ID: — view in Supabase: test_sessions / test_messages, or a warning if creation fails.
After each successful exchange: calls save_test_message when session_id is set.
Both “Test the bot” (setup) and setup test pass reference_doc_id and sourceest_repl.
Repository: TestCreateTestSession (success + failure), TestSaveTestMessage (all fields + no raise on Supabase error) in .
Setup CLI: _run_test_repl assert updates in test_setup_test_bot_then_continue and test_test_cmd_with_ref_doc_runs_repl; new TestRunTestReplPersistence with test_create_test_session_and_save_test_message_called and test_when_create_test_session_fails_no_save_test_message in .
RUNBOOK: New “Test REPL conversation persistence” under Debug Commands (tables, session ID, how to view in Supabase, behavior when Supabase is down).
README: Note in CLI Setup that “Test the bot” and setup test persist conversations to test_sessions / test_messages for inspection in Supabase.