- #310: horodatage de tous les messages et événements de conversation visibles — composant partagé EntryTimestamp, timestamps propagés dans le transcript chat, les annonces inter-agent et le viewer de conversation, normalisation côté domain/adapters (conversation_log, paginate). - #311: stop d'agent robuste pour PTY non monté, sessions headless et CLI custom — lifecycle/orchestrator durcis, ponts chat app-tauri/web-server alignés, arrêt fiable sans session orpheline. - #312: préférence globale d'interface terminal par défaut — nouveau store settings (domain/application/infrastructure + tests), DTO et commandes backend, adapter frontend userSettings, panneau TerminalSettings dans les paramètres globaux. - #313: Paramètres du projet — contexte de projet éditable et couleur de thème par projet (ProjectSettingsPanel + projectTheme), teinte des onglets projet, persistance via DTO projet. QA verte (GO QA sur feature/batch-310-311-312-313-chat-stop-prefs-theme) — vérifications Git: git diff --cached --check OK; staging borné à crates/ et frontend/ (74 fichiers, +2105/-531), commit unique de lot conforme à la convention des lots (précédents batch-151/158/159, batch-210/211/212) car les fichiers partagés (dto.rs, commands.rs, CustomAgentChatView) entrelacent les 4 tickets. fichiers .ideai/* (agents/test.md, chat-drafts.json, system-permissions.json, tickets/counter.json, tickets/index.json, tickets/308-313/), attachments/ et scripts/ hors périmètre et préservés en worktree ; aucun push. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
75 lines
2.3 KiB
Rust
75 lines
2.3 KiB
Rust
use std::path::PathBuf;
|
|
use std::sync::Arc;
|
|
|
|
use domain::{
|
|
DefaultAgentTerminalInterface, FileSystem, IdeaUserSettings, ProjectPath, ProjectSettings,
|
|
ProjectSettingsStore, ThemeColor, UserSettingsStore,
|
|
};
|
|
use infrastructure::{FsProjectSettingsStore, FsUserSettingsStore, LocalFileSystem};
|
|
use uuid::Uuid;
|
|
|
|
struct TempDir(PathBuf);
|
|
impl TempDir {
|
|
fn new() -> Self {
|
|
let path = std::env::temp_dir().join(format!("idea-settings-{}", Uuid::new_v4()));
|
|
std::fs::create_dir_all(&path).unwrap();
|
|
Self(path)
|
|
}
|
|
fn root(&self) -> ProjectPath {
|
|
ProjectPath::new(self.0.to_string_lossy().into_owned()).unwrap()
|
|
}
|
|
}
|
|
impl Drop for TempDir {
|
|
fn drop(&mut self) {
|
|
let _ = std::fs::remove_dir_all(&self.0);
|
|
}
|
|
}
|
|
fn fs() -> Arc<dyn FileSystem> {
|
|
Arc::new(LocalFileSystem::new())
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn global_user_preference_persists_outside_project() {
|
|
let tmp = TempDir::new();
|
|
let store = FsUserSettingsStore::new(fs(), tmp.0.to_string_lossy());
|
|
assert_eq!(store.load().await.unwrap(), IdeaUserSettings::default());
|
|
let settings = IdeaUserSettings {
|
|
default_agent_terminal_interface: Some(DefaultAgentTerminalInterface::IdeaCli),
|
|
};
|
|
store.save(&settings).await.unwrap();
|
|
assert_eq!(
|
|
FsUserSettingsStore::new(fs(), tmp.0.to_string_lossy())
|
|
.load()
|
|
.await
|
|
.unwrap(),
|
|
settings
|
|
);
|
|
assert!(tmp.0.join("settings.json").is_file());
|
|
assert!(!tmp.0.join(".ideai").exists());
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn project_settings_missing_then_valid_round_trip() {
|
|
let tmp = TempDir::new();
|
|
let store = FsProjectSettingsStore::new(fs());
|
|
assert_eq!(
|
|
store.load(&tmp.root()).await.unwrap(),
|
|
ProjectSettings::default()
|
|
);
|
|
assert!(!tmp.0.join(".ideai/project-settings.json").exists());
|
|
let settings = ProjectSettings {
|
|
theme_color: Some(ThemeColor::new("#12AbEF").unwrap()),
|
|
};
|
|
store.save(&tmp.root(), &settings).await.unwrap();
|
|
assert_eq!(store.load(&tmp.root()).await.unwrap(), settings);
|
|
assert!(!tmp.0.join(".ideai/CONTEXT.md").exists());
|
|
}
|
|
|
|
#[test]
|
|
fn theme_color_validation_is_strict() {
|
|
assert!(ThemeColor::new("#112233").is_ok());
|
|
for invalid in ["112233", "#123", "#GG0000", "#11223344", "# 12233"] {
|
|
assert!(ThemeColor::new(invalid).is_err(), "accepted {invalid}");
|
|
}
|
|
}
|