Skip to content

Commit ecb495f

Browse files
committed
E2E: force file-backed secret store under CMDR_E2E_MODE=1
A locked macOS Keychain pops a GUI password prompt for every secret read. During an unattended E2E run (overnight CI, `desktop-e2e-playwright` checker, agent-driven runs) nobody types the password — the dialog steals focus from the Tauri webview, every `tauriPage.keyboard.press` lands on the wrong window, and a sweep of tests goes red for non-code reasons. Same gate the dev wrapper already uses (`CMDR_SECRET_STORE=file`), now applied automatically when the binary detects E2E mode. E2E-session credentials end up in the ephemeral `CMDR_DATA_DIR` and disappear with it; no production behaviour changes.
1 parent 873f110 commit ecb495f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

  • apps/desktop/src-tauri/src/secrets

apps/desktop/src-tauri/src/secrets/mod.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ fn init_store() -> Box<dyn SecretStore> {
8181
return Box::new(plain_file::PlainFileStore::new(dir));
8282
}
8383

84+
// E2E runs must never hit the OS keychain. A locked macOS Keychain pops a
85+
// GUI password prompt that blocks every secret read until the user types
86+
// their password — fatal for an unattended test run (the dialog steals
87+
// focus, the tests time out, half the suite goes red for non-code reasons).
88+
// Force the file backend so an E2E session's credentials live alongside its
89+
// ephemeral data dir and disappear with it.
90+
if crate::test_mode::is_e2e_mode() {
91+
let dir = secret_store_dir();
92+
info!("Secret store: PlainFileStore (CMDR_E2E_MODE=1)");
93+
FILE_BACKED.store(true, std::sync::atomic::Ordering::Relaxed);
94+
return Box::new(plain_file::PlainFileStore::new(dir));
95+
}
96+
8497
#[cfg(target_os = "macos")]
8598
{
8699
info!("Secret store: KeychainStore (macOS)");

0 commit comments

Comments
 (0)