mirror of
https://github.com/block/buzz.git
synced 2026-11-24 10:12:19 +00:00
🤖 I’m Larry, updating this description on Logan’s behalf. ## Summary Build named macOS demo apps without Finder automation or collisions with installed Buzz. `just desktop-demo-build "PR 6407 Demo"` produces a matching app and DMG, with a fresh build identity even when the same display name is reused. - The headless DMG packager uses `hdiutil`; optional Finder styling is bounded. The existing production release recipe is unchanged. - Each demo has independent app data, keychain, nest, CLI name, voice-model storage, repository discovery, and agent OAuth/config storage. Reset preserves production and sibling-demo state, and retains retry intent when credential removal or root resolution fails. - Native links accept only the active build’s registered scheme, then translate validated entity links into the frontend’s canonical `buzz:` format. - The recipe builds all six executable sidecars. Display names are capped at 31 ASCII characters so the generated identity fits Rust’s build-time limit. **Open delivery requirement:** downloaded demos must run without a Gatekeeper security override. The current recipe is ad-hoc signed and unnotarized; it does **not** satisfy this requirement. Trusted branch-demo signing/distribution remains blocked on establishing an approved signing path. This PR is not being presented as complete download-and-run delivery. ### Related issue N/A — reported in the Buzz DMG-packaging workstream. ### Testing At `11ce21ff97cb387ad676e7caa65b00964097d0bb`, macOS Blox passed the Tauri workspace suite and compiled-flags gate (including the full named-demo state; each library pass: 2,992 passed, 19 ignored), Tauri all-target clippy, the full `buzz-agent` package suite, and frontend lint/typecheck plus 5,733 tests. Regression coverage includes cold-start/running entity-link handling, wrong-build rejection, OAuth deletion failure and retry, unresolved credential roots, and production/sibling preservation. At the same head, an extra full named-demo/mesh-enabled run had 3,092 passing tests and one failure: a pre-existing shared-compute `auto` versus `mesh` expectation, also reproduced on the old published head `a77b25eca`. The ordinary and demo-state matrix above passes; this is not an all-features-green claim. Live macOS Launch Services delivery remains unverified. GitHub CI completed with 30 successful checks and 9 skipped. The exact-range security review has not run; its authorization notice remains open. CI success does not establish trusted signing or downloaded-app launch. Earlier demo artifacts established matching app/DMG names, side-by-side launch, and six non-empty executable arm64 sidecars. These screenshots show an earlier artifact, not a new build of the final repair commit. Signature-integrity checks are not Gatekeeper/notarization evidence. <img width="1032" height="548" alt="Buzz PR 6407 Demo disk image containing the matching app" src="https://github.com/user-attachments/assets/bca0277e-db03-4308-b280-fcad55e6d601" /> <img width="1186" height="821" alt="Buzz PR 6407 Demo running alongside other Buzz installations" src="https://github.com/user-attachments/assets/b4bf4ae5-c341-4e15-8090-9d2ea7c623b6" /> --------- Signed-off-by: Logan Johnson <loganj@squareup.com> Signed-off-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz> Co-authored-by: Other Brother Darryl <cee32d92756729ee0c097c5661b879c6199931cd25315c8cf398dcbf0f155cf1@buzz.block.builderlab.xyz> Co-authored-by: Larry <loganj+sandbox-larry@squareup.com> Co-authored-by: Larry <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
184 lines
5.9 KiB
Rust
184 lines
5.9 KiB
Rust
//! Compile-time identity for reusable named demo builds.
|
|
//!
|
|
//! Production builds leave `BUZZ_DESKTOP_BUILD_DEMO_SLUG` unset and retain all
|
|
//! existing names. The demo recipe validates one slug and `build.rs` bakes it
|
|
//! into the binary; every runtime identity is then derived from that one value.
|
|
|
|
use std::borrow::Cow;
|
|
|
|
pub(crate) fn demo_slug() -> Option<&'static str> {
|
|
option_env!("BUZZ_DESKTOP_BUILD_DEMO_SLUG")
|
|
}
|
|
|
|
pub(crate) fn is_demo_build() -> bool {
|
|
demo_slug().is_some()
|
|
}
|
|
|
|
pub(crate) const DEMO_AGENT_CONFIG_ENV: &str = "BUZZ_AGENT_CONFIG_DIR";
|
|
|
|
pub(crate) fn demo_config_home() -> Result<Option<std::path::PathBuf>, String> {
|
|
demo_config_home_for(demo_slug(), dirs::config_dir())
|
|
}
|
|
|
|
pub(crate) fn demo_agent_oauth_cache_dir() -> Result<Option<std::path::PathBuf>, String> {
|
|
Ok(demo_config_home()?.map(|dir| dir.join("buzz-agent").join("oauth")))
|
|
}
|
|
|
|
/// Keep child config caches inside this demo build's identity. In particular,
|
|
/// bundled buzz-agent OAuth tokens must not read or write production's root.
|
|
/// Refuse launch if a demo cannot resolve its root; None means production only.
|
|
pub(crate) fn apply_demo_config_home(command: &mut std::process::Command) -> Result<(), String> {
|
|
if let Some(config_home) = demo_config_home()? {
|
|
command.env(DEMO_AGENT_CONFIG_ENV, config_home);
|
|
}
|
|
Ok(())
|
|
}
|
|
|
|
fn demo_config_home_for(
|
|
demo_slug: Option<&str>,
|
|
config_dir: Option<std::path::PathBuf>,
|
|
) -> Result<Option<std::path::PathBuf>, String> {
|
|
match demo_slug {
|
|
None => Ok(None),
|
|
Some(slug) => config_dir
|
|
.map(|dir| Some(dir.join(format!("buzz-demo-{slug}"))))
|
|
.ok_or_else(|| "cannot resolve demo credential directory".to_string()),
|
|
}
|
|
}
|
|
|
|
pub(crate) fn deep_link_scheme() -> Cow<'static, str> {
|
|
demo_slug()
|
|
.map(|slug| Cow::Owned(format!("buzz-demo-{slug}")))
|
|
.unwrap_or(Cow::Borrowed("buzz"))
|
|
}
|
|
|
|
pub(crate) fn is_deep_link_for_build(value: &str) -> bool {
|
|
is_deep_link_for_scheme(value, deep_link_scheme().as_ref())
|
|
}
|
|
|
|
fn is_deep_link_for_scheme(value: &str, scheme: &str) -> bool {
|
|
value
|
|
.strip_prefix(scheme)
|
|
.is_some_and(|suffix| suffix.starts_with("://"))
|
|
}
|
|
|
|
pub(crate) fn keyring_service() -> Cow<'static, str> {
|
|
demo_slug()
|
|
.map(|slug| Cow::Owned(format!("buzz-desktop-demo.{slug}")))
|
|
.unwrap_or(Cow::Borrowed("buzz-desktop"))
|
|
}
|
|
|
|
pub(crate) fn nest_name(is_dev: bool) -> Cow<'static, str> {
|
|
nest_name_for(demo_slug(), is_dev)
|
|
}
|
|
|
|
fn nest_name_for(demo_slug: Option<&str>, is_dev: bool) -> Cow<'_, str> {
|
|
if let Some(slug) = demo_slug {
|
|
Cow::Owned(format!(".buzz-demo-{slug}"))
|
|
} else if is_dev {
|
|
Cow::Borrowed(".buzz-dev")
|
|
} else {
|
|
Cow::Borrowed(".buzz")
|
|
}
|
|
}
|
|
|
|
pub(crate) fn cli_name(is_dev: bool) -> String {
|
|
if let Some(slug) = demo_slug() {
|
|
format!("buzz-demo-{slug}")
|
|
} else if is_dev {
|
|
"buzz-dev".to_string()
|
|
} else {
|
|
"buzz".to_string()
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
#[ignore = "compiled with BUZZ_BUILD_DEMO_SLUG by the compiled-flags recipe"]
|
|
fn compiled_demo_slug_matches_expected() {
|
|
let expected = std::env::var("BUZZ_TEST_EXPECTED_DEMO_SLUG")
|
|
.expect("BUZZ_TEST_EXPECTED_DEMO_SLUG must be set");
|
|
assert_eq!(demo_slug(), Some(expected.as_str()));
|
|
}
|
|
|
|
#[test]
|
|
fn ordinary_release_defaults_remain_production_identity() {
|
|
if demo_slug().is_none() {
|
|
assert_eq!(deep_link_scheme(), "buzz");
|
|
assert_eq!(keyring_service(), "buzz-desktop");
|
|
assert_eq!(nest_name(false), ".buzz");
|
|
assert_eq!(cli_name(false), "buzz");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn demo_agent_config_and_oauth_roots_are_build_scoped() {
|
|
let base = std::path::PathBuf::from("/Users/demo/Library/Application Support");
|
|
assert_eq!(
|
|
demo_config_home_for(None, Some(base.clone())).unwrap(),
|
|
None
|
|
);
|
|
let first = demo_config_home_for(Some("board-1234567812345678"), Some(base.clone()))
|
|
.unwrap()
|
|
.unwrap();
|
|
let second = demo_config_home_for(Some("board-8765432187654321"), Some(base))
|
|
.unwrap()
|
|
.unwrap();
|
|
assert_eq!(
|
|
first,
|
|
std::path::PathBuf::from(
|
|
"/Users/demo/Library/Application Support/buzz-demo-board-1234567812345678"
|
|
)
|
|
);
|
|
assert_eq!(
|
|
first.join("buzz-agent/oauth"),
|
|
std::path::PathBuf::from(
|
|
"/Users/demo/Library/Application Support/buzz-demo-board-1234567812345678/buzz-agent/oauth"
|
|
)
|
|
);
|
|
assert_ne!(first, second);
|
|
}
|
|
|
|
#[test]
|
|
fn unresolved_demo_credentials_never_select_production_defaults() {
|
|
assert_eq!(demo_config_home_for(None, None).unwrap(), None);
|
|
assert_eq!(
|
|
demo_config_home_for(Some("board-1234567812345678"), None),
|
|
Err("cannot resolve demo credential directory".to_string())
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn duplicate_instance_links_follow_the_build_scheme() {
|
|
assert!(is_deep_link_for_scheme("buzz://message?id=1", "buzz"));
|
|
assert!(!is_deep_link_for_scheme(
|
|
"buzz-demo-board-1234567812345678://message?id=1",
|
|
"buzz"
|
|
));
|
|
assert!(is_deep_link_for_scheme(
|
|
"buzz-demo-board-1234567812345678://message?id=1",
|
|
"buzz-demo-board-1234567812345678"
|
|
));
|
|
assert!(!is_deep_link_for_scheme(
|
|
"buzz://message?id=1",
|
|
"buzz-demo-board-1234567812345678"
|
|
));
|
|
}
|
|
|
|
#[test]
|
|
fn production_and_named_demo_nests_are_distinct() {
|
|
assert_eq!(nest_name_for(None, false), ".buzz");
|
|
assert_eq!(
|
|
nest_name_for(Some("workstream-board"), false),
|
|
".buzz-demo-workstream-board"
|
|
);
|
|
assert_eq!(
|
|
nest_name_for(Some("second-demo"), false),
|
|
".buzz-demo-second-demo"
|
|
);
|
|
}
|
|
}
|