Skip to content

Notify on detected config drift#216

Merged
cooper (czxtm) merged 11 commits into
developfrom
cursor/ENG-514-linear-issue-triage-automation-51b4
Jun 4, 2026
Merged

Notify on detected config drift#216
cooper (czxtm) merged 11 commits into
developfrom
cursor/ENG-514-linear-issue-triage-automation-51b4

Conversation

@cursor

@cursor cursor Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a native macOS notification path for watcher-detected drift:

  • sends a deduped notification when uncommitted config drift is detected
  • sends a separate notification when an external nix build changes the live store path
  • uses the macOS UserNotifications framework for native delivery
  • preserves the current frontend watcher event flow via git_state_changed and change_map_changed

Test Plan

  • rustfmt --edition 2021 --check apps/native/src-tauri/src/state/watcher.rs apps/native/src-tauri/src/state/drift_notifications.rs apps/native/src-tauri/src/storage/credential_store.rs apps/native/src-tauri/src/summarize/queue_summarizer.rs
  • bun -F native build
  • Attempted cargo test --manifest-path apps/native/src-tauri/Cargo.toml drift_notifications, but this runner is missing the system glib-2.0.pc dependency required by glib-sys.

Docs

No docs update needed.

@github-actions

github-actions Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor
Messages
📖

🤖 This PR touches CI / infra — reviewers please pay extra attention:

  • .github/workflows/storybook.yaml

📋 PR Overview

Lines changed 455 (+445 / -10)
Files 1 added, 4 modified, 0 deleted
Draft / WIP no
Has Test Plan yes
No Test Plan Needed no
New UI components no
New Storybook stories no
New Rust modules yes (1)
New TS source files no
New tests no
package.json touched no
Cargo.toml touched no
Infra / CI touched yes

🔬 Coverage

Report Lines Statements Functions Branches
apps/native/coverage/coverage-summary.json 21.9% 21.9% 30.3% 56.9%

Generated by 🚫 dangerJS against 6dcc1f9

@czxtm cooper (czxtm) changed the base branch from main to develop May 31, 2026 20:24
@czxtm cooper (czxtm) marked this pull request as ready for review May 31, 2026 20:25
Copilot AI review requested due to automatic review settings May 31, 2026 20:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds native-side drift notifications in the Tauri (Rust) app so that watcher-detected config drift can surface as a macOS notification while keeping the existing git:status-changed frontend event flow intact (ENG-514).

Changes:

  • Emit a native drift notification when uncommitted config drift is detected (deduped).
  • Emit a native drift notification when an external nix build changes the live store path.
  • Introduce state::drift_notifications and hook it into the watcher loop.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
apps/native/src-tauri/src/state/watcher.rs Constructs a WatcherEvent, emits git:status-changed, and triggers native drift notifications.
apps/native/src-tauri/src/state/mod.rs Exposes the new drift_notifications module.
apps/native/src-tauri/src/state/drift_notifications.rs Implements deduping + macOS notification delivery and unit tests for notification selection.

Comment on lines +119 to +128
let event = WatcherEvent {
git_status: Some(status.clone()),
change_map: Some(change_map),
evolve_state: evolve_state_updated,
error: None,
external_build_detected,
};
// fire-and-forget: frontend event delivery; window may not be connected.
let _ = app_handle.emit(
"git:status-changed",
WatcherEvent {
git_status: Some(status.clone()),
change_map: Some(change_map),
evolve_state: evolve_state_updated,
error: None,
external_build_detected,
},
);
let _ = app_handle.emit("git:status-changed", event.clone());
drift_notifications::maybe_notify(&event);
Comment thread apps/native/src-tauri/src/state/drift_notifications.rs
Comment on lines +69 to +88
#[cfg(target_os = "macos")]
fn send_native_notification(title: &str, body: &str) -> Result<(), String> {
use cocoa::base::{id, nil};
use cocoa::foundation::{NSAutoreleasePool, NSString};
use objc::{class, msg_send, sel, sel_impl};

unsafe {
let pool = NSAutoreleasePool::new(nil);
let notification: id = msg_send![class!(NSUserNotification), new];
let title = NSString::alloc(nil).init_str(title);
let body = NSString::alloc(nil).init_str(body);

let _: () = msg_send![notification, setTitle: title];
let _: () = msg_send![notification, setInformativeText: body];

let center: id = msg_send![
class!(NSUserNotificationCenter),
defaultUserNotificationCenter
];
let _: () = msg_send![center, deliverNotification: notification];
@czxtm

Copy link
Copy Markdown
Member

Copilot resolve the merge conflicts in this pull request

Comment thread apps/native/src/ipc/api.ts Fixed

Copilot AI commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved and pushed. The PR now includes the conflict resolution merge from origin/develop and follow-up fixes in commits b059be1 and 3d55c41.

Comment thread apps/native/src/ipc/api.ts Fixed
@czxtm cooper (czxtm) enabled auto-merge June 3, 2026 05:40
auto-merge was automatically disabled June 3, 2026 05:45

Head branch was pushed to by a user without write access

Copilot AI requested a review from cooper (czxtm) June 3, 2026 05:48
@czxtm cooper (czxtm) enabled auto-merge June 3, 2026 06:34
@czxtm

Copy link
Copy Markdown
Member

Copilot resolve the merge conflicts in this pull request

@graphite-app

graphite-app Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Merge activity

  • Jun 4, 11:25 AM UTC: This pull request can not be added to the Graphite merge queue. Please try rebasing and resubmitting to merge when ready.
  • Jun 4, 11:25 AM UTC: Graphite disabled "merge when ready" on this PR due to: a merge conflict with the target branch; resolve the conflict and try again..

@czxtm cooper (czxtm) force-pushed the cursor/ENG-514-linear-issue-triage-automation-51b4 branch 2 times, most recently from dd48979 to b0e662c Compare June 4, 2026 11:32
auto-merge was automatically disabled June 4, 2026 11:32

Head branch was pushed to by a user without write access

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Resolved and pushed in merge commit fea928a.

Co-authored-by: cooper <czxtm@users.noreply.github.com>
Co-authored-by: cooper <czxtm@users.noreply.github.com>
Co-authored-by: cooper <czxtm@users.noreply.github.com>
Co-authored-by: cooper <czxtm@users.noreply.github.com>
Co-authored-by: cooper <czxtm@users.noreply.github.com>
Co-authored-by: cooper <czxtm@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@czxtm cooper (czxtm) force-pushed the cursor/ENG-514-linear-issue-triage-automation-51b4 branch from fea928a to 14a909e Compare June 4, 2026 11:41
Comment thread apps/native/src/ipc/api.ts Fixed
…ypes

The --theirs rebase onto develop left mixed architectures. Restore
develop's queue_summarizer (SummarizerState/mpsc worker), watcher
(per-slice GitState events), api.ts (drop duplicate devConfigs), and
regenerated ipc/types.ts (GitState/ExportResult/ImportResult; drop
removed WatcherEvent/SummarizerUpdateEvent). Re-add GitState specta
registration. Adapt drift_notifications to take GitStatus directly
instead of the removed WatcherEvent.
@czxtm cooper (czxtm) added this pull request to the merge queue Jun 4, 2026
Merged via the queue into develop with commit 9c4f757 Jun 4, 2026
14 checks passed
@czxtm cooper (czxtm) deleted the cursor/ENG-514-linear-issue-triage-automation-51b4 branch June 4, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants