fix(layout): auto-réparer l'onglet actif

stale

Le backend renvoie l'id actif autoritaire et le
    frontend l'adopte pour éviter de rejouer un layout
    disparu après overwrite externe.

Co-Authored-By: Claude Opus 4.8
    <noreply@anthropic.com>
This commit is contained in:
2026-06-25 16:23:40 +02:00
parent 137620daa3
commit e916ecd95e
14 changed files with 372 additions and 51 deletions

View File

@ -390,7 +390,7 @@ pub fn parse_session_id(raw: &str) -> Result<SessionId, ErrorDto> {
use application::{
CreateLayoutOutput, DeleteLayoutOutput, LayoutInfo, LayoutOperation, ListLayoutsOutput,
LoadLayoutOutput, MutateLayoutOutput,
LoadLayoutOutput, MutateLayoutOutput, SetActiveLayoutOutput,
};
use domain::{AgentId, Direction, LayoutId, LayoutTree, NodeId};
@ -700,6 +700,23 @@ pub struct DeleteLayoutRequestDto {
pub layout_id: String,
}
/// Response DTO for `set_active_layout`.
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SetActiveLayoutResultDto {
/// The layout actually activated — equals the requested id when valid, else
/// the unchanged current active id (self-healing fallback). Authoritative.
pub active_id: String,
}
impl From<SetActiveLayoutOutput> for SetActiveLayoutResultDto {
fn from(out: SetActiveLayoutOutput) -> Self {
Self {
active_id: out.active_id.to_string(),
}
}
}
/// Request DTO for `set_active_layout`.
#[derive(Debug, Clone, Deserialize)]
#[serde(rename_all = "camelCase")]