diff --git a/crates/ledger-gui/src/connect.rs b/crates/ledger-gui/src/connect.rs index 750d687f..7ae8d23e 100644 --- a/crates/ledger-gui/src/connect.rs +++ b/crates/ledger-gui/src/connect.rs @@ -1369,7 +1369,7 @@ impl State { }); ui.label( RichText::new(format!( - "Claude and ChatGPT on the web can only reach {} if you give them an address on the internet. Turn this on to get one. Wanderbooks keeps it private to you, and nobody can read what passes through. An assistant on the web still has to be allowed here, by you, each time it connects.", + "Claude and ChatGPT on the web can only reach {} if you give them an address on the internet. Turn this on to get one. The relay that carries the connection can't read it. The assistant's maker (for example Anthropic or OpenAI) sees what you let that assistant read. An assistant on the web still has to be allowed here, by you, each time it connects.", status.company )) .font(theme::regular(13.0)) @@ -1389,30 +1389,41 @@ impl State { return want; } ui.add_space(8.0); - // Progress, in words. - for (words, progress) in web_progress(web.step) { - ui.horizontal(|ui| match progress { - Progress::Done => { - ui.label(RichText::new(icon::CHECK_CIRCLE).color(p.accent)); - ui.label(RichText::new(words).font(theme::regular(13.5))); - } - Progress::Now if web.problem.is_some() => { - ui.label(RichText::new(icon::WARNING).color(p.warning)); - ui.label(RichText::new(words).font(theme::regular(13.5))); - } - Progress::Now => { - ui.spinner(); - ui.label(RichText::new(format!("{words}\u{2026}")).font(theme::regular(13.5))); - } - Progress::Waiting => { - ui.label(RichText::new(icon::CIRCLE).color(p.muted)); - ui.label( - RichText::new(words) - .font(theme::regular(13.5)) - .color(p.muted), - ); - } + // Progress, in words: the three steps while it is being made, or + // when one of them is the trouble; once it works, one line. + if web.step == crate::owner::WebStep::Connected && web.problem.is_none() { + ui.horizontal(|ui| { + let (rect, _) = ui.allocate_exact_size(vec2(16.0, 16.0), Sense::hover()); + ui.painter().circle_filled(rect.center(), 5.0, p.positive); + ui.label(RichText::new("Connected").font(theme::regular(13.5))); }); + } else { + for (words, progress) in web_progress(web.step) { + ui.horizontal(|ui| match progress { + Progress::Done => { + ui.label(RichText::new(icon::CHECK_CIRCLE).color(p.accent)); + ui.label(RichText::new(words).font(theme::regular(13.5))); + } + Progress::Now if web.problem.is_some() => { + ui.label(RichText::new(icon::WARNING).color(p.warning)); + ui.label(RichText::new(words).font(theme::regular(13.5))); + } + Progress::Now => { + ui.spinner(); + ui.label( + RichText::new(format!("{words}\u{2026}")).font(theme::regular(13.5)), + ); + } + Progress::Waiting => { + ui.label(RichText::new(icon::CIRCLE).color(p.muted)); + ui.label( + RichText::new(words) + .font(theme::regular(13.5)) + .color(p.muted), + ); + } + }); + } } if web.step != crate::owner::WebStep::Connected || web.problem.is_some() { ui.ctx() diff --git a/crates/ledger-gui/tests/web_connect.rs b/crates/ledger-gui/tests/web_connect.rs index fe9c66a0..1d036781 100644 --- a/crates/ledger-gui/tests/web_connect.rs +++ b/crates/ledger-gui/tests/web_connect.rs @@ -33,6 +33,11 @@ //! 6. The Connect page opens by itself once, when the window's server //! says no assistant was ever connected, and never again; with any //! key, session, approval or waiting request it does not open. +//! 7. Once it is connected, the three progress steps are one line, +//! "Connected"; they are shown while connecting and when one is the +//! trouble. The page does not say that nobody can read the traffic: +//! the relay cannot, the assistant's own company reads what it is +//! sent. //! SCENARIOS: //! 1. See the tests below; `web_screenshots` (SHOT_DIR) draws each state //! light and dark. @@ -372,6 +377,9 @@ fn turning_it_on_shows_progress_then_the_address_the_steps_and_what_was_not_trie owner.set(on(WebStep::Connected)); h.run_steps(4); assert!(has(&h, "Connected")); + // Once it works the three steps are one line: "Connected". + assert!(!has(&h, "Getting an address")); + assert!(!has(&h, "Getting a certificate")); assert!(has(&h, CONNECTOR)); for (i, step) in claude_steps().iter().enumerate() { assert!(has(&h, &format!("{}. {step}", i + 1)), "{step}"); @@ -389,6 +397,52 @@ fn turning_it_on_shows_progress_then_the_address_the_steps_and_what_was_not_trie assert!(has(&h, "Copied")); } +/// The three steps are shown while connecting, and when a step is the +/// trouble even though the address works; a clean connection is one line. +#[test] +fn the_steps_collapse_to_one_line_when_connected_and_return_with_a_trouble() { + let w = World::new(&[("alpha", "Wanderland Labs")]); + let owner = Web::new(Some(on(WebStep::Connected))); + let mut h = connect_page(&w, &owner, false); + h.run_steps(4); + assert!(has(&h, "Connected")); + assert!(!has(&h, "Getting an address")); + assert!(!has(&h, "Getting a certificate")); + // The certificate could not be renewed: the steps are back, with the + // trouble. + owner.set(WebConnect { + problem: Some("The certificate could not be renewed yet.".into()), + ..on(WebStep::Connected) + }); + h.run_steps(4); + assert!(has(&h, "Getting an address")); + assert!(has(&h, "Getting a certificate")); + assert!(has(&h, "The certificate could not be renewed yet.")); + // Connecting again shows them as well. + owner.set(on(WebStep::Connecting)); + h.run_steps(4); + assert!(has(&h, "Getting an address")); +} + +/// The words of the switch are true about who can read what (plan 5): the +/// relay cannot; the assistant's own company reads what it is sent. +#[test] +fn the_page_says_who_can_read_what_and_not_that_nobody_can() { + let w = World::new(&[("alpha", "Wanderland Labs")]); + let owner = Web::new(Some(off())); + let mut h = connect_page(&w, &owner, false); + h.run_steps(3); + let all = texts(&h); + assert!(!all.contains("nobody can read")); + assert!(all.contains("The relay that carries the connection can't read it.")); + assert!(all.contains( + "The assistant's maker (for example Anthropic or OpenAI) sees what you let that assistant read." + )); + assert!(all.contains( + "An assistant on the web still has to be allowed here, by you, each time it connects." + )); +} + /// The progress words are one function: what is done, what is under way, /// what waits. #[test]