diff --git a/crates/ghostlight-dungeon/src/bin/ghostlight-gestalt-scale-smoke.rs b/crates/ghostlight-dungeon/src/bin/ghostlight-gestalt-scale-smoke.rs index 31dd274..6a4c04e 100644 --- a/crates/ghostlight-dungeon/src/bin/ghostlight-gestalt-scale-smoke.rs +++ b/crates/ghostlight-dungeon/src/bin/ghostlight-gestalt-scale-smoke.rs @@ -152,7 +152,7 @@ async fn main() -> anyhow::Result<()> { "cover":cover, "appraisals":output.wave.appraisals, "plan":plan, - "material_action_count":plan.institution_actions.len(), + "material_action_count":plan.institution_actions.len() + plan.gestalt_actions.len() + plan.actor_moves.len() + plan.member_migrations.len(), "explicit_inaction_count":explicit_inaction_count, "model_stage_receipts":output.stages.iter().map(|stage|&stage.receipt).collect::>(), "commit":committed, @@ -206,7 +206,10 @@ fn scale_campaign(budget: u8, pressure: &str) -> ghostlight_dungeon::domain::Cam format!("advance platform {}", index % 6), "publish a concrete commitment before the final vote".into(), ], - posture: format!("{} Bloc {} must choose its response.", pressure, index % 3), + posture: format!( + "Bloc {} is withholding a binding commitment pending the final notice.", + index % 3 + ), }, ) }) diff --git a/crates/ghostlight-dungeon/src/bin/ghostlight-strategic-smoke.rs b/crates/ghostlight-dungeon/src/bin/ghostlight-strategic-smoke.rs index 9984112..45efb9e 100644 --- a/crates/ghostlight-dungeon/src/bin/ghostlight-strategic-smoke.rs +++ b/crates/ghostlight-dungeon/src/bin/ghostlight-strategic-smoke.rs @@ -36,8 +36,6 @@ async fn main() -> anyhow::Result<()> { }); std::fs::create_dir_all(&root)?; let mut campaign = strategic_campaign(); - campaign.institutions.get_mut("board").unwrap().posture = pressure.clone(); - campaign.gestalts.get_mut("workers").unwrap().pressures = vec![pressure.clone()]; campaign.events.push(ghostlight_dungeon::domain::Event { id: format!("pressure-{}", uuid::Uuid::new_v4()), at: campaign.world_time, diff --git a/crates/ghostlight-dungeon/src/persona.rs b/crates/ghostlight-dungeon/src/persona.rs index 8404e9d..0e224f0 100644 --- a/crates/ghostlight-dungeon/src/persona.rs +++ b/crates/ghostlight-dungeon/src/persona.rs @@ -644,45 +644,7 @@ fn validate_cell_appraisal( &subject.permitted_state_references, &subject.information_channels, )?; - match &action.effect { - crate::domain::StrategicCellEffect::Institution { - institution_id, - posture, - location_ids, - } if subject.subject_kind == crate::domain::AgencySubjectKind::Institution - && institution_id == &subject.subject_id - && subject.pressures.first().is_some_and(|current| { - crate::resolution::substantive_text_change(current, posture) - }) - && location_ids - .iter() - .all(|location| subject.location_ids.contains(location)) => {} - crate::domain::StrategicCellEffect::Gestalt { - gestalt_id, - pressure_additions, - pressure_resolutions, - } if subject.subject_kind == crate::domain::AgencySubjectKind::Gestalt - && gestalt_id == &subject.subject_id - && crate::resolution::validate_gestalt_pressure_transition( - &subject.pressures, - pressure_additions, - pressure_resolutions, - ) - .is_ok() => {} - crate::domain::StrategicCellEffect::ActorMove { - actor_id, - destination_id, - } if subject.subject_kind == crate::domain::AgencySubjectKind::Actor - && actor_id == &subject.subject_id - && subject.reachable_destination_ids.contains(destination_id) => {} - _ => { - return Err(anyhow!( - "action for subject {} has effect {:?}, which exceeds exact constituent authority", - subject.subject_id, - action.effect, - )); - } - } + validate_constituent_effect(subject, &action.effect)?; } else if let Some(member) = slice .member_exceptions .iter() @@ -715,6 +677,106 @@ fn validate_cell_appraisal( Ok(()) } +fn validate_constituent_effect( + subject: &CellConstituentSlice, + effect: &crate::domain::StrategicCellEffect, +) -> Result<()> { + match effect { + crate::domain::StrategicCellEffect::Institution { + institution_id, + posture, + location_ids, + } => { + if subject.subject_kind != crate::domain::AgencySubjectKind::Institution + || institution_id != &subject.subject_id + { + return Err(anyhow!( + "subject {} has kind {:?} and may not emit an institution effect for {}", + subject.subject_id, + subject.subject_kind, + institution_id + )); + } + if location_ids + .iter() + .any(|location| !subject.location_ids.contains(location)) + { + return Err(anyhow!( + "institution {} used locations {:?}; exact allowed locations are {:?}", + subject.subject_id, + location_ids, + subject.location_ids + )); + } + let current = subject.pressures.first().map(String::as_str).unwrap_or(""); + if !crate::resolution::substantive_text_change(current, posture) { + return Err(anyhow!( + "institution {} proposed posture {:?}, but its exact current posture is {:?}; emit a specific different commitment or choose inaction", + subject.subject_id, + posture, + current + )); + } + } + crate::domain::StrategicCellEffect::Gestalt { + gestalt_id, + pressure_additions, + pressure_resolutions, + } => { + if subject.subject_kind != crate::domain::AgencySubjectKind::Gestalt + || gestalt_id != &subject.subject_id + { + return Err(anyhow!( + "subject {} has kind {:?} and may not emit a gestalt effect for {}", + subject.subject_id, + subject.subject_kind, + gestalt_id + )); + } + crate::resolution::validate_gestalt_pressure_transition( + &subject.pressures, + pressure_additions, + pressure_resolutions, + ) + .map_err(|error| { + anyhow!( + "gestalt {} proposed additions {:?} and resolutions {:?} against exact current pressures {:?}: {}", + subject.subject_id, + pressure_additions, + pressure_resolutions, + subject.pressures, + error + ) + })?; + } + crate::domain::StrategicCellEffect::ActorMove { + actor_id, + destination_id, + } => { + if subject.subject_kind != crate::domain::AgencySubjectKind::Actor + || actor_id != &subject.subject_id + || !subject.reachable_destination_ids.contains(destination_id) + { + return Err(anyhow!( + "subject {} has kind {:?}; actor movement requested for {} to {:?}, while exact reachable destinations are {:?}", + subject.subject_id, + subject.subject_kind, + actor_id, + destination_id, + subject.reachable_destination_ids + )); + } + } + crate::domain::StrategicCellEffect::MemberMigration { .. } => { + return Err(anyhow!( + "constituent {} is not a named member and may not emit member_migration", + subject.subject_id + )); + } + } + Ok(()) +} + fn validate_action_permissions( action: &crate::domain::CellActionProposal, permitted_state_references: &BTreeSet, @@ -988,10 +1050,26 @@ mod tests { validate_cell_appraisal(&slice, &appraisal) .unwrap_err() .to_string() - .contains("exceeds exact constituent authority") + .contains("must change one to four markers") ); } + #[test] + fn repeated_institution_posture_reports_the_exact_missing_change() { + let slice = fixture_cell_slice(); + let error = validate_constituent_effect( + &slice.constituents[0], + &StrategicCellEffect::Institution { + institution_id: "faction-06".into(), + posture: "the vote is near".into(), + location_ids: vec!["forum".into()], + }, + ) + .unwrap_err(); + assert!(error.to_string().contains("exact current posture")); + assert!(error.to_string().contains("the vote is near")); + } + #[tokio::test] async fn persona_receives_only_projected_stream() { let engine = PersonaProjectionEngine { diff --git a/docs/architecture/ghostlight-multiresolution-agency.md b/docs/architecture/ghostlight-multiresolution-agency.md index 37df65e..862176c 100644 --- a/docs/architecture/ghostlight-multiresolution-agency.md +++ b/docs/architecture/ghostlight-multiresolution-agency.md @@ -260,6 +260,12 @@ resolver, and kernel; repeated busywork and invented resolutions therefore fail before mutation rather than generating another event that says nothing happened. +Semantic correction feedback names the exact failed boundary and current +value. A repeated institution posture receives its present posture; an invalid +population transition receives its exact current pressure set and the failed +transition reason. The correction model is not expected to reconstruct a +validator from a generic rejection. + ## Public state and controls The schema catalog and CultCache stores publish: