Skip to content

Commit 83b72a3

Browse files
tellahoCarl
andauthored
fix(plugins): default reminders and workflows off for fresh installs (#2291)
**Category:** improvement **User Impact:** Fresh installs start with Reminders and Workflows off. Existing installs keep both features available, including when their settings were never changed. **Problem:** Changing only the bundled defaults would silently disable these features for existing profiles without overrides. That stops local reminder notifications and removes the controls for workflows that can still run on the relay. **Solution:** Change the browser and native defaults to Off, then save each known bundled plugin's resolved state. Existing profiles without a Reminders or Workflows flag retain their former On state. Saved On/Off choices always win; a deliberate reset uses current defaults. If an automatic native snapshot cannot be saved, startup uses the resolved values and later catalog reads retry. Explicit changes and reset still report write failures. Browser reset backs up the original settings and atomically replaces their key, preserving the original if the replacement fails. The native migration checks whether the plugin-profile directory existed before acquiring the registry lock. Browser storage checks for prior plugin settings or client records before client initialization. New devices or cleared local profiles count as fresh even if the account has older relay data. No relay usage scan, registry schema change, or activation/UI redesign is involved. The accepted [plugin-defaults decision](https://github.com/block/buzz-app/blob/eda7b3f0350da6b480cd3b97d1d032c0a251331f/docs/plugin-defaults.md) makes future default-off changes apply only to fresh installs. Both storage owners now retain known states across subsequent releases; the decision also requires legacy backfills for users who skip releases that would have saved those states. <details> <summary>File changes</summary> - `src/bundled/index.ts` and `crates/plugin-manager/src/lib.rs`: new defaults, native profile detection, initialization under the existing lock, and explicit reset behavior. - `src/plugins/storage.ts`: equivalent browser initialization, saved-choice precedence, and recovery behavior. - Native management tests, frontend storage tests, and app composition tests: cold launch/reopen, untouched upgrade, partial and explicit choices, future default changes, storage failure, and recovery. - Browser fixture and feature journeys: explicit opt-ins where optional features are required; model fresh plugin choices before seeding community records. - `tests/browser/plugin-defaults.spec.mjs`: real app startup without fixture storage, plus migrated activation, working Workflows navigation, deliberate disable, and reload. - `AGENTS.md`, `docs/plugin-defaults.md`, `docs/plugin-architecture.md`, and `docs/buzz-help.md`: the durable policy and user-facing behavior. </details> ### Reproduction steps 1. Open a fresh disposable profile. Reminders and Workflows should offer **Enable** under Settings → Plugins → Manage plugins, including after another launch. 2. Upgrade an existing profile that previously opened Buzz but never saved plugin choices. Both should remain on, and the Workflows page should remain usable. 3. Repeat with saved On and Off choices. Those choices should remain effective. 4. Enable or disable either plugin through Settings and reload. The choice should persist. 5. After deliberately recovering/resetting plugin settings, both should be off and remain off after reopening. ### Validation Current head **`eda7b3f03`** fixes native automatic snapshot failures in `46756c962` and browser reset replacement failures in `eda7b3f03`. - New regressions failed on the previous implementation: the native catalog returned a snapshot write error, and both browser reset cases lost their original key. With the fixes, all **104 native package tests** and **130 frontend plugin-owner/app-composition tests** passed. - At clean `eda7b3f03`, the complete `plugin-defaults.spec.mjs` and `launch-home.spec.mjs` passed **22/22 cases** in Chromium and WebKit, including the recovery/reset UI (`pnpm test:browser tests/browser/plugin-defaults.spec.mjs tests/browser/launch-home.spec.mjs --project=chromium --project=webkit --no-deps`). Two workers, zero retries. No browser cases or fixtures changed in this follow-up. - Commit and pre-push checks passed. Native first-launch snapshot failure can still leave a directory that a later process classifies as an existing profile; the decision document records this limitation. Restart stability requires a successful snapshot save. The earlier merge head **`ff8e6c9ed`** brings in main `517443522` without rewriting the published branch. The merge applied without conflicts and includes the mainline history geometry / Virtua fix. - The complete `plugin-defaults.spec.mjs` and `history-loading.spec.mjs` passed **48/48 cases** in Chromium and WebKit at the clean merge head, in 2.1 minutes (`pnpm test:browser tests/browser/plugin-defaults.spec.mjs tests/browser/history-loading.spec.mjs --project=chromium --project=webkit --no-deps`). Two workers, zero retries; unrelated measurement projects were excluded. - Blob comparisons confirm the native manager, browser plugin storage, frontend default declarations, and decision document are identical to `e6f8f4a07`. The history spec matches main exactly except for the explicit Workflows fixture opt-in; main's assertions remain intact. - Mandatory pre-push checks passed: TypeScript and related unit tests, design-system checks, workspace Clippy and publication checks. The PR remains ready for review; native UI / human migration acceptance remains pending. At clean commit `31d97764c`: - `pnpm exec vitest run src/plugins src/app/pages.integration.test.mjs`: **128 passed**, 11 complete files. - `cargo test -p buzzodz-plugins --locked`: **103 passed** across the complete package suite. - `pnpm test:browser tests/browser/plugin-defaults.spec.mjs tests/browser/notification-settings.spec.mjs tests/browser/settings.spec.mjs --project=chromium --project=webkit --no-deps`: **38 passed** in 1.3 minutes. Unrelated measurement projects were excluded. - The new frontend regression suite produced six failures against the previous browser storage implementation at `73a0bd246`, then passed with this migration. The comparison used a temporary Vite transform without editing production working-tree files. - Mandatory commit and pre-push checks passed: formatting, TypeScript and related unit tests, design checks, workspace Clippy, and publication checks. A merge simulation against current `origin/main` completed without conflicts. Two browser journeys were added (four cases across the engines), with none removed. They exercise app startup ordering and plugin activation/Settings integration; the state matrix remains in storage tests. Fixture datasets and workers are unchanged. A comparative setup-cost benchmark was not run; no performance claim is made. The earlier broader run at `15c902232` passed 337/340 cases across 19 complete specs. Its three failures reproduced on unchanged upstream `134248ba7`: macOS Alt+ArrowUp scrolling in both engines and sidebar keyboard focus in WebKit. That broader set has not been rerun locally for this migration; current hosted CI supplies the broad check. Native UI walkthrough and human acceptance of this migration remain pending. ### Review follow-up at `e6f8f4a07` - Extended the existing native/desktop parity test to guard the legacy-On migration set. No production declarations changed. - Added an isolated browser page with no fixture init scripts, seeded only with a client record. It checks both plugins stay On across reopening. This adds one journey (two engine cases); none were removed. - All **103 native package tests** and all **10 cases in the complete plugin-defaults browser spec** passed at the clean follow-up commit. Mandatory pre-push checks passed. - Investigated the advisory CI drag-loop failure. On clean pre-fix main [`b293002a0`](b293002), using its frozen dependencies and no changes from this PR, the same assertion failed twice in 10 Chromium repetitions: 4 drag steps versus at least 6. Its 10 WebKit repetitions passed locally. The assertion counts drag steps, not message rows. - Current main [`3fabf1be4`](3fabf1b) passed **20/20** repetitions across both engines. It already contains the shorter viewport / available-distance adjustment from [`f557d0a5`](f557d0a), along with a newer Virtua patch. The comparison does not isolate those two mainline adjustments. This establishes that the failure exists independently of this PR; the unrelated scrolling test remains unchanged here. Comparison command: `pnpm test:browser tests/browser/history-loading.spec.mjs --project=chromium --project=webkit --no-deps --grep 'a held pointer scrolls across the page without being pulled back' --repeat-each=10`. Local headless macOS runs used two workers and zero retries. Baseline traces were retained. CI originally reported [3 steps in Chromium](https://github.com/block/buzz-app/actions/runs/41732891881/job/126254970681) and [5 in WebKit](https://github.com/block/buzz-app/actions/runs/41732891881/job/126254970956). ### Screenshots Fresh-profile controls are visually unchanged by the migration. These captures are from the earlier built-app walkthrough with disposable data; the migration is covered by the current tests above. | Plugin | Fresh profile | | --- | --- | | Reminders | ![Reminders is off and offers Enable](https://github.com/user-attachments/assets/e8fbe142-0ebc-42b3-9b61-d60341af96f8) | | Workflows | ![Workflows is off and offers Enable](https://github.com/user-attachments/assets/ac18732a-8cb1-443f-9cd1-6989a2609c1c) | --------- Signed-off-by: Taylor Ho <[email protected]> Co-authored-by: Carl <acda9e433d19dcd0e6b6840f7f4b98f3a56f1fab98049d444c087019e6d36560@feedback.communities.buzz.xyz>
1 parent 73255c5 commit 83b72a3

28 files changed

Lines changed: 796 additions & 107 deletions

‎AGENTS.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ need no per-worktree setup; see [Git hooks](docs/contributing.md#git-hooks).
8181

8282
## Engineering standard
8383

84+
When changing a shipped plugin to default-off, follow the
85+
[plugin-defaults decision](docs/plugin-defaults.md): apply it to fresh installs
86+
and preserve existing installs' effective states, including implicit defaults.
87+
8488
When changing user-facing Buzz behavior, update [the agent help guide](docs/buzz-help.md)
8589
if the change affects how someone uses or understands the app. Keep it concise,
8690
describe implemented behavior, and distinguish optional or platform-dependent

‎crates/plugin-manager/src/lib.rs‎

Lines changed: 64 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,11 @@ fn enabled_by_default(id: &str) -> bool {
507507
| "buzz.watching"
508508
| "buzz.pairing"
509509
| "buzz.inbox"
510-
| "buzz.reminders"
511510
| "buzz.repos"
512511
| "buzz.agents"
513512
| "buzz.claude-code"
514513
| "buzz.codex"
515514
| "buzz.goose"
516-
| "buzz.workflows"
517515
| "block.builderlab"
518516
| "buzz.moderation"
519517
| "buzz.relay-staff"
@@ -603,6 +601,22 @@ impl Default for Registry {
603601
}
604602
}
605603
}
604+
// Freeze known defaults so later releases cannot silently withdraw a feature.
605+
fn pin_bundled_defaults(registry: &mut Registry, existing_profile: bool) -> bool {
606+
let mut changed = false;
607+
for manifest in bundled_manifests() {
608+
registry
609+
.bundled_overrides
610+
.entry(manifest.id.clone())
611+
.or_insert_with(|| {
612+
changed = true;
613+
enabled_by_default(&manifest.id)
614+
|| (existing_profile
615+
&& matches!(manifest.id.as_str(), "buzz.reminders" | "buzz.workflows"))
616+
});
617+
}
618+
changed
619+
}
606620
#[derive(Deserialize, Serialize)]
607621
#[serde(rename_all = "camelCase", deny_unknown_fields)]
608622
struct Artifact {
@@ -798,6 +812,7 @@ pub struct Manager {
798812
root: PathBuf,
799813
profile: String,
800814
safe_mode: bool,
815+
existing_profile: bool,
801816
}
802817
impl Manager {
803818
/// Host control-plane location that protected workers must not modify.
@@ -814,11 +829,15 @@ impl Manager {
814829
if !home.is_absolute() {
815830
return Err("Plugin home must be an absolute path".into());
816831
}
832+
let root = home.join("profiles").join(profile);
833+
// Catalog reads created this folder even when no preferences were saved.
834+
let existing_profile = root.try_exists().map_err(err)?;
817835
Ok(Self {
818-
root: home.join("profiles").join(profile),
836+
root,
819837
home,
820838
profile: profile.into(),
821839
safe_mode,
840+
existing_profile,
822841
})
823842
}
824843
/// Opens the environment's plugin home, else `home`: the desktop passes its own app data folder.
@@ -850,15 +869,11 @@ impl Manager {
850869
}
851870
fn read(&self) -> Result<Registry> {
852871
let path = self.root.join("registry.json");
853-
let file = match File::open(&path) {
854-
Ok(file) => file,
855-
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {
856-
return Ok(Registry::default())
857-
}
872+
let mut r: Registry = match File::open(&path) {
873+
Ok(file) => serde_json::from_str(&read_file_limited(file)?).map_err(err)?,
874+
Err(error) if error.kind() == std::io::ErrorKind::NotFound => Registry::default(),
858875
Err(error) => return Err(err(error)),
859876
};
860-
let text = read_file_limited(file)?;
861-
let mut r: Registry = serde_json::from_str(&text).map_err(err)?;
862877
if r.version != 1 && r.version != 2 {
863878
return Err(
864879
"Unsupported settings version; use a compatible Buzz or recover settings".into(),
@@ -883,8 +898,14 @@ impl Manager {
883898
valid_hash(h)?;
884899
}
885900
}
886-
if migrate_agent_flag::migrate(&mut r) {
901+
let renamed = migrate_agent_flag::migrate(&mut r);
902+
let pinned = pin_bundled_defaults(&mut r, self.existing_profile);
903+
if renamed {
887904
self.save(&r)?;
905+
} else if pinned {
906+
// Readable settings must remain usable when the default snapshot
907+
// cannot be written. Later reads retry; explicit edits still fail.
908+
let _ = self.save(&r);
888909
}
889910
Ok(r)
890911
}
@@ -1314,7 +1335,9 @@ impl Manager {
13141335
backup.as_file().sync_all().map_err(err)?;
13151336
backup.keep().map_err(err)?;
13161337
}
1317-
self.save(&Registry::default())?;
1338+
let mut defaults = Registry::default();
1339+
pin_bundled_defaults(&mut defaults, false);
1340+
self.save(&defaults)?;
13181341
}
13191342
self.catalog()
13201343
}
@@ -1627,6 +1650,33 @@ mod tests {
16271650
.collect();
16281651
assert_eq!(native, expected);
16291652

1653+
let storage = fs::read_to_string(format!("{root}/../plugins/storage.ts")).unwrap();
1654+
let mut browser_legacy_on: Vec<_> = storage
1655+
.split("(existing && (")
1656+
.nth(1)
1657+
.expect("browser legacy-On condition")
1658+
.split("))")
1659+
.next()
1660+
.unwrap()
1661+
.split('"')
1662+
.skip(1)
1663+
.step_by(2)
1664+
.collect();
1665+
browser_legacy_on.sort_unstable();
1666+
let mut upgraded = super::Registry::default();
1667+
super::pin_bundled_defaults(&mut upgraded, true);
1668+
let native_legacy_on: Vec<_> = upgraded
1669+
.bundled_overrides
1670+
.iter()
1671+
.filter_map(|(id, enabled)| {
1672+
(*enabled && !enabled_by_default(id)).then_some(id.as_str())
1673+
})
1674+
.collect();
1675+
assert_eq!(
1676+
native_legacy_on, browser_legacy_on,
1677+
"legacy-On migration set"
1678+
);
1679+
16301680
let features =
16311681
fs::read_to_string(format!("{root}/../app/conversation-features.ts")).unwrap();
16321682
let manifests: BTreeMap<_, _> = features
@@ -2476,11 +2526,8 @@ mod tests {
24762526
&fs::read(manager.storage_root().join("registry.json")).unwrap(),
24772527
)
24782528
.unwrap();
2479-
assert_eq!(
2480-
saved["bundledOverrides"],
2481-
serde_json::json!({ "buzz.agents": true }),
2482-
"the switch now uses the current plugin id"
2483-
);
2529+
assert_eq!(saved["bundledOverrides"]["buzz.agents"], true);
2530+
assert!(saved["bundledOverrides"].get("buzz.agents2").is_none());
24842531
}
24852532

24862533
#[test]

0 commit comments

Comments
 (0)