feat #14740: release builds use the production backend

Release builds talk to https://backend.euvinopro.eu, debug builds keep
https://test.euvinopro.eu. A key bound to the test backend is discarded
in a release build (fresh login).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hauke
2026-11-09 10:51:09 +01:00
co-authored by Claude Opus 5.5
parent a0f89454f9
commit d0ece263a2
2 changed files with 55 additions and 7 deletions
+45 -2
View File
@@ -1538,6 +1538,42 @@ mod tests {
}
}
/// The real transition the review asked to lock in: a key created while
/// this install talked to the test backend must not work once the same
/// install is a release build talking to the production backend — it is
/// discarded and a fresh login is required, exactly like any other
/// backend mismatch above, but with the two real build-time constants
/// instead of a placeholder domain.
#[test]
fn a_key_from_the_test_backend_does_not_work_for_a_release_build() {
let mut f = fixture();
// A build on the test backend (what `cargo tauri dev` is), whatever
// profile this test itself runs in.
f.state.backend_url = crate::backend::DEV_BACKEND_URL.to_string();
f.state
.store_backend_key(
&new_key("euv_test"),
crate::backend::DEV_BACKEND_URL,
Some("hinrichs".into()),
)
.unwrap();
assert!(f.state.backend_key().is_some());
// Same keyring entry and settings file; now read as a release build
// would (a different `backend_url`, nothing else changed).
f.state.backend_url = crate::backend::RELEASE_BACKEND_URL.to_string();
assert_eq!(
f.state.backend_key(),
None,
"a test-backend key must not work for the release backend"
);
assert_eq!(f.state.secrets.get(Service::Backend), None);
let settings = f.state.settings();
assert_eq!(settings.backend_username, None);
assert_eq!(settings.backend_key_base_url, None);
}
#[test]
fn the_backend_login_is_refreshed_from_the_key_info() {
let f = fixture();
@@ -1622,10 +1658,17 @@ mod tests {
#[test]
fn the_backend_is_fixed_per_build() {
let f = fixture();
assert_eq!(f.state.backend_url(), "https://test.euvinopro.eu");
// Debug builds (`cargo tauri dev`, `cargo test`) use the test
// backend, release builds the production one.
let expected = if cfg!(debug_assertions) {
"https://test.euvinopro.eu"
} else {
"https://backend.euvinopro.eu"
};
assert_eq!(f.state.backend_url(), expected);
assert_eq!(
f.state.backend_client().login_url(),
"https://test.euvinopro.eu/euvadm"
format!("{expected}/euvadm")
);
}