Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

chore(pr-842): integrate latest upstream main

yuxinobd20f3731252
diff --cc crates/host-core/src/config_sync/engine.rs
index 08429ec92,2eadbe2dd..5f7b405d4
--- a/crates/host-core/src/config_sync/engine.rs
+++ b/crates/host-core/src/config_sync/engine.rs
@@@ -1111,31 -1168,55 +1168,78 @@@ mod tests
Ok(state)
}
+ #[tokio::test]
+ async fn append_only_mode_syncs_with_a_server_that_ignores_preconditions() -> Result<()> {
+ let fixture = crate::config_sync::transport::tests::fixture_ignoring_preconditions().await;
+ let device_a_dir = tempfile::tempdir()?;
+ let device_b_dir = tempfile::tempdir()?;
+ let device_a =
+ configure_test_device_mode(device_a_dir.path(), &fixture.endpoint, "appendOnly")
+ .await?;
+ let device_b =
+ configure_test_device_mode(device_b_dir.path(), &fixture.endpoint, "appendOnly")
+ .await?;
+ let (tx, _rx) = mpsc::unbounded_channel();
+
+ let (a_state, b_state) = tokio::join!(
+ sync_now(device_a.clone(), tx.clone()),
+ sync_now(device_b.clone(), tx.clone())
+ );
+ assert!(
+ a_state.is_ok(),
+ "device A compatibility sync failed: {a_state:?}"
+ );
+ assert!(
+ b_state.is_ok(),
+ "device B compatibility sync failed: {b_state:?}"
+ );
+
+ let state = device_a.lock().await;
+ let config = load_config(&state)?.expect("configured device");
+ let key = local_vault_key(&state, &config)?.expect("unlocked device");
+ let transport = transport_with_password(&config, String::new())?;
+ let remote = read_append_only_remote(&transport, &config, &key)
+ .await?
+ .expect("compatibility revisions");
+ assert!(!remote.tip_ids.is_empty());
+ assert!(remote.tip_ids.len() <= 2);
+ assert!(
+ transport
+ .list_children(&remote::compatibility_heads_path(&config))
+ .await?
+ .len()
+ >= 2
+ );
+
+ fixture.task.abort();
+ Ok(())
+ }
+
#[tokio::test]
async fn two_devices_sync_credentials_capabilities_and_disjoint_edit() -> Result<()> {
+ const ISOLATED_PROCESS: &str = "PI_DESKTOP_CONFIG_SYNC_TEST_CHILD";
+ if std::env::var_os(ISOLATED_PROCESS).is_none() {
+ // Capture includes global capabilities. Isolate their root in a
+ // child process so parallel tests cannot repoint it to user data.
+ let agents_dir = tempfile::tempdir()?;
+ let output = std::process::Command::new(std::env::current_exe()?)
+ .args([
+ "--exact",
+ "config_sync::engine::tests::two_devices_sync_credentials_capabilities_and_disjoint_edit",
+ "--nocapture",
+ ])
+ .env(ISOLATED_PROCESS, "1")
+ .env(crate::agent_capabilities::AGENTS_DIR_ENV, agents_dir.path())
+ .output()?;
+ anyhow::ensure!(
+ output.status.success(),
+ "isolated config sync test failed: {}\n{}",
+ String::from_utf8_lossy(&output.stdout),
+ String::from_utf8_lossy(&output.stderr),
+ );
+ return Ok(());
+ }
+
let fixture = crate::config_sync::transport::tests::fixture(false).await;
let device_a_dir = tempfile::tempdir()?;
let device_b_dir = tempfile::tempdir()?;