From ecf8b08595580e8a07fc4cf85e4800b1c1213cf3 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Fri, 3 Apr 2026 21:34:20 +0300 Subject: feat: improve update-ready and release notes ux --- src/update.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/update.rs') diff --git a/src/update.rs b/src/update.rs index d616ace8..27e180a1 100644 --- a/src/update.rs +++ b/src/update.rs @@ -14,6 +14,12 @@ const GITHUB_REPO: &str = "ogulcancelik/herdr"; const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION"); const FAKE_UPDATE_VERSION_ENV: &str = "HERDR_FAKE_UPDATE_VERSION"; +fn fake_release_notes_body(version: &str) -> String { + format!( + "### Changed\n- Test update v{version} for local UI validation.\n\n### Notes\n- This is stub release-notes content generated by {FAKE_UPDATE_VERSION_ENV}." + ) +} + // --------------------------------------------------------------------------- // Version // --------------------------------------------------------------------------- @@ -231,6 +237,11 @@ pub fn auto_update(events: tokio::sync::mpsc::Sender) { version, "using fake update version for local testing" ); + if let Err(e) = + crate::release_notes::save_pending(version, &fake_release_notes_body(version)) + { + tracing::warn!("failed to save fake pending release notes: {e}"); + } let _ = events.blocking_send(crate::events::AppEvent::UpdateReady { version: version.to_string(), }); @@ -334,6 +345,14 @@ mod tests { assert_eq!(Version::parse(""), None); } + #[test] + fn fake_release_notes_include_version_and_context() { + let body = fake_release_notes_body("9.4.9"); + assert!(body.contains("v9.4.9")); + assert!(body.contains("local UI validation")); + assert!(body.contains(FAKE_UPDATE_VERSION_ENV)); + } + #[test] fn version_ordering() { let v010 = Version::parse("0.1.0").unwrap(); -- cgit v1.2.3