Repository navigation
fix(storage): declare only, and migrate nothing, on host-managed ports - #124
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): fix(storage): declare only, and migrate nothing, on host-managed ports. Tiny Sweeper completed its review; deterministic results follow. Review snapshot
Completeness: Complete What changed`migrations::declare` is extracted from `prepare` to ensure only the current declarations; `prepare` now calls `declare` before ensuring the v1 source collections and scanning legacy rows. New public `DocumentBoxStore::open_host_managed` and `DocumentIndexStore::open_host_managed` call `declare` and then a shared `on_prepared` helper, leaving `open` unchanged. `ModuleStorage` in `crates/tinybox-module/src/tinybus_module/storage.rs` opens its box store and its test-only jail registry with `open_host_managed`, so a bus-backed module writes no migration receipts and touches no v1 collections on the host's port. Tests add `Faulty::granting`, which refuses `ensure_collection` for names outside the grant, and cover the host-grant refusal, the no-migration guarantee, and the bus-backed module behavior. Features
Tests
FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
The bus module opened its box store with `open`, which also ensures the v1 source collections. A host that owns the schema refuses those with `schema-is-host-only`, so no box store opens and every command resource fails. Add `open_host_managed` for both stores: it confirms the current declarations and leaves the legacy migration to the host's importer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
93f776a to
8f07b30
Compare
Summary
On a host-managed port (storage reached over the bus), TinyBox's box store and jail index now only re-declare the module's current collections. They run no in-module v1 migration.
DocumentBoxStore::openandDocumentIndexStore::opencallmigrations::prepare, which also ensures the v1 source collectionstinybox_boxesandtinybox_jail_index. OpenHuman's storage host owns the schema. It answers anEnsureCollectiononly when it repeats a spec the grant declares, and the grant is generated fromtinybox_bus::storage::collections(). So it refuses the v1 names withschema-is-host-only. The module then cannot open a box store, and every command resource fails.The legacy data is the host's to carry forward. Its
storage_import_tinyboximporter writes the v1 shapes and runs the owner's steps. So the module has nothing to migrate on those ports.This is the same fix tinyhumansai/tinymcp#147 made for TinyMCP.
Observed on OpenHuman main
d165fdde8a(TinyBox 0.2.0 pinned from the release): the module loads (served=Release, no contract errors), but every shell call fails with "TinyBox could not create a command resource", and the module log showsschema-is-host-onlyfrom the v1ensure_collection.Related issue
None filed. Found while smoke-testing OpenHuman main after the 0.2.0 re-pin (tinyhumansai/openhuman#8320).
API or behavior changes
DocumentBoxStore::open_host_managed(storage)andDocumentIndexStore::open_host_managed(storage, registry). They ensure only the current declarations and migrate nothing. Additive, not breaking.openis unchanged. It still declares and migrates, for directly bound storage such as the CLI.ModuleStoragenow opens its box store (and its test-only jail registry) withopen_host_managed. A bus-backed module no longer writes migration receipts or touches v1 collections on the host's port.Validation
All four commands were run in a
rust:1container (Rust 1.99):cargo fmt --all -- --check: passedcargo clippy --all-targets --all-features -- -D warnings: passedcargo build --all-targets --all-features: passedcargo test --all-features: passed (--no-fail-fast). In an earlier run,tinybox-ssh'shost::observed_tests::generated_supervisor_does_not_wait_for_a_lonely_group_anchorfailed once. It passed on the rerun and passes alone on unmodified main. This change does not touchtinybox-ssh, which does not depend ontinybox-drivers, so the failure looks like timing under load.Tests
faulty_tests.rs: aFaulty::granting(inner, granted)double that refusesensure_collectionfor any name outside the grant, like the host.migrations_tests.rs:a_host_owned_schema_refuses_what_open_declares_but_not_a_host_managed_open: under a host grant,openfails (it reproduces the bug), andopen_host_managedsucceeds for both stores.a_host_managed_open_migrates_nothing: with a seeded v1 box, a host-managed open writes no receipt and no v2 record, and leaves the v1 row for the host.storage_tests.rs(module):a_bus_backed_store_leaves_the_schema_and_migrations_to_the_hostchecks that a bus-backedbox_store()writes no migration receipts on the host's port.Documentation
migrations::declare.tinybus_module::storagemodule docs explain why its ports are host-managed.Checklist
#[allow(...)],#[ignore], or relaxed lints.envcontents in the diff or the description🤖 Generated with Claude Code