fix(server): inline test-auth helper so release build compiles

The local ensure_test_auth_methods helper in server.rs is reachable from
the pub fn create_app_state_with_store chain, which is compiled in
release builds even though only integration tests call it. After
2cb623561, the helper called SettingsLayer::ensure_test_auth_methods()
— which is gated behind #[cfg(any(test, feature = "test-support"))] —
so cargo build --release broke with E0599.

Inline the auth-methods setup locally. This one helper only needs the
ServerAuthMethod::DevToken default; it doesn't share the "new required
SettingsLayer field" concern that motivated the centralization.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-04-22 10:56:41 -04:00
parent 92a09adb20
commit 0d5e6cb0dd
No known key found for this signature in database

View file

@ -63,7 +63,8 @@ use fabro_store::{
};
use fabro_types::settings::run::RunMode;
use fabro_types::settings::server::{
GithubIntegrationSettings, GithubIntegrationStrategy, ServerAuthMethod,
GithubIntegrationSettings, GithubIntegrationStrategy, ServerAuthLayer, ServerAuthMethod,
ServerLayer,
};
use fabro_types::settings::{
InterpString, ServerSettings as ResolvedServerSettings, SettingsLayer,
@ -2580,10 +2581,19 @@ fn default_test_app_state_config(
}
fn ensure_test_auth_methods(settings: &Arc<RwLock<SettingsLayer>>) {
settings
.write()
.expect("test settings lock poisoned")
.ensure_test_auth_methods();
let mut settings = settings.write().expect("test settings lock poisoned");
if settings
.server
.as_ref()
.and_then(|server| server.auth.as_ref())
.and_then(|auth| auth.methods.as_ref())
.is_some()
{
return;
}
let server = settings.server.get_or_insert_with(ServerLayer::default);
let auth = server.auth.get_or_insert_with(ServerAuthLayer::default);
auth.methods = Some(vec![ServerAuthMethod::DevToken]);
}
pub fn create_app_state_with_store(