Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions app/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ tauri-plugin-opener = "2"
# `cef::initialize(...) != 1` cache-lock panic seen in production
# (Sentry OPENHUMAN-TAURI-A). The plugin acquires a per-identifier
# lock before any tauri::Builder work happens, so the secondary
# process exits cleanly after handing its argv to the primary.
tauri-plugin-single-instance = "2"
# process exits cleanly after handing its argv to the primary. The `deep-link`
# feature forwards second-launch deep-link payloads to the primary instance on
# Windows/Linux, which is required for hot-instance OAuth callbacks.
tauri-plugin-single-instance = { version = "2", features = ["deep-link"] }
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.

[major] Missing regression test required by #2228 acceptance criteria.

The issue explicitly lists:

  • Regression safety — Unit, integration, or E2E coverage added or updated so the single-instance deep-link wiring is verified.
  • Diff coverage ≥ 80 %

Suggestion: add a build-time assertion that tauri-plugin-single-instance includes the deep-link feature, e.g.:

#[cfg(test)]
#[test]
fn single_instance_has_deep_link_feature() {
    // cargo metadata already verified this in CI validation,
    // but a compiled test catches regressions if someone removes the feature.
    assert!(cfg!(feature = "deep-link") || cfg!(target_os = "macos"),
            "tauri-plugin-single-instance must enable the deep-link feature on Windows/Linux");
}

Alternatively, a CI script assertion using cargo metadata --no-deps works too — the PR's own validation section already describes the command.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Added a regression test in 4065975tests::single_instance_dep_enables_deep_link_feature in app/src-tauri/src/lib.rs parses Cargo.toml at test time and asserts the deep-link feature is present on tauri-plugin-single-instance. This fails fast if anyone removes the feature flag in the future (issue #2228 regression safety + diff coverage). I went with a Cargo.toml-parse test rather than the suggested cfg!(feature = "deep-link") form because cfg! checks features of this crate (OpenHuman), not the transitive plugin crate, so it wouldn't actually catch the regression we care about.

# Auto-update for the Tauri shell itself. The core sidecar already has its own
# updater (see `core_update.rs`); this plugin handles the .app/.exe/.AppImage
# bundle. Both are needed because shipping a new RPC method requires both
Expand Down
30 changes: 30 additions & 0 deletions app/src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3714,4 +3714,34 @@ mod tests {
None => std::env::remove_var("PATH"),
}
}

/// Regression guard for issue #2228: `tauri-plugin-single-instance` must
/// enable the `deep-link` feature so that second-launch deep-link payloads
/// (e.g. `openhuman://oauth/...` callbacks from Windows/Linux system
/// browsers) are forwarded into the primary instance. Without it, hot OAuth
/// callbacks silently no-op while only focusing the existing window.
#[test]
fn single_instance_dep_enables_deep_link_feature() {
let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("Cargo.toml");
let manifest =
std::fs::read_to_string(&manifest_path).expect("read app/src-tauri/Cargo.toml");
let parsed: toml::Value = manifest.parse().expect("parse Cargo.toml");

let dep = parsed
.get("dependencies")
.and_then(|d| d.get("tauri-plugin-single-instance"))
.expect("tauri-plugin-single-instance dependency must exist");

let features = dep.get("features").and_then(|f| f.as_array()).expect(
"tauri-plugin-single-instance must be a table with a `features` array \
— issue #2228 requires the `deep-link` feature to forward hot-instance \
OAuth callbacks on Windows/Linux",
);

assert!(
features.iter().any(|v| v.as_str() == Some("deep-link")),
"tauri-plugin-single-instance must enable the `deep-link` feature \
(issue #2228 — hot-instance OAuth callback forwarding)"
);
}
}
Loading