The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(storage): cover legacy v1 profile boot migration
Steven Enamakel4f1ac12862fd
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.mdindex 2855d83026..91675bfaa0 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@@ -19,14 +19,19 @@ owner models and writer transformations from `2d3e22636e^`:as TSD `created_ms` metadata, matching `ProfileRegistry::body_of`.- The isolated desktop profile database stores owner documents in thehistorical `local` scope; the profile directory itself supplied user- isolation. The fixture writes a pending `approvals.requests` owner record- and a `threads.transcript_keys` record through the historical TSD v1 writer.+ isolation. The fixture writes an `approvals` v1 request with RFC3339+ timestamps and a `threads_transcript_keys` record keyed by raw thread id.+ 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 all three records after- boot.-- The TinyFlows catalog writes a `flows_definitions` record in the same- per-profile database. Desktop boot must migrate it through the TinyFlows- catalog owner and the public `flows_list` operation must return it.+ SQLite database. 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.+- The secret uses TinyStorage's public `DocumentSecrets::set` writer against+ the historical v1 backend, then the integration test reads it with+ `DocumentSecrets` after desktop boot.- `secrets` contains an encrypted `fixture-secret` document in the same scopeusing the fixture-only master key `[0x5a; 32]`; the integration test reads itwith TinyStorage's `DocumentSecrets` API after desktop boot.@@ -35,8 +40,10 @@ The host E2E test copies this database to an existing profile's`users/u1/workspace/storage/storage.db`, boots the desktop host with layoutauto-migration enabled, then restores the migration archive to a separatetemporary directory, verifies the archive includes the original storage path,-and opens its database. It reads thread messages, approvals, secrets, and-flows from the migrated profile through their owner APIs. The focused core import test+and opens its database. It reads thread messages and transcript key, approvals,+secrets, and flows from the migrated profile through their owner APIs. It then+deletes the flow, reboots the desktop host, and checks that boot does not+resurrect the row from the archived database. The focused core import testcontinues to verify the owner schema conversions for cost, artifacts, andprofile metadata, as well as non-resurrection after deletion.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.rsindex 1e3a13d28e..2a9cbb7ed6 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@@ -213,19 +213,21 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {// local scope: the profile directory itself supplied user isolation.// Their owners must continue to read them after the real v1-to-v2 boot// migration.+ // This is the approvals v1 owner document from the historic schema:+ // approvals.requests did not exist yet. The approvals owner's v2 schema+ // migration converts these RFC3339 timestamps and collection name.put(user_scope.documents(),- "approvals.requests",+ "approvals","fixture-approval",json!({"tool_name": "shell","action_summary": "Fixture approval","args_redacted": "{}","session_id": "fixture-session",- "created_ms": 1738555506000_i64,- "deadline_ms": 4070908800000_i64,- "pending": true,- "agent_id": "default"+ "created_at": "2025-02-03T04:05:06Z",+ "expires_at": "2099-01-01T00:00:00Z",+ "pending": true}),).await?;@@ -266,10 +268,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {}),).await?;+ // The thread owner historically keyed transcript rows by the raw thread+ // id in `threads_transcript_keys`; its schema step rekeys this to the+ // current owner collection and escaped id.put(user_scope.documents(),- "threads.transcript_keys",- &Key::of([thread_id])?.as_str().to_owned(),+ "threads_transcript_keys",+ thread_id,json!({"key": "fixture-transcript-key"}),).await?;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.dbindex 71afc4bbbf..10ed313360 100644Binary 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 differdiff --git a/tests/storage_legacy_profile_boot_e2e.rs b/tests/storage_legacy_profile_boot_e2e.rsindex ae2dcc608b..9740538e96 100644--- a/tests/storage_legacy_profile_boot_e2e.rs+++ b/tests/storage_legacy_profile_boot_e2e.rs@@ -301,6 +301,7 @@ fn desktop_boot_reads_a_preserved_existing_v1_profile_database() {config.workspace_dir = workspace;config.storage.url = Some(format!("sqlite:{}", profile.join("storage.db").display()));std::thread::spawn(move || {+ openhuman_core::storage::clear();let storage_url = config.storage.url.as_deref().unwrap().to_owned();let owner_runtime = tokio::runtime::Builder::new_multi_thread().enable_all()