Create the `chat_store` module with extracted chat-persistence methods
Intent: Move all chat-related database methods out of `storage.rs` into a focused `chat_store.rs` file so that chat persistence concerns are isolated in their own module. The new file adds an `impl Store` block containing the ten relocated methods.
Affected files: crates/pika-news/src/chat_store.rs
@@ -0,0 +1,258 @@
+use anyhow::Context;
+use rusqlite::{params, OptionalExtension};
+
+use crate::storage::{ChatMessage, Store};
+
+impl Store {
A new file crates/pika-news/src/chat_store.rs is introduced containing a single impl Store block. It imports ChatMessage and Store from crate::storage and re-implements the following ten public methods exactly as they appeared in storage.rs:
| Method | Purpose |
|---|---|
get_artifact_session_id | Fetch the Claude session ID for the current ready artifact of a PR |
get_or_create_chat_session | Find or create a per-user chat session for a PR artifact, returning history |
get_branch_review_artifact_session_id | Fetch the Claude session ID for a branch-review artifact |
get_or_create_branch_review_chat_session | Find or create a per-user chat session for a branch-review artifact |
get_chat_claude_session_id | Look up the Claude session ID from a PR chat session row |
get_branch_review_chat_claude_session_id | Look up the Claude session ID from a branch chat session row |
update_chat_claude_session_id | Update the Claude session ID on a PR chat session |
update_branch_review_chat_claude_session_id | Update the Claude session ID on a branch chat session |
append_chat_message | Insert a new message into a PR chat session |
append_branch_review_chat_message | Insert a new message into a branch-review chat session |
All SQL queries, parameter bindings, error contexts, and return types are identical to the originals — no behavioral change.