You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by wy...@apache.org on 2026/09/23 16:11:52 UTC
(maka) branch feat/runtime-host-rust updated: fix(tui): keep connection menus usable across catalog updates
This is an automated email from the ASF dual-hosted git repository.
M4n5ter pushed a commit to branch feat/runtime-host-rust
in repository https://gitbox.apache.org/repos/asf/maka.git
The following commit(s) were added to refs/heads/feat/runtime-host-rust by this push:
new d0b1aff2fb fix(tui): keep connection menus usable across catalog updates
d0b1aff2fb is described below
commit d0b1aff2fb27c602f73713515f29c8420fb99024
Author: M4n5ter <m4...@gmail.com>
AuthorDate: Thu Sep 24 00:11:31 2026 +0800
fix(tui): keep connection menus usable across catalog updates
Generated-by: Codex
---
.../cli/tests/integration/tui/connection_test.rs | 24 ++++++++-
crates/cli/tests/integration/tui/queue.rs | 5 +-
crates/cli/tests/integration/tui/removal.rs | 4 +-
crates/tui/src/pages/manage.rs | 14 ++++-
crates/tui/src/pages/manage/connection.rs | 62 +++++++++++++++++++++-
5 files changed, 103 insertions(+), 6 deletions(-)
diff --git a/crates/cli/tests/integration/tui/connection_test.rs b/crates/cli/tests/integration/tui/connection_test.rs
index c9c7156c3a..ca06d243fa 100644
--- a/crates/cli/tests/integration/tui/connection_test.rs
+++ b/crates/cli/tests/integration/tui/connection_test.rs
@@ -24,6 +24,7 @@ use serde_json::json;
fn open(tui: &mut Pty) {
tui.send(b"\x10");
+ tui.wait_for("Commands · Esc closes");
tui.wait_for("Test connection");
tui.click_text("Test connection");
tui.wait_for("incur usage");
@@ -160,8 +161,21 @@ fn connection_test_confirms_network_records_failure_preserves_configuration_and_
tokio::task::yield_now().await;
}
});
- tui.send(b"\x10");
- tui.wait_for("Open workspace");
+ // Establish a freshly loaded row, then change it with the menu held open.
+ for name in ["Before menu open", "Updated while menu open"] {
+ runtime.block_on(async {
+ let (_, items) = catalog(&client).await;
+ client.request(Operation::ConnectionCatalogUpdate,json!({
+ "expected":{"connectionId":id,"revision":items[0]["revision"]},
+ "changes":{"name":name,"baseUrl":url,"enabled":true,"enabledModelIds":["fixture-model"]}
+ })).await.unwrap();
+ });
+ tui.wait_for(name);
+ if name == "Before menu open" {
+ tui.send(b"\x10");
+ tui.wait_for("Test connection");
+ }
+ }
assert!(
!tui.screen
.snapshot()
@@ -169,6 +183,12 @@ fn connection_test_confirms_network_records_failure_preserves_configuration_and_
.screen
.contains("Host check passed")
);
+ let updated = runtime.block_on(catalog(&client));
+ tui.click_text("Test connection");
+ tui.wait_for("incur usage");
+ tui.send(b"\x1b");
+ tui.wait_until(|s| !s.contains("incur usage"));
+ assert_eq!(runtime.block_on(catalog(&client)), updated);
tui.send(b"\x11");
tui.finish();
client.disconnect();
diff --git a/crates/cli/tests/integration/tui/queue.rs b/crates/cli/tests/integration/tui/queue.rs
index 8a8837857b..6b2fa31b58 100644
--- a/crates/cli/tests/integration/tui/queue.rs
+++ b/crates/cli/tests/integration/tui/queue.rs
@@ -63,6 +63,7 @@ fn real_host_queue_edits_retracts_promotes_and_steers_at_the_model_boundary() {
tui.wait_for("Message…");
tui.send(b"root task\x13");
tui.wait_for("Queue gate one");
+ tui.wait_for("Message…");
let start = runtime.block_on(observe(&client));
let root_turn = start.root_turn.unwrap();
for text in [
@@ -125,7 +126,9 @@ fn real_host_queue_edits_retracts_promotes_and_steers_at_the_model_boundary() {
}));
tui.wait_for("↗ promote-me");
tui.click_text("Message…");
- tui.send("direct-steering 中文🦀\x0f".as_bytes()); // Ctrl+O does not cancel the running request.
+ tui.send("direct-steering 中文🦀".as_bytes());
+ tui.wait_for("direct-steering 中文🦀"); // Observe the edit before waiting for its removal.
+ tui.send(b"\x0f"); // Ctrl+O does not cancel the running request.
tui.wait_for("Message…");
runtime.block_on(wait_queue(&client, |snapshot| {
snapshot.queue.steering.len() == 2
diff --git a/crates/cli/tests/integration/tui/removal.rs b/crates/cli/tests/integration/tui/removal.rs
index b137176081..80438a8969 100644
--- a/crates/cli/tests/integration/tui/removal.rs
+++ b/crates/cli/tests/integration/tui/removal.rs
@@ -102,7 +102,9 @@ fn deletion_confirms_cas_and_remote_retirement_preserves_recoverable_draft() {
.is_some()
);
tui.send(b"\x1b");
- tui.wait_for("Concurrent deletion target");
+ tui.wait_until(|s| {
+ s.contains("Concurrent deletion target") && !s.contains("This session changed elsewhere.")
+ });
tui.send(b"\x10");
tui.wait_for("Delete session");
tui.click_text("Delete session");
diff --git a/crates/tui/src/pages/manage.rs b/crates/tui/src/pages/manage.rs
index 91143dc185..4cee6da6c8 100644
--- a/crates/tui/src/pages/manage.rs
+++ b/crates/tui/src/pages/manage.rs
@@ -591,7 +591,19 @@ impl App {
self.hits.clear();
}
Command::Directory(command) => return self.directory_action(command),
- Command::Open(target, kind) => {
+ Command::Open(mut target, kind) => {
+ if let Entity::Connection(row) = &target.entity {
+ // A menu names an entity, not a write basis. Read its latest
+ // confirmed projection when opening; the dialog then freezes
+ // that basis for review and Host CAS, even across refreshes.
+ let current = self
+ .connections
+ .rows
+ .iter()
+ .find(|item| item.id == row.id)?;
+ target.name = current.name.clone();
+ target.entity = Entity::Connection(current.clone());
+ }
if kind == Kind::Oauth {
self.oauth_open(&target);
}
diff --git a/crates/tui/src/pages/manage/connection.rs b/crates/tui/src/pages/manage/connection.rs
index 0bb034348c..c812f4eef4 100644
--- a/crates/tui/src/pages/manage/connection.rs
+++ b/crates/tui/src/pages/manage/connection.rs
@@ -200,7 +200,7 @@ impl App {
self.connections
.rows
.iter()
- .any(|current| current.id == row.id && current.revision == row.revision)
+ .any(|current| current.id == row.id)
}
pub fn rename_connection_action(&self) -> Option<Action> {
self.management_commands()
@@ -718,4 +718,64 @@ mod tests {
app.apply(Action::Manage(Command::Close));
assert!(!app.management_enabled(&Command::Open(target, kind)));
}
+ #[test]
+ fn opening_uses_current_connection_but_never_rebases_an_existing_dialog() {
+ let mut app = App::new(
+ "/unused".into(),
+ I18n::new(LocalePreference::Explicit(Locale::En), Locale::En),
+ );
+ app.connection = ConnectionState::Connected {
+ root_id: "root".into(),
+ epoch: "epoch".into(),
+ };
+ app.apply(Action::Visit(Route::Connections));
+ load(&mut app);
+ let action = app.rename_connection_action().unwrap();
+ let current = std::sync::Arc::make_mut(&mut app.connections.rows[0]);
+ current.revision = 8;
+ current.name = "Updated".into();
+ current.base_url = Some("https://updated.example/v1".into());
+ assert!(app.enabled(&action));
+ app.apply(action.clone());
+ let dialog = app.management.dialog.as_ref().unwrap();
+ assert_eq!(dialog.target.name, "Updated");
+ assert_eq!(dialog.editor.text(), "Updated");
+ let Entity::Connection(row) = &dialog.target.entity else {
+ panic!()
+ };
+ assert_eq!(row.revision, 8);
+ assert_eq!(row.base_url.as_deref(), Some("https://updated.example/v1"));
+
+ // A later read must not silently authorize the edited form on a new basis.
+ std::sync::Arc::make_mut(&mut app.connections.rows[0]).revision = 9;
+ let mut screen = Terminal::new(TestBackend::new(80, 24)).unwrap();
+ screen.draw(|f| crate::view::draw(f, &mut app)).unwrap();
+ let ticket = app.management_request().unwrap();
+ let Entity::Connection(row) = &ticket.target.entity else {
+ panic!()
+ };
+ assert_eq!(row.revision, 8);
+ app.management_completed(ticket, Err(RequestFailure::Unknown(ClientError::Timeout)));
+ app.apply(Action::Manage(Command::Close));
+ assert!(
+ !app.enabled(&action),
+ "unknown outcome needs an authoritative read"
+ );
+
+ load(&mut app);
+ app.connections.rows.clear();
+ assert!(
+ !app.enabled(&action),
+ "a removed connection cannot be opened"
+ );
+ load(&mut app);
+ app.connection = ConnectionState::Connected {
+ root_id: "another-root".into(),
+ epoch: "epoch".into(),
+ };
+ assert!(
+ !app.enabled(&action),
+ "connection IDs never cross Host identity"
+ );
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org