From ceca8e048c32ec4ef021eaa8816c35b0195a4eca Mon Sep 17 00:00:00 2001 From: repo-worker-tmp-code-b Date: Wed, 11 Nov 2026 14:44:37 -0600 Subject: [PATCH] =?UTF-8?q?pkgs/id=20crate=20split=20step=205c:=20extract?= =?UTF-8?q?=20id-worlds=20remainder=20=E2=80=94=20world=5Fdev,=20world=5Fd?= =?UTF-8?q?octor,=20world=5Fssh,=20world=5Freplication=5Fnet=20(#4408)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkgs/id/Cargo.lock | 3 ++- pkgs/id/Cargo.toml | 11 +++++++--- pkgs/id/crates/id-worlds/Cargo.toml | 8 +++++++ pkgs/id/crates/id-worlds/src/lib.rs | 6 +++++ .../{ => crates/id-worlds}/src/world_dev.rs | 22 +++++++++---------- .../id-worlds}/src/world_doctor.rs | 0 .../id-worlds}/src/world_replication_net.rs | 0 .../{ => crates/id-worlds}/src/world_ssh.rs | 4 ++-- pkgs/id/src/lib.rs | 8 +++---- 9 files changed, 41 insertions(+), 21 deletions(-) rename pkgs/id/{ => crates/id-worlds}/src/world_dev.rs (99%) rename pkgs/id/{ => crates/id-worlds}/src/world_doctor.rs (100%) rename pkgs/id/{ => crates/id-worlds}/src/world_replication_net.rs (100%) rename pkgs/id/{ => crates/id-worlds}/src/world_ssh.rs (99%) diff --git a/pkgs/id/Cargo.lock b/pkgs/id/Cargo.lock index 8f784791f9..cae79b4514 100644 --- a/pkgs/id/Cargo.lock +++ b/pkgs/id/Cargo.lock @@ -3955,7 +3955,6 @@ dependencies = [ "unicode-segmentation", "unicode-width", "urlencoding", - "vt100", "wat", "webpki-roots", "zeroize", @@ -4149,6 +4148,7 @@ dependencies = [ "postcard", "proptest", "rand 0.10.3", + "russh", "serde", "serde_json", "sha2 0.11.0", @@ -4158,6 +4158,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber", + "vt100", "wasmtime", "wat", ] diff --git a/pkgs/id/Cargo.toml b/pkgs/id/Cargo.toml index c5b5448d0f..ea0067c34b 100644 --- a/pkgs/id/Cargo.toml +++ b/pkgs/id/Cargo.toml @@ -39,7 +39,7 @@ world = [ "dep:rmp-serde", "id-core/world", ] -ssh = ["world", "dep:russh"] +ssh = ["world", "id-worlds/ssh"] web = [ "world", "dep:axum", @@ -181,7 +181,8 @@ scrypt = { version = "0.12", optional = true } subtle = { version = "2", optional = true } # wasmtime moved to id-worlds in step 5b of the crate split (#4408): # the `sandbox` feature above forwards to `id-worlds/sandbox`. -russh = { version = "=0.65.0", optional = true } +# russh moved to id-worlds in step 5c of the crate split (#4408): +# the `ssh` feature above forwards to `id-worlds/ssh`. [dev-dependencies] # Paused-time session-driver tests. Dev only. @@ -204,7 +205,11 @@ id-sync = { path = "crates/id-sync", default-features = false, features = [ rusqlite = { version = "0.32", features = ["bundled"] } wat = "=1.261.0" tokio-tungstenite = "0.29" -vt100 = "=0.16.2" +# vt100 moved to id-worlds (dev) with world_ssh in step 5c (#4408). +# The CLI integration tests drive an SSH client against the world SSH +# server; the server side (and its russh) lives in id-worlds since +# step 5c, so the facade keeps russh for its tests only. +russh = "=0.65.0" proptest = "1.12" # Interop vectors for the canonical CBOR of event headers. Dev only. dcbor = "=0.25.2" diff --git a/pkgs/id/crates/id-worlds/Cargo.toml b/pkgs/id/crates/id-worlds/Cargo.toml index a4e0612135..8efb02f282 100644 --- a/pkgs/id/crates/id-worlds/Cargo.toml +++ b/pkgs/id/crates/id-worlds/Cargo.toml @@ -12,6 +12,9 @@ license = "MIT OR Apache-2.0" # # Step 5a brought the leaves, seam 6's cross-world bridge # (`groups::worlds`) and the blob gate's `FoldedWorlds` adapter. +# Step 5b brought the runtime core, and step 5c the remainder +# (`world_dev`, `world_doctor`, `world_ssh`, `world_replication_net`). +# # Step 5b brings the runtime core: `world`, `world_session`, the # sandbox and its compile/fixture/native paths, the hub, net and # store, `world_records` and `shell_contract` — and, with them, the @@ -37,6 +40,9 @@ default = [] # The wasmtime dependency lives inside id-worlds (design feature # mapping); the facade's `sandbox` feature forwards here. sandbox = ["dep:wasmtime", "id-caps/sandbox", "id-core/sandbox"] +# The russh dependency lives inside id-worlds (design feature +# mapping); the facade `ssh` feature forwards here. +ssh = ["dep:russh"] [dependencies] anyhow = "1" @@ -60,6 +66,7 @@ libc = "0.2" p2panda-core = { git = "https://github.com/p2panda/p2panda", rev = "da80c05b95269926bf58121cf6a2d3dd5ca41dfc" } postcard = { version = "1", features = ["alloc"] } rand = "0.10" +russh = { version = "=0.65.0", optional = true } serde = { version = "1", features = ["derive"] } serde_json = "1" sha2 = "0.11" @@ -86,6 +93,7 @@ id-sync = { path = "../id-sync", default-features = false, features = [ proptest = "1.12" tokio = { version = "1", features = ["test-util"] } tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] } +vt100 = "=0.16.2" wat = "=1.261.0" [lints.rust] diff --git a/pkgs/id/crates/id-worlds/src/lib.rs b/pkgs/id/crates/id-worlds/src/lib.rs index 29d1835ed8..0ca128e012 100644 --- a/pkgs/id/crates/id-worlds/src/lib.rs +++ b/pkgs/id/crates/id-worlds/src/lib.rs @@ -49,6 +49,9 @@ pub mod sandbox; mod session_host; pub mod shell_contract; pub mod world; +#[cfg(feature = "sandbox")] +pub mod world_dev; +pub mod world_doctor; pub mod world_cache; pub mod world_compile; pub mod world_fixture; @@ -57,7 +60,10 @@ pub mod world_line; pub mod world_native; pub mod world_net; pub mod world_records; +pub mod world_replication_net; pub mod world_session; +#[cfg(feature = "ssh")] +pub mod world_ssh; pub mod world_store; pub mod world_terminal; diff --git a/pkgs/id/src/world_dev.rs b/pkgs/id/crates/id-worlds/src/world_dev.rs similarity index 99% rename from pkgs/id/src/world_dev.rs rename to pkgs/id/crates/id-worlds/src/world_dev.rs index d041cb8154..685f242db8 100644 --- a/pkgs/id/src/world_dev.rs +++ b/pkgs/id/crates/id-worlds/src/world_dev.rs @@ -1885,7 +1885,7 @@ mod tests { // start at the compiled program's initial state, apply inputs // through the actor, and leave nothing behind for the next // launch (disposability / no remote side effects). - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let world = DevScratchWorld::launch(wasm, 7).await.unwrap(); assert!( world @@ -1957,7 +1957,7 @@ mod tests { // Oracle: the fixture's recorded expectation is the live // counter world's records after the same inputs; a candidate // that replays to those records matches and does not block. - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let (fixture, _) = counter_fixture(wasm, Some(crate::world_session::module_hash(wasm))).await; let gate = fixture_gate(wasm, 7, "counter.jsonl", &fixture).unwrap(); @@ -1973,7 +1973,7 @@ mod tests { // Oracle: the same fixture with a tampered expectation — the // replayed records cannot equal it, so the gate mismatches // and blocks promotion (the design's promotion-gate case). - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let (mut fixture, _) = counter_fixture(wasm, Some(crate::world_session::module_hash(wasm))).await; fixture @@ -1994,7 +1994,7 @@ mod tests { // dev (ordinary replay/verify refuse via check_module), the // gate reports the cross-module fact, and the comparison // itself still decides promotion. - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let other = crate::world_session::module_hash(b"a different module entirely"); let (fixture, _) = counter_fixture(wasm, Some(other)).await; let gate = fixture_gate(wasm, 7, "counter.jsonl", &fixture).unwrap(); @@ -2008,7 +2008,7 @@ mod tests { // Oracle: a fixture that records no expected records has // nothing to compare — the gate must say not_compared with // the reason instead of passing silently, and must not block. - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let (mut fixture, _) = counter_fixture(wasm, Some(crate::world_session::module_hash(wasm))).await; fixture.header.records = None; @@ -2375,7 +2375,7 @@ mod fuzz_tests { // counts cannot break within one case (a case applies at // most MAX_FUZZ_SEQUENCE inputs, so count <= 64 < 1000): // the campaign must run the whole budget and find nothing. - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let decl = counter_decl(vec![ FuzzInvariant::NoTrap, FuzzInvariant::RecordsValidJson, @@ -2451,7 +2451,7 @@ mod fuzz_tests { // the reported counterexample must replay to the violation: // applying the reported inputs to a fresh world reaches // count = 3, the first value above the bound. - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let decl = counter_decl(vec![FuzzInvariant::NumericBounds { key: "count".to_owned(), min: Some(serde_json::Number::from(0)), @@ -2576,7 +2576,7 @@ mod watch_tests { // built from the current snapshot must promote, bump the // F12.9 version, and keep count=2 live — a restart-from-zero // (count=0) would prove the swap discarded the state. - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let mut session = DevSession::launch(wasm, 7, "snap-a".to_owned()) .await .unwrap(); @@ -2611,7 +2611,7 @@ mod watch_tests { // while the sources already sit at snap-c is discarded // without touching the active world, and the discard is // recorded in the last-good diagnostics. - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let mut session = DevSession::launch(wasm, 7, "snap-a".to_owned()) .await .unwrap(); @@ -2635,7 +2635,7 @@ mod watch_tests { // whose recorded expectation the candidate cannot reproduce // blocks the swap; the active world keeps its records and // version. - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let mut session = DevSession::launch(wasm, 7, "snap-a".to_owned()) .await .unwrap(); @@ -2680,7 +2680,7 @@ mod watch_tests { async fn promote_keeps_last_good_when_the_candidate_cannot_launch() { // Oracle: invariant 3 for the launch stage — module bytes // the sandbox refuses never become the active program. - let wasm = include_bytes!("../examples/roc-counter/counter.wasm"); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm"); let mut session = DevSession::launch(wasm, 7, "snap-a".to_owned()) .await .unwrap(); diff --git a/pkgs/id/src/world_doctor.rs b/pkgs/id/crates/id-worlds/src/world_doctor.rs similarity index 100% rename from pkgs/id/src/world_doctor.rs rename to pkgs/id/crates/id-worlds/src/world_doctor.rs diff --git a/pkgs/id/src/world_replication_net.rs b/pkgs/id/crates/id-worlds/src/world_replication_net.rs similarity index 100% rename from pkgs/id/src/world_replication_net.rs rename to pkgs/id/crates/id-worlds/src/world_replication_net.rs diff --git a/pkgs/id/src/world_ssh.rs b/pkgs/id/crates/id-worlds/src/world_ssh.rs similarity index 99% rename from pkgs/id/src/world_ssh.rs rename to pkgs/id/crates/id-worlds/src/world_ssh.rs index 19f8bec2b9..9eddfac03c 100644 --- a/pkgs/id/src/world_ssh.rs +++ b/pkgs/id/crates/id-worlds/src/world_ssh.rs @@ -3655,7 +3655,7 @@ mod tests { let blobs: iroh_blobs::api::Store = MemStore::new().into(); let world = WorldHandle::spawn(WorldCore::new("lobby", WorldLimits::default()).unwrap()); let service = WorldService::new(world, Some("admin".to_owned())).with_blob_store(blobs); - let wasm = include_bytes!("../examples/roc-counter/counter.wasm").to_vec(); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm").to_vec(); let hash = crate::world_session::module_hash(&wasm); service .install_wasm(Some("admin"), wasm, 99, &hash) @@ -3771,7 +3771,7 @@ mod tests { let blobs: iroh_blobs::api::Store = MemStore::new().into(); let world = WorldHandle::spawn(WorldCore::new("lobby", WorldLimits::default()).unwrap()); let service = WorldService::new(world, Some("admin".to_owned())).with_blob_store(blobs); - let wasm = include_bytes!("../examples/roc-counter/counter.wasm").to_vec(); + let wasm = include_bytes!("../../../examples/roc-counter/counter.wasm").to_vec(); let hash = crate::world_session::module_hash(&wasm); service .install_wasm(Some("admin"), wasm, 99, &hash) diff --git a/pkgs/id/src/lib.rs b/pkgs/id/src/lib.rs index 9aa0f12fff..8f687725d3 100644 --- a/pkgs/id/src/lib.rs +++ b/pkgs/id/src/lib.rs @@ -232,7 +232,7 @@ pub mod repl; #[cfg(feature = "sandbox")] pub use id_worlds::sandbox; #[cfg(feature = "sandbox")] -pub mod world_dev; +pub use id_worlds::world_dev; pub use id_store::search; #[cfg(feature = "world")] pub mod seitan; @@ -263,7 +263,7 @@ pub use id_caps::world_caps; pub use id_worlds::world_cache; pub use id_worlds::world_compile; #[cfg(feature = "world")] -pub mod world_doctor; +pub use id_worlds::world_doctor; #[cfg(feature = "world")] pub use id_worlds::world_fixture; @@ -278,7 +278,7 @@ pub use id_worlds::world_native; #[cfg(feature = "world")] pub use id_worlds::world_net; #[cfg(feature = "world")] -pub mod world_replication_net; +pub use id_worlds::world_replication_net; #[cfg(feature = "world")] pub use id_core::world_presentation; #[cfg(feature = "world")] @@ -286,7 +286,7 @@ pub use id_worlds::world_records; #[cfg(feature = "world")] pub use id_worlds::world_session; #[cfg(feature = "ssh")] -pub mod world_ssh; +pub use id_worlds::world_ssh; #[cfg(feature = "world")] pub use id_worlds::world_store; #[cfg(feature = "world")]