Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(storage): align legacy v1 profile fixture with committed DTOs

Steven Enamakel77da7397bd17
diff --git a/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/README.md b/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/README.md
index b53fbb351e..996e8411a1 100644
--- a/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/README.md
+++ b/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/README.md
@@ -24,8 +24,10 @@ owner models and writer transformations from `2d3e22636e^`:
The approvals and threads owners migrate those into their current
collections and ids before their public APIs read them.
- The thread owner also has a committed thread and message in the historical
- SQLite database. The desktop owner APIs must read the thread, message, and
- migrated transcript key after boot.
+ SQLite database. The generator's typed rows mirror TinyAgents' committed
+ `ThreadDto` and `MessageDto` storage bodies at submodule commit
+ `bed24d72c923f6daefc780e7fdbf2b2892a5b334`. The desktop owner APIs must
+ read the thread, message, and migrated transcript key after boot.
- The TinyFlows catalog fixture uses its historical `flows_definitions`
collection with `graph_json` and RFC3339 timestamps. The catalog's schema
migration converts it, and the public `flows_list` operation must return it.
diff --git a/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/generator/src/main.rs b/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/generator/src/main.rs
index f89b7f246c..2aa060cdac 100644
--- a/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/generator/src/main.rs
+++ b/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/generator/src/main.rs
@@ -137,6 +137,41 @@ struct LegacyTranscriptKey {
key: String,
}
+/// The committed TinyAgents `ThreadDto` body in `conversations.threads`.
+#[derive(Serialize)]
+struct LegacyConversationThread {
+ id: String,
+ title: String,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ chat_id: Option<i64>,
+ is_active: bool,
+ created_ms: i64,
+ last_message_ms: i64,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ parent_thread_id: Option<String>,
+ labels: Vec<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ personality_id: Option<String>,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ working_dir: Option<String>,
+ incarnation: String,
+ deleted: bool,
+ visible_end: u64,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ messages_key: Option<String>,
+}
+
+/// A committed TinyAgents `MessageDto` stream value.
+#[derive(Serialize)]
+struct LegacyConversationMessage {
+ id: String,
+ content: String,
+ message_type: String,
+ extra_metadata: Value,
+ sender: String,
+ created_ms: i64,
+}
+
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let path = std::env::args_os()
@@ -265,23 +300,37 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let thread_id = "fixture-thread";
let incarnation = "6f9619ff-8b86-d011-b42d-00c04fc964ff";
let thread_key = Key::of([thread_id])?.as_str().to_owned();
+ let thread = LegacyConversationThread {
+ id: thread_id.into(),
+ title: "Fixture thread".into(),
+ chat_id: None,
+ is_active: true,
+ created_ms: 1_738_555_506_000,
+ last_message_ms: 1_738_555_507_000,
+ parent_thread_id: None,
+ labels: Vec::new(),
+ personality_id: None,
+ working_dir: None,
+ incarnation: incarnation.into(),
+ deleted: false,
+ visible_end: 1,
+ messages_key: None,
+ };
put(
user_scope.documents(),
"conversations.threads",
&thread_key,
- json!({
- "id": thread_id,
- "title": "Fixture thread",
- "is_active": true,
- "created_ms": 1738555506000_i64,
- "last_message_ms": 1738555507000_i64,
- "incarnation": incarnation,
- "deleted": false,
- "visible_end": 1,
- "messages_key": null
- }),
+ serde_json::to_value(thread)?,
)
.await?;
+ let message = LegacyConversationMessage {
+ id: "fixture-message".into(),
+ content: "historical profile message".into(),
+ message_type: "text".into(),
+ extra_metadata: Value::Null,
+ sender: "user".into(),
+ created_ms: 1_738_555_507_000,
+ };
user_scope
.streams()
.append(
@@ -289,14 +338,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
"conversations.messages/{}",
Key::of([thread_id, incarnation])?.as_str()
),
- json!({
- "id": "fixture-message",
- "content": "historical profile message",
- "message_type": "text",
- "extra_metadata": null,
- "sender": "user",
- "created_ms": 1738555507000_i64
- }),
+ serde_json::to_value(message)?,
)
.await?;
// The thread owner historically keyed transcript rows by the raw thread
diff --git a/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/storage.db b/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/storage.db
index 6f4d732408..0b9029d9ec 100644
Binary files a/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/storage.db and b/crates/openhuman-core/src/storage/import/fixtures/legacy-v1-profile/storage.db differ