chore #14740: remove claude config and customer selection

Summaries are not coming to the desktop app, and the customer is chosen
in the web UI after the upload:
- drop the Anthropic key (Service::Anthropic, Settings field) and delete
  a leftover keyring entry best-effort at startup
- drop the Summary model, the store's summary accessors and the
  "Zusammenfassung" tab; the transcript is the detail's only content
- drop the mocked customer accounts, list_accounts/set_account and the
  "Kunde" dropdown; calls.account_id and summaries stay in the schema

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hauke
2026-11-06 14:35:41 +01:00
co-authored by Claude Opus 5.5
parent eff07d2f59
commit 54a81e5ba0
16 changed files with 72 additions and 417 deletions
-82
View File
@@ -1,82 +0,0 @@
//! Customer accounts a call can be assigned to (the "Kunde" dropdown).
//!
//! A static mock for now: the names are clearly fictional placeholders
//! until the account system is connected.
use serde::Serialize;
/// A customer account. `id` is what a call stores as its `account_id`.
#[derive(Serialize, Clone, Copy, Debug, PartialEq, Eq)]
pub struct Account {
pub id: &'static str,
pub name: &'static str,
}
const MOCK_ACCOUNTS: [Account; 5] = [
Account {
id: "mock-1",
name: "Weingut Beispiel GmbH",
},
Account {
id: "mock-2",
name: "Weinhandel Muster KG",
},
Account {
id: "mock-3",
name: "Vinothek Probe",
},
Account {
id: "mock-4",
name: "Kellerei Test eG",
},
Account {
id: "mock-5",
name: "Restaurant Platzhalter",
},
];
/// All accounts, in display order.
pub fn list() -> Vec<Account> {
MOCK_ACCOUNTS.to_vec()
}
/// Whether `id` names one of the accounts.
pub fn exists(id: &str) -> bool {
MOCK_ACCOUNTS.iter().any(|account| account.id == id)
}
#[cfg(test)]
mod tests {
use std::collections::HashSet;
use super::*;
#[test]
fn mock_accounts_are_stable_and_unique() {
let accounts = list();
let names: Vec<_> = accounts.iter().map(|a| a.name).collect();
assert_eq!(
names,
[
"Weingut Beispiel GmbH",
"Weinhandel Muster KG",
"Vinothek Probe",
"Kellerei Test eG",
"Restaurant Platzhalter",
]
);
let ids: HashSet<_> = accounts.iter().map(|a| a.id).collect();
assert_eq!(ids.len(), 5);
// Stored with the calls, so they must never change.
assert_eq!(accounts[0].id, "mock-1");
assert_eq!(accounts[4].id, "mock-5");
assert_eq!(list(), accounts);
}
#[test]
fn only_listed_accounts_exist() {
assert!(exists("mock-3"));
assert!(!exists("mock-6"));
assert!(!exists(""));
}
}
+1 -6
View File
@@ -45,13 +45,12 @@ pub fn duration_secs(call: &Call) -> i64 {
}
/// The selected call's header data: its list row plus the error of a
/// failed run and the assigned account.
/// failed run.
#[derive(Serialize, Clone, Debug, PartialEq)]
pub struct CallHeader {
#[serde(flatten)]
pub item: CallListItem,
pub error: Option<String>,
pub account_id: Option<String>,
}
/// A transcript line with the speaker's display label.
@@ -115,7 +114,6 @@ impl CallDetail {
call: CallHeader {
item: CallListItem::of(call),
error: call.error.clone(),
account_id: call.account_id.clone(),
},
segments,
merges: merge_views(merges, &speaker_names),
@@ -176,7 +174,6 @@ mod tests {
out_path: PathBuf::from("7-out.wav"),
transcribed_at: None,
audio_deleted: false,
account_id: None,
title: None,
}
}
@@ -330,7 +327,6 @@ mod tests {
let mut c = call(Some(at(10, 15, 0)));
c.status = CallStatus::Failed;
c.error = Some("Netzwerkfehler".into());
c.account_id = Some("mock-2".into());
c.title = Some("Reklamation".into());
let merges = keys(&[("remote:2", "remote:1")]);
@@ -349,7 +345,6 @@ mod tests {
"interrupted": false,
"title": "Reklamation",
"error": "Netzwerkfehler",
"account_id": "mock-2",
},
"segments": [],
"speaker_names": {},
+4 -5
View File
@@ -1,7 +1,6 @@
//! The HTTP transport seam: every outgoing request the DeepScript and Claude
//! clients (Tasks 12/13) make goes through [`HttpTransport`], so unit tests
//! can swap in [`crate::testing::FakeTransport`] and run with the network
//! unplugged. [`ReqwestTransport`] is the real implementation, exercised only
//! The HTTP transport seam: every outgoing request the API clients make goes
//! through [`HttpTransport`], so unit tests can swap in
//! [`crate::testing::FakeTransport`] and run with the network unplugged. [`ReqwestTransport`] is the real implementation, exercised only
//! by the live integration suite (`crates/core/tests/live_api.rs`).
use std::path::PathBuf;
@@ -101,7 +100,7 @@ pub trait HttpTransport: Send + Sync {
/// Live `HttpTransport` backed by `reqwest` (rustls). Shares one
/// `reqwest::Client` (connection pooling) with a 10 minute request timeout
/// and a 30 second connect timeout, matching the Claude/DeepScript clients'
/// and a 30 second connect timeout, matching the DeepScript client's
/// worst-case wait.
pub struct ReqwestTransport {
client: reqwest::Client,
+3 -4
View File
@@ -1,10 +1,9 @@
//! Core domain logic for the Gesprächsrekorder call recorder.
//!
//! This crate will grow to hold call detection, recording orchestration,
//! transcription and summarization logic, kept independent of the Tauri
//! application shell so it can be unit-tested without a GUI or network.
//! Call detection, recording orchestration and transcription, kept
//! independent of the Tauri application shell so it can be unit-tested
//! without a GUI or network.
pub mod accounts;
pub mod audio;
pub mod call_view;
pub mod capture;
+1 -37
View File
@@ -3,7 +3,7 @@
use std::path::PathBuf;
use chrono::{DateTime, Local, NaiveDate};
use chrono::{DateTime, Local};
use serde::{Deserialize, Serialize};
/// Primary key of a `calls` row (SQLite `rowid`).
@@ -37,7 +37,6 @@ pub struct Call {
pub out_path: PathBuf,
pub transcribed_at: Option<DateTime<Local>>,
pub audio_deleted: bool,
pub account_id: Option<String>,
/// The name the user gave the call, if any.
pub title: Option<String>,
}
@@ -97,38 +96,3 @@ pub struct Segment {
pub end: f64,
pub text: String,
}
/// Who owns a to-do coming out of the call summary.
#[derive(Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum Owner {
Ich,
Kunde,
Sonstige,
}
/// A single action item extracted from the call summary.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct Todo {
pub text: String,
pub owner: Owner,
pub faellig: Option<NaiveDate>,
#[serde(default)]
pub erledigt: bool,
}
/// The next agreed point of contact, if any.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Default)]
pub struct NaechsterKontakt {
pub datum: Option<NaiveDate>,
pub notiz: Option<String>,
}
/// Structured summary produced by Claude for a finished call.
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct Summary {
pub kernpunkte: Vec<String>,
pub vereinbarungen: Vec<String>,
pub todos: Vec<Todo>,
pub naechster_kontakt: NaechsterKontakt,
}
-1
View File
@@ -108,7 +108,6 @@ async fn run(
// Jobs whose delete failed in an earlier run.
delete_remote_jobs(store, tr, id).await;
}
// SUMMARY SEAM (Task 14b): summarize here.
store.set_status(id, CallStatus::Done, None)?;
log::info!("call {id}: done");
Ok(())
+1 -2
View File
@@ -10,7 +10,7 @@ use crate::model::{Call, CallId, CallStatus};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum RetentionAction {
/// Delete the call's audio file(s) on disk; the row stays (it has a
/// summary/transcript worth keeping).
/// transcript worth keeping).
DeleteAudio(CallId),
/// Delete the whole call row (and everything derived from it).
DeleteCall(CallId),
@@ -88,7 +88,6 @@ mod tests {
out_path: PathBuf::from("/tmp/out.wav"),
transcribed_at: None,
audio_deleted: false,
account_id: None,
title: None,
}
}
+29 -4
View File
@@ -15,7 +15,6 @@ pub const KEYRING_SERVICE: &str = "eu.euvino.callrecorder";
#[serde(rename_all = "lowercase")]
pub enum Service {
DeepScript,
Anthropic,
}
impl Service {
@@ -23,7 +22,6 @@ impl Service {
pub fn user(self) -> &'static str {
match self {
Service::DeepScript => "deepscript",
Service::Anthropic => "anthropic",
}
}
}
@@ -45,6 +43,10 @@ pub trait SecretStore: Send + Sync {
fn delete(&self, s: Service) -> Result<()>;
}
/// Keyring users of keys that earlier versions stored and this one no
/// longer uses: the Anthropic key of the dropped Claude summary.
const UNUSED_USERS: [&str; 1] = ["anthropic"];
/// The OS keyring.
pub struct KeyringSecrets;
@@ -53,6 +55,21 @@ impl KeyringSecrets {
keyring::Entry::new(KEYRING_SERVICE, s.user())
.map_err(|e| SecretError::Keyring(e.to_string()))
}
/// Best-effort deletes the keys earlier versions stored and this one no
/// longer uses, so no stale secret lingers in the keyring. Missing
/// entries and failures are only logged (never the key).
pub fn remove_unused_keys() {
for user in UNUSED_USERS {
let result =
keyring::Entry::new(KEYRING_SERVICE, user).and_then(|e| e.delete_credential());
match result {
Ok(()) => log::info!("removed the unused keyring entry {user:?}"),
Err(keyring::Error::NoEntry) => {}
Err(e) => log::info!("could not remove the unused keyring entry {user:?}: {e}"),
}
}
}
}
impl SecretStore for KeyringSecrets {
@@ -100,6 +117,8 @@ impl SecretStore for MemorySecrets {
mod tests {
use super::*;
const SERVICES: &[Service] = &[Service::DeepScript];
#[test]
fn memory_secrets_roundtrip() {
let secrets = MemorySecrets::default();
@@ -107,16 +126,22 @@ mod tests {
secrets.set(Service::DeepScript, "ds-key").unwrap();
assert_eq!(secrets.get(Service::DeepScript).as_deref(), Some("ds-key"));
assert_eq!(secrets.get(Service::Anthropic), None);
secrets.delete(Service::DeepScript).unwrap();
assert_eq!(secrets.get(Service::DeepScript), None);
secrets.delete(Service::DeepScript).unwrap();
}
#[test]
fn unused_keys_never_include_a_key_in_use() {
for &s in SERVICES {
assert!(!UNUSED_USERS.contains(&s.user()), "{s:?}");
}
}
#[test]
fn service_serializes_as_keyring_user() {
for s in [Service::DeepScript, Service::Anthropic] {
for &s in SERVICES {
let json = serde_json::to_string(&s).unwrap();
assert_eq!(json, format!("\"{}\"", s.user()));
assert_eq!(serde_json::from_str::<Service>(&json).unwrap(), s);
+18 -104
View File
@@ -1,5 +1,5 @@
//! SQLite-backed persistence for calls, their transcripts, summaries,
//! speaker renames and outstanding remote transcription/summary jobs.
//! SQLite-backed persistence for calls, their transcripts, speaker renames
//! and merges, and outstanding remote transcription jobs.
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
@@ -10,7 +10,7 @@ use rusqlite::{params, Connection, Row, TransactionBehavior};
use thiserror::Error;
use crate::merge::{self, MergeError};
use crate::model::{Call, CallId, CallStatus, Segment, Speaker, Summary};
use crate::model::{Call, CallId, CallStatus, Segment, Speaker};
/// Longest call title, in characters.
const MAX_TITLE_CHARS: usize = 120;
@@ -22,8 +22,8 @@ pub enum StoreError {
Sqlite(#[from] rusqlite::Error),
/// A value read back from SQLite could not be interpreted, e.g. an
/// unknown `status` string, invalid RFC 3339 timestamp, unparsable
/// speaker key or malformed summary JSON.
/// unknown `status` string, invalid RFC 3339 timestamp or unparsable
/// speaker key.
#[error("corrupt stored value: {0}")]
Corrupt(String),
@@ -51,7 +51,9 @@ pub struct RecoveryReport {
pub failed: Vec<CallId>,
}
/// Version 1: the first release.
/// Version 1: the first release. `calls.account_id` (the customer mock) and
/// `summaries` are no longer used; they stay so no migration has to drop
/// them.
const SCHEMA_V1_SQL: &str = "
CREATE TABLE IF NOT EXISTS calls (
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -152,8 +154,8 @@ impl Store {
let conn = self.conn.lock().unwrap();
conn.execute(
"INSERT INTO calls \
(app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, account_id) \
VALUES (?1, ?2, NULL, ?3, 0, NULL, ?4, ?5, NULL, 0, NULL)",
(app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted) \
VALUES (?1, ?2, NULL, ?3, 0, NULL, ?4, ?5, NULL, 0)",
params![
app,
dt_to_str(started_at),
@@ -271,33 +273,6 @@ impl Store {
Ok(segments)
}
pub fn save_summary(&self, id: CallId, summary: &Summary, edited: bool) -> Result<()> {
let conn = self.conn.lock().unwrap();
let json = serde_json::to_string(summary)
.map_err(|e| StoreError::Corrupt(format!("failed to serialize summary: {e}")))?;
conn.execute(
"INSERT INTO summaries (call_id, json, edited) VALUES (?1, ?2, ?3) \
ON CONFLICT(call_id) DO UPDATE SET json = excluded.json, edited = excluded.edited",
params![id, json, edited],
)?;
Ok(())
}
pub fn summary(&self, id: CallId) -> Result<Option<Summary>> {
let conn = self.conn.lock().unwrap();
let mut stmt = conn.prepare("SELECT json FROM summaries WHERE call_id = ?1")?;
let mut rows = stmt.query(params![id])?;
match rows.next()? {
Some(row) => {
let json: String = row.get(0)?;
let summary = serde_json::from_str(&json)
.map_err(|e| StoreError::Corrupt(format!("invalid summary json: {e}")))?;
Ok(Some(summary))
}
None => Ok(None),
}
}
pub fn set_speaker_name(&self, id: CallId, speaker_key: &str, name: &str) -> Result<()> {
let conn = self.conn.lock().unwrap();
conn.execute(
@@ -398,8 +373,9 @@ impl Store {
Ok(())
}
/// Deletes a call and every row derived from it (segments, summary,
/// speaker names and merges, remote jobs).
/// Deletes a call and every row derived from it (segments, speaker
/// names and merges, remote jobs; also the `summaries` table of schema
/// v1, which nothing writes).
pub fn delete_call(&self, id: CallId) -> Result<()> {
let mut conn = self.conn.lock().unwrap();
let tx = conn.transaction()?;
@@ -413,15 +389,6 @@ impl Store {
Ok(())
}
pub fn set_account(&self, id: CallId, account_id: Option<&str>) -> Result<()> {
let conn = self.conn.lock().unwrap();
conn.execute(
"UPDATE calls SET account_id = ?1 WHERE id = ?2",
params![account_id, id],
)?;
Ok(())
}
pub fn record_remote_job(&self, id: CallId, track: &str, remote_id: &str) -> Result<()> {
let conn = self.conn.lock().unwrap();
conn.execute(
@@ -470,7 +437,7 @@ impl Store {
/// `AwaitingDecision`, with `interrupted` set and `ended_at` set to now
/// if it was not already set (a later pass corrects it from the WAV
/// length).
/// - `Processing` calls were mid-transcription/summarization: they move
/// - `Processing` calls were mid-transcription: they move
/// to `Failed` with a fixed error message.
///
/// Both updates run in a single transaction.
@@ -547,9 +514,9 @@ fn ids_with_status(conn: &rusqlite::Connection, status: CallStatus) -> Result<Ve
Ok(ids)
}
const SELECT_ALL_CALLS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, account_id, title FROM calls";
const SELECT_ALL_CALLS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, title FROM calls";
const SELECT_CALL_COLUMNS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, account_id, title FROM calls WHERE id = ?1";
const SELECT_CALL_COLUMNS_SQL: &str = "SELECT id, app, started_at, ended_at, status, interrupted, error, mic_path, out_path, transcribed_at, audio_deleted, title FROM calls WHERE id = ?1";
fn row_to_call(row: &Row) -> Result<Call> {
let id: CallId = row.get(0)?;
@@ -563,8 +530,7 @@ fn row_to_call(row: &Row) -> Result<Call> {
let out_path: String = row.get(8)?;
let transcribed_at: Option<String> = row.get(9)?;
let audio_deleted: bool = row.get(10)?;
let account_id: Option<String> = row.get(11)?;
let title: Option<String> = row.get(12)?;
let title: Option<String> = row.get(11)?;
Ok(Call {
id,
@@ -578,7 +544,6 @@ fn row_to_call(row: &Row) -> Result<Call> {
out_path: PathBuf::from(out_path),
transcribed_at: opt_dt_from_str(transcribed_at)?,
audio_deleted,
account_id,
title,
})
}
@@ -637,9 +602,7 @@ mod tests {
use chrono::Local;
use crate::model::{
CallId, CallStatus, NaechsterKontakt, Owner, Segment, Speaker, Summary, Todo,
};
use crate::model::{CallId, CallStatus, Segment, Speaker};
use crate::store::Store;
/// The schema of user_version 1, exactly as the first release created
@@ -754,7 +717,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs (
let call = store.get_call(1).unwrap().expect("call kept");
assert_eq!(call.app, "Microsoft Teams");
assert_eq!(call.status, CallStatus::Done);
assert_eq!(call.account_id.as_deref(), Some("mock-2"));
assert_eq!(call.mic_path, PathBuf::from("/rec/1-mic.wav"));
assert_eq!(call.title, None);
let texts: Vec<_> = store
@@ -939,38 +901,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs (
assert_eq!(store.segments(id).unwrap(), second);
}
#[test]
fn summary_roundtrip_with_null_dates() {
let store = Store::open_in_memory().unwrap();
let id = store
.create_call(
"teams.exe",
Local::now(),
Path::new("/tmp/mic.wav"),
Path::new("/tmp/out.wav"),
)
.unwrap();
assert_eq!(store.summary(id).unwrap(), None);
let summary = Summary {
kernpunkte: vec!["Punkt 1".to_string()],
vereinbarungen: vec!["Angebot folgt".to_string()],
todos: vec![Todo {
text: "Angebot schicken".to_string(),
owner: Owner::Ich,
faellig: None,
erledigt: false,
}],
naechster_kontakt: NaechsterKontakt {
datum: None,
notiz: None,
},
};
store.save_summary(id, &summary, false).unwrap();
assert_eq!(store.summary(id).unwrap(), Some(summary));
}
#[test]
fn speaker_names_upsert() {
let store = Store::open_in_memory().unwrap();
@@ -1167,21 +1097,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs (
}],
)
.unwrap();
store
.save_summary(
id,
&Summary {
kernpunkte: vec![],
vereinbarungen: vec![],
todos: vec![],
naechster_kontakt: NaechsterKontakt {
datum: None,
notiz: None,
},
},
false,
)
.unwrap();
store.set_speaker_name(id, "me", "Ich").unwrap();
store.set_speaker_merge(id, "remote:2", "remote:1").unwrap();
store
@@ -1192,7 +1107,6 @@ CREATE TABLE IF NOT EXISTS remote_jobs (
assert_eq!(store.get_call(id).unwrap(), None);
assert_eq!(store.segments(id).unwrap(), Vec::new());
assert_eq!(store.summary(id).unwrap(), None);
assert_eq!(store.speaker_names(id).unwrap(), BTreeMap::new());
assert_eq!(store.remote_jobs(id).unwrap(), Vec::new());
assert_eq!(store.speaker_merges(id).unwrap(), BTreeMap::new());