first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+40 -66
View File
@@ -1,10 +1,8 @@
use anyhow::Result;
use galaxyui::{AppContext, SingletonEntity};
use galaxyui_core::{AppContext, SingletonEntity};
use crate::manager::SettingsManager;
use crate::{Setting, SupportedPlatforms, SyncToCloud};
use crate::*;
use crate::{Setting, SupportedPlatforms, SyncToCloud, *};
define_settings_group!(TestSettings, settings: [
simple_setting: SimpleSetting {
@@ -53,9 +51,9 @@ struct EventListener {
}
impl EventListener {
fn new(ctx: &mut galaxyui::ModelContext<Self>) -> Self {
fn new(ctx: &mut galaxyui_core::ModelContext<Self>) -> Self {
let test_settings = TestSettings::handle(ctx);
ctx.subscribe_to_model(&test_settings, |me, event, _ctx| {
ctx.subscribe_to_model(&test_settings, |me, _, event, _ctx| {
// Update our internal state if we get a change event for
// SimpleSetting.
if matches!(event, TestSettingsChangedEvent::SimpleSetting { .. }) {
@@ -67,7 +65,7 @@ impl EventListener {
}
}
impl galaxyui::Entity for EventListener {
impl galaxyui_core::Entity for EventListener {
type Event = ();
}
@@ -92,7 +90,7 @@ fn test_can_override_storage_key() {
#[test]
fn test_set_value_raises_changed_event_no_save() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
@@ -124,7 +122,7 @@ fn test_set_value_raises_changed_event_no_save() {
#[test]
fn test_set_value_raises_changed_event_save() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
@@ -156,7 +154,7 @@ fn test_set_value_raises_changed_event_save() {
#[test]
fn test_save_and_load_lifecycle() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
@@ -195,7 +193,7 @@ fn test_save_and_load_lifecycle() {
#[test]
fn test_toggleable_setting() -> Result<()> {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
@@ -254,7 +252,7 @@ fn test_explicit_value_tracking_with_some() {
#[test]
fn test_explicit_value_tracking_after_set_value() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
@@ -284,7 +282,7 @@ fn test_explicit_value_tracking_after_set_value() {
#[test]
fn test_explicit_value_tracking_after_clear_value() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
@@ -325,7 +323,7 @@ fn test_explicit_value_tracking_after_clear_value() {
#[test]
fn test_explicit_value_tracking_from_storage() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
@@ -399,7 +397,7 @@ fn test_private_setting_storage_key_is_explicit_override() {
#[test]
fn test_load_value_updates_value_without_persisting() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -430,7 +428,7 @@ fn test_load_value_updates_value_without_persisting() {
#[test]
fn test_load_value_emits_event_on_change() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -461,7 +459,7 @@ fn test_load_value_emits_event_on_change() {
#[test]
fn test_load_value_skips_event_when_unchanged() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -490,7 +488,7 @@ fn test_load_value_skips_event_when_unchanged() {
#[test]
fn test_load_value_updates_explicitly_set_flag() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -526,7 +524,7 @@ fn test_load_value_updates_explicitly_set_flag() {
#[test]
fn test_load_value_resets_explicitly_set_flag() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -569,7 +567,7 @@ fn test_load_value_resets_explicitly_set_flag() {
#[test]
fn test_explicit_value_tracking_cloud_sync() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
@@ -627,11 +625,6 @@ mod file_transform_tests {
// Private / public settings split tests
// ---------------------------------------------------------------------------
// Tests that call `set_settings_file_enabled` are marked `#[serial_test::serial]`
// because they mutate the process-global `SETTINGS_FILE_ENABLED` AtomicBool and
// would race under `cargo test` (thread-based parallelism). This can be removed
// when the SettingsFile feature flag is cleaned up and the global flag is deleted.
#[test]
fn test_is_private_returns_false_for_public_setting() {
assert!(!SimpleSetting::is_private());
@@ -643,19 +636,9 @@ fn test_is_private_returns_true_for_private_setting() {
}
#[test]
#[serial_test::serial]
fn test_settings_file_enabled_flag_round_trip() {
crate::set_settings_file_enabled(true);
assert!(crate::is_settings_file_enabled());
crate::set_settings_file_enabled(false);
assert!(!crate::is_settings_file_enabled());
}
#[test]
#[serial_test::serial]
fn test_public_setting_writes_to_public_prefs_when_flag_enabled() {
crate::set_settings_file_enabled(true);
galaxyui::App::test((), |mut app| async move {
let _guard = galaxy_features::FeatureFlag::SettingsFile.override_enabled(true);
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -690,10 +673,9 @@ fn test_public_setting_writes_to_public_prefs_when_flag_enabled() {
}
#[test]
#[serial_test::serial]
fn test_private_setting_writes_to_private_prefs_when_flag_enabled() {
crate::set_settings_file_enabled(true);
galaxyui::App::test((), |mut app| async move {
let _guard = galaxy_features::FeatureFlag::SettingsFile.override_enabled(true);
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -737,10 +719,9 @@ fn test_private_setting_writes_to_private_prefs_when_flag_enabled() {
}
#[test]
#[serial_test::serial]
fn test_new_from_storage_reads_from_correct_backend_when_flag_enabled() {
crate::set_settings_file_enabled(true);
galaxyui::App::test((), |mut app| async move {
let _guard = galaxy_features::FeatureFlag::SettingsFile.override_enabled(true);
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -775,10 +756,9 @@ fn test_new_from_storage_reads_from_correct_backend_when_flag_enabled() {
}
#[test]
#[serial_test::serial]
fn test_clear_value_clears_from_correct_backend() {
crate::set_settings_file_enabled(true);
galaxyui::App::test((), |mut app| async move {
let _guard = galaxy_features::FeatureFlag::SettingsFile.override_enabled(true);
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -831,10 +811,9 @@ fn test_clear_value_clears_from_correct_backend() {
}
#[test]
#[serial_test::serial]
fn test_public_setting_uses_private_prefs_when_flag_disabled() {
crate::set_settings_file_enabled(false);
galaxyui::App::test((), |mut app| async move {
let _guard = galaxy_features::FeatureFlag::SettingsFile.override_enabled(false);
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -872,10 +851,9 @@ fn test_public_setting_uses_private_prefs_when_flag_disabled() {
}
#[test]
#[serial_test::serial]
fn test_private_setting_uses_private_prefs_when_flag_disabled() {
crate::set_settings_file_enabled(false);
galaxyui::App::test((), |mut app| async move {
let _guard = galaxy_features::FeatureFlag::SettingsFile.override_enabled(false);
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -906,10 +884,9 @@ fn test_private_setting_uses_private_prefs_when_flag_disabled() {
}
#[test]
#[serial_test::serial]
fn test_new_from_storage_reads_from_private_backend_when_flag_disabled() {
crate::set_settings_file_enabled(false);
galaxyui::App::test((), |mut app| async move {
let _guard = galaxy_features::FeatureFlag::SettingsFile.override_enabled(false);
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -950,7 +927,7 @@ fn test_new_from_storage_reads_from_private_backend_when_flag_disabled() {
#[test]
fn test_manager_is_private_for_storage_key() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -975,7 +952,7 @@ fn test_manager_is_private_for_storage_key() {
#[test]
fn test_manager_default_values_for_settings_file_excludes_private() {
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -1003,10 +980,9 @@ fn test_manager_default_values_for_settings_file_excludes_private() {
}
#[test]
#[serial_test::serial]
fn test_manager_read_local_setting_value_routes_when_flag_enabled() {
crate::set_settings_file_enabled(true);
galaxyui::App::test((), |mut app| async move {
let _guard = galaxy_features::FeatureFlag::SettingsFile.override_enabled(true);
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -1051,10 +1027,9 @@ fn test_manager_read_local_setting_value_routes_when_flag_enabled() {
}
#[test]
#[serial_test::serial]
fn test_manager_read_local_setting_value_falls_back_when_flag_disabled() {
crate::set_settings_file_enabled(false);
galaxyui::App::test((), |mut app| async move {
let _guard = galaxy_features::FeatureFlag::SettingsFile.override_enabled(false);
galaxyui_core::App::test((), |mut app| async move {
app.update(init_and_register_preferences);
app.add_singleton_model(|_| SettingsManager::default());
TestSettings::register(&mut app);
@@ -1102,15 +1077,14 @@ fn test_manager_read_local_setting_value_falls_back_when_flag_disabled() {
/// section like `[account]` are invisible to the SettingsManager and the
/// cloud preferences syncer clobbers them with stale cloud state.
#[test]
#[serial_test::serial]
fn test_manager_read_local_setting_value_respects_hierarchy_with_settings_file() {
use galaxyui_extras::user_preferences::toml_backed::TomlBackedUserPreferences;
crate::set_settings_file_enabled(true);
let _guard = galaxy_features::FeatureFlag::SettingsFile.override_enabled(true);
let dir = tempfile::tempdir().unwrap();
let file_path = dir.path().join("settings.toml");
galaxyui::App::test((), |mut app| async move {
galaxyui_core::App::test((), |mut app| async move {
// Use the TOML-backed store for public preferences so the hierarchy
// routing actually matters; in-memory preferences ignore hierarchy
// entirely and would hide this bug.