Skip to content

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

Merged
jreakin merged 1 commit intomainfrom
test-messaging-to-supa-integration
Jan 30, 2026

Conversation

@jreakin
Copy link
Member

@jreakin jreakin commented Jan 29, 2026

  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: — 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.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Warning

Rate limit exceeded

@jreakin has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 21 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test-messaging-to-supa-integration

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Member Author

jreakin commented Jan 29, 2026

@sentry
Copy link

sentry bot commented Jan 29, 2026

Codecov Report

❌ Patch coverage is 92.18750% with 5 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/cli/setup_cli.py 88.88% 1 Missing and 1 partial ⚠️
src/services/scraper.py 0.00% 2 Missing ⚠️
src/logging_config.py 66.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_sessions and test_messages tables with proper foreign key constraints and indexes
  • Implemented create_test_session and save_test_message repository functions with appropriate error handling
  • Updated CLI _run_test_repl to 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(
Copy link

Copilot AI Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable service is not used.

Suggested change
service = MessengerAgentService(
MessengerAgentService(

Copilot uses AI. Check for mistakes.
Copy link
Member Author

jreakin commented Jan 29, 2026

Merge activity

  • Jan 29, 11:55 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jan 30, 12:05 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jan 30, 12:06 AM UTC: @jreakin merged this pull request with Graphite.

@jreakin jreakin changed the base branch from class-refactor-added-supa to graphite-base/6 January 30, 2026 00:02
@jreakin jreakin changed the base branch from graphite-base/6 to main January 30, 2026 00:03
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.
@jreakin jreakin force-pushed the test-messaging-to-supa-integration branch from d47c454 to 4a2c628 Compare January 30, 2026 00:04
@jreakin jreakin merged commit 7706378 into main Jan 30, 2026
7 checks passed
@jreakin jreakin deleted the test-messaging-to-supa-integration branch January 30, 2026 00:19
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.

2 participants