MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / seed_legacy_rows

Function seed_legacy_rows

tests/session_suite/transcript_backfill.rs:96–119  ·  view source on GitHub ↗

Seeds legacy rows and clears the backfill marker so the next open re-runs the pass against them (a fresh store marks itself done immediately because it has nothing to backfill).

(
    project: &std::path::Path,
    provider: &str,
    messages: &[SessionMessageRecord],
)

Source from the content-addressed store, hash-verified

94/// the pass against them (a fresh store marks itself done immediately because
95/// it has nothing to backfill).
96async fn seed_legacy_rows(
97 project: &std::path::Path,
98 provider: &str,
99 messages: &[SessionMessageRecord],
100) {
101 let db = open_project_session_db(project).await.unwrap();
102 assert!(db.upsert_session(&session(provider)).await);
103 for message in messages {
104 assert!(db.upsert_session_message(message).await);
105 }
106 drop(db);
107
108 let raw = libsql::Builder::new_local(project_session_db_path(project))
109 .build()
110 .await
111 .unwrap();
112 let conn = raw.connect().unwrap();
113 conn.execute(
114 "DELETE FROM session_schema_migrations WHERE name = 'transcript_facts_backfill'",
115 (),
116 )
117 .await
118 .unwrap();
119}
120
121async fn marker_version(project: &std::path::Path) -> Option<i64> {
122 let raw = libsql::Builder::new_local(project_session_db_path(project))

Calls 4

open_project_session_dbFunction · 0.85
buildMethod · 0.80
project_session_db_pathFunction · 0.50
connectMethod · 0.45

Tested by

no test coverage detected