diff --git a/crates/ghostlight-dungeon/src/session_zero.rs b/crates/ghostlight-dungeon/src/session_zero.rs index 9b512e3..bd23bfb 100644 --- a/crates/ghostlight-dungeon/src/session_zero.rs +++ b/crates/ghostlight-dungeon/src/session_zero.rs @@ -2345,7 +2345,13 @@ pub fn session_zero_surface( &[], )); } - if member.is_host && state.roster_locked && state.status == SessionZeroStatus::RosterLocked { + if member.is_host + && matches!( + state.status, + SessionZeroStatus::RosterLocked | SessionZeroStatus::Drafting + ) + && state.compilation_brief().is_ok() + { children.push(command_control( "session-zero.compile", "Compile campaign preview", @@ -3726,6 +3732,31 @@ mod tests { .unwrap() } + fn compilable_state() -> SessionZeroState { + let mut draft = state(); + draft.contract.premise = "Keep a refugee clinic supplied during a political crisis.".into(); + draft.contract.canon_horizon = "After Burden of Proof".into(); + draft.contract.starting_where = "Hellas, Mars".into(); + draft.contract.starting_when = "During a Zhestokost ration strike".into(); + draft.contract.starting_pressure = "A ration strike and refugee convoy".into(); + draft.contract.desired_goal = "Protect the clinic without becoming an informant.".into(); + draft.contract.tone = vec!["serious political drama".into()]; + draft.contract.pacing = "deliberate pressure with sharp turns".into(); + draft.contract.consequence_style = "durable, low arbitrary lethality".into(); + draft.contract.narrative_focus = "institutional leverage and human solidarity".into(); + draft.contract.dm_style = "candid, challenging, and humane".into(); + let character = draft + .character_drafts + .get_mut(&draft.host_member_id) + .unwrap(); + character.public_premise = + "A Corvid logistics mediator caught between institutions.".into(); + character.capabilities = vec!["Route planning".into()]; + character.goals = vec!["Get the convoy through".into()]; + character.obligations = vec!["A life-debt to the quartermaster".into()]; + draft + } + #[tokio::test] async fn director_receives_stable_output_contracts_before_dynamic_context() { let director = SessionZeroDirector::new( @@ -4404,10 +4435,26 @@ mod tests { assert!(encoded.contains("Discuss")); assert!(encoded.contains("session_zero.boundary.remove")); assert!(encoded.contains("\"bindingName\":\"counter\"")); + assert!(encoded.contains("\"maxLength\":2000")); assert!(!encoded.contains("payload.fields")); assert!(!encoded.contains("\"kind\":\"form\"")); } + #[test] + fn compilable_locked_draft_can_retry_after_compiler_failure() { + let mut draft = compilable_state(); + draft.roster_locked = true; + draft.status = SessionZeroStatus::Drafting; + let encoded = + serde_json::to_string(&session_zero_surface(&draft, "account:host").unwrap()).unwrap(); + assert!(encoded.contains("Compile campaign preview")); + + draft.status = SessionZeroStatus::Compiling; + let encoded = + serde_json::to_string(&session_zero_surface(&draft, "account:host").unwrap()).unwrap(); + assert!(!encoded.contains("Compile campaign preview")); + } + #[test] fn player_surface_projects_the_complete_private_ledger_and_exact_typed_change() { let mut draft = state(); diff --git a/docs/architecture/ghostlight-dungeon-session-zero.md b/docs/architecture/ghostlight-dungeon-session-zero.md index 39663a0..85aa56a 100644 --- a/docs/architecture/ghostlight-dungeon-session-zero.md +++ b/docs/architecture/ghostlight-dungeon-session-zero.md @@ -145,6 +145,10 @@ The compiler receives an `approved_campaign_brief.v1`, not the transcript. Private character history and secrets are withheld from world generation; after the grounded seed validates, Ghostlight locally replaces the provisional compiler player with the exact approved actors at one shared start. +If compilation fails before a preview is installed, the roster remains locked +and the typed brief remains authoritative. A host whose current brief still +passes the readiness gate receives the Compile action again; retrying uses the +new revision and never replays or accepts transcript prose. Evidence gaps return the draft to conversation with explicit questions. A review preview records shared and per-character digests. Every active player