From 47bae891ffcb020c7d7d164154f29bf0f8d1abc3 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Nov 2026 11:33:46 +0000 Subject: [PATCH 1/7] chore(vendor): bump tinychannels, tinymemory, tinystoragedrivers and tinywallet Update the pinned submodule revisions for the four vendored libraries to their latest commits. Auto-committed-on: cuttlefish Co-authored-by: Medulla --- vendor/tinychannels | 2 +- vendor/tinymemory | 2 +- vendor/tinystoragedrivers | 2 +- vendor/tinywallet | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vendor/tinychannels b/vendor/tinychannels index 6cbdcdba7b5..a1d0cfffc8c 160000 --- a/vendor/tinychannels +++ b/vendor/tinychannels @@ -1 +1 @@ -Subproject commit 6cbdcdba7b57452cdf6ce9bb4e9b6cc5a95b8740 +Subproject commit a1d0cfffc8c8cad263d66bce8e361f1da6d1752c diff --git a/vendor/tinymemory b/vendor/tinymemory index 4ee5d0ce3a1..54c08b4742d 160000 --- a/vendor/tinymemory +++ b/vendor/tinymemory @@ -1 +1 @@ -Subproject commit 4ee5d0ce3a197a5f552ebb5f3c7cce208be51080 +Subproject commit 54c08b4742d8c3181a046fcc1951fca7e226e692 diff --git a/vendor/tinystoragedrivers b/vendor/tinystoragedrivers index 5e8c8378983..f5a33025b9f 160000 --- a/vendor/tinystoragedrivers +++ b/vendor/tinystoragedrivers @@ -1 +1 @@ -Subproject commit 5e8c8378983a60c8de0a014a77cdba40c242b455 +Subproject commit f5a33025b9feaa36fea522cce764fe8c796e5139 diff --git a/vendor/tinywallet b/vendor/tinywallet index 522121a4512..b70e7950e5f 160000 --- a/vendor/tinywallet +++ b/vendor/tinywallet @@ -1 +1 @@ -Subproject commit 522121a451241691bc5f2c8f8d63928b2f0d949f +Subproject commit b70e7950e5f71e82af793eb3ecf212d25635914e From 6388b52b898068f1eac9a1c0ad06513eba9d96e0 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Nov 2026 11:34:18 +0000 Subject: [PATCH 2/7] test(storage): cover every target the wallet x402 ledger opens Adds a test asserting the wallet grant authorizes each document and stream call the x402 ledger makes during migration and persistence, so a missing target cannot silently break x402_fetch with target-not-granted. Auto-committed-on: cuttlefish Co-authored-by: Medulla --- .../modules/storage_grant_schemas_tests.rs | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs index 27eb785bfd2..6f5fe78283f 100644 --- a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs +++ b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs @@ -206,6 +206,48 @@ fn non_document_grants_match_the_owner_contracts_without_broad_prefixes() { ); } +/// Every call TinyWallet's x402 ledger makes when it opens (its own migration, +/// `tinywallet-x402/src/ledger/schema.rs` `migrate`) and afterwards +/// (`ledger/persist.rs`). The migration runs on every first open, whether or +/// not a wallet exists and whether or not there is legacy data, so a target +/// missing here fails every `x402_fetch` with `target-not-granted`. +#[cfg(feature = "web3")] +#[test] +fn the_wallet_grant_covers_every_target_its_x402_ledger_opens_and_migrates() { + let wallet = declared(tinywallet::MODULE_ID).unwrap(); + let calls = [ + // Migration state. + (Object::Documents, "Get", json!({"collection": "wallet.migrations", "id": "x402"})), + (Object::Documents, "Put", json!({"collection": "wallet.migrations", "id": "x402"})), + // v1 budget holds, read and carried into `wallet.budgets`. + (Object::Documents, "Get", json!({"collection": "x402_budget", "id": "holds"})), + (Object::Documents, "Get", json!({"collection": "wallet.budgets", "id": "holds"})), + (Object::Documents, "Put", json!({"collection": "wallet.budgets", "id": "holds"})), + // v1 payments (what the host importer writes), copied to `wallet.payments`. + (Object::Streams, "Len", json!({"stream": tinywallet::PAYMENTS_STREAM})), + (Object::Streams, "ReadWindow", json!({"stream": tinywallet::PAYMENTS_STREAM})), + (Object::Streams, "Len", json!({"stream": "wallet.payments"})), + (Object::Streams, "ReadWindow", json!({"stream": "wallet.payments"})), + (Object::Streams, "AppendBatchIfOffset", json!({"stream": "wallet.payments"})), + (Object::Streams, "Append", json!({"stream": "wallet.payments"})), + ]; + for (object, selector, request) in calls { + assert_eq!( + authorize(&wallet, object, selector, &request).map(|_| ()), + Ok(()), + "{object:?}.{selector} {request}" + ); + } + // The migration's own `ensure_collection` calls repeat the host's specs. + for name in ["wallet.budgets", "wallet.migrations"] { + let spec = serde_json::to_value(CollectionSpec::new(name)).unwrap(); + assert!(matches!( + authorize(&wallet, Object::Documents, "EnsureCollection", &json!({"spec": spec})), + Ok(Plan::Answer(_)) + )); + } +} + #[test] fn connectors_may_read_the_v1_preferences_its_migration_moves() { let connectors = declared("tinyconnectors").unwrap(); From 50538e4d773007b084fd77f09718f83166b9d8df Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Nov 2026 11:36:51 +0000 Subject: [PATCH 3/7] fix(storage): grant wallet module read access to legacy budget collection The wallet module needs to read its legacy x402 budget collection so the ledger can migrate v1 budget holds on first open. Auto-committed-on: cuttlefish Co-authored-by: Medulla --- crates/openhuman-core/src/modules/storage_grant_schemas.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas.rs b/crates/openhuman-core/src/modules/storage_grant_schemas.rs index 18d8575b4ac..ac3a4ba3f52 100644 --- a/crates/openhuman-core/src/modules/storage_grant_schemas.rs +++ b/crates/openhuman-core/src/modules/storage_grant_schemas.rs @@ -166,6 +166,8 @@ pub(super) fn grant_for(module_id: &str) -> Option { fn read_collections(owner: &str) -> Vec { match owner { "connectors" => tinyconnectors_bus::storage::storage_needs().collections, + // TinyWallet's x402 ledger migrates its v1 budget holds on first open. + "wallet" => vec![tinywallet::LEGACY_BUDGET_COLLECTION.to_owned()], _ => Vec::new(), } } From 738189cfa9a291f3c453d02a7d0289b623365206 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Nov 2026 11:36:54 +0000 Subject: [PATCH 4/7] fix(storage): grant wallet access to the x402 ledger stream The wallet module's stream prefixes now include the x402 payments stream alongside the released ledger stream, since its ledger migration reads the v1 stream that the importer fills. Auto-committed-on: cuttlefish Co-authored-by: Medulla --- .../openhuman-core/src/modules/storage_grant_schemas.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas.rs b/crates/openhuman-core/src/modules/storage_grant_schemas.rs index ac3a4ba3f52..c69cd2a4cd8 100644 --- a/crates/openhuman-core/src/modules/storage_grant_schemas.rs +++ b/crates/openhuman-core/src/modules/storage_grant_schemas.rs @@ -177,8 +177,12 @@ fn stream_prefixes(owner: &str) -> Vec { "mcp" => vec![tinymcp_bus::storage::AUDIT_STREAM.to_owned()], "connectors" => tinyconnectors_bus::storage::storage_needs().stream_prefixes, // TinyWallet's module still reads and appends this released ledger - // stream while its bus contract currently declares collections only. - "wallet" => vec!["wallet.payments".to_owned()], + // stream while its bus contract currently declares collections only, + // and its x402 ledger migration reads the v1 stream the importer fills. + "wallet" => vec![ + "wallet.payments".to_owned(), + tinywallet::PAYMENTS_STREAM.to_owned(), + ], _ => Vec::new(), } } From cbfff16c1c76881f13a1982e3b96f6f729d46a42 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Nov 2026 11:36:56 +0000 Subject: [PATCH 5/7] chore(storage): add legacy budget collection constant for tinywallet Adds a constant naming the v1 x402_budget collection so the tinywallet x402 ledger migration can reference the legacy budget-hold data it reads. Auto-committed-on: cuttlefish Co-authored-by: Medulla --- crates/openhuman-core/src/modules/storage_grant_schemas.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas.rs b/crates/openhuman-core/src/modules/storage_grant_schemas.rs index c69cd2a4cd8..974bae47a67 100644 --- a/crates/openhuman-core/src/modules/storage_grant_schemas.rs +++ b/crates/openhuman-core/src/modules/storage_grant_schemas.rs @@ -216,6 +216,8 @@ pub(super) mod tinywallet { pub(crate) const MODULE_ID: &str = "tinywallet"; /// The v1 payments stream the importer writes. pub(crate) const PAYMENTS_STREAM: &str = "x402.payments"; + /// The v1 budget-hold collection the module's x402 ledger migration reads. + pub(crate) const LEGACY_BUDGET_COLLECTION: &str = "x402_budget"; } pub(super) mod tinybox { From dd78ca60af6e9d2ea8dc0ebbb96e97d828bb166e Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Nov 2026 11:39:13 +0000 Subject: [PATCH 6/7] test(storage): cover x402 payments stream in wallet grant test Reformatted the wallet grant assertions and replaced the payments stream constant with the literal x402.payments name so the test checks the exact stream the host importer writes. Auto-committed-on: cuttlefish Co-authored-by: Medulla --- .../modules/storage_grant_schemas_tests.rs | 63 +++++++++++++++---- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs index 6f5fe78283f..b81d77bf162 100644 --- a/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs +++ b/crates/openhuman-core/src/modules/storage_grant_schemas_tests.rs @@ -217,19 +217,55 @@ fn the_wallet_grant_covers_every_target_its_x402_ledger_opens_and_migrates() { let wallet = declared(tinywallet::MODULE_ID).unwrap(); let calls = [ // Migration state. - (Object::Documents, "Get", json!({"collection": "wallet.migrations", "id": "x402"})), - (Object::Documents, "Put", json!({"collection": "wallet.migrations", "id": "x402"})), + ( + Object::Documents, + "Get", + json!({"collection": "wallet.migrations", "id": "x402"}), + ), + ( + Object::Documents, + "Put", + json!({"collection": "wallet.migrations", "id": "x402"}), + ), // v1 budget holds, read and carried into `wallet.budgets`. - (Object::Documents, "Get", json!({"collection": "x402_budget", "id": "holds"})), - (Object::Documents, "Get", json!({"collection": "wallet.budgets", "id": "holds"})), - (Object::Documents, "Put", json!({"collection": "wallet.budgets", "id": "holds"})), + ( + Object::Documents, + "Get", + json!({"collection": "x402_budget", "id": "holds"}), + ), + ( + Object::Documents, + "Get", + json!({"collection": "wallet.budgets", "id": "holds"}), + ), + ( + Object::Documents, + "Put", + json!({"collection": "wallet.budgets", "id": "holds"}), + ), // v1 payments (what the host importer writes), copied to `wallet.payments`. - (Object::Streams, "Len", json!({"stream": tinywallet::PAYMENTS_STREAM})), - (Object::Streams, "ReadWindow", json!({"stream": tinywallet::PAYMENTS_STREAM})), + (Object::Streams, "Len", json!({"stream": "x402.payments"})), + ( + Object::Streams, + "ReadWindow", + json!({"stream": "x402.payments"}), + ), (Object::Streams, "Len", json!({"stream": "wallet.payments"})), - (Object::Streams, "ReadWindow", json!({"stream": "wallet.payments"})), - (Object::Streams, "AppendBatchIfOffset", json!({"stream": "wallet.payments"})), - (Object::Streams, "Append", json!({"stream": "wallet.payments"})), + ( + Object::Streams, + "ReadWindow", + json!({"stream": "wallet.payments"}), + ), + ( + Object::Streams, + "AppendBatchIfOffset", + json!({"stream": "wallet.payments"}), + ), + ( + Object::Streams, + "Append", + json!({"stream": "wallet.payments"}), + ), ]; for (object, selector, request) in calls { assert_eq!( @@ -242,7 +278,12 @@ fn the_wallet_grant_covers_every_target_its_x402_ledger_opens_and_migrates() { for name in ["wallet.budgets", "wallet.migrations"] { let spec = serde_json::to_value(CollectionSpec::new(name)).unwrap(); assert!(matches!( - authorize(&wallet, Object::Documents, "EnsureCollection", &json!({"spec": spec})), + authorize( + &wallet, + Object::Documents, + "EnsureCollection", + &json!({"spec": spec}) + ), Ok(Plan::Answer(_)) )); } From f6f784227f99858af7dd79f2f645cb41938623d5 Mon Sep 17 00:00:00 2001 From: Steven Enamakel Date: Fri, 13 Nov 2026 12:01:18 +0000 Subject: [PATCH 7/7] ci(storage): allowlist the web3-gated storage grant schema tests Co-authored-by: Medulla --- scripts/ci/check-gated-test-allowlist.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/check-gated-test-allowlist.sh b/scripts/ci/check-gated-test-allowlist.sh index 8a2ec3e29cc..af6397ac249 100755 --- a/scripts/ci/check-gated-test-allowlist.sh +++ b/scripts/ci/check-gated-test-allowlist.sh @@ -106,6 +106,7 @@ integrations/composio/ops/mod.rs integrations/composio/client.rs mcp/server/resources_tests.rs modules/tinyflows.rs +modules/storage_grant_schemas_tests.rs doctor/checks/channels.rs doctor/checks/inference_tests.rs doctor/checks/mcp.rs