Make strategic priority semantics explicit

This commit is contained in:
Meta Vens 2026-08-17 23:10:13 +02:00
commit 3810d0952d
2 changed files with 66 additions and 1 deletions

View file

@ -496,7 +496,7 @@ impl CellProjectionEngine {
constrain_cell_proposal_schema(&mut schema, &slice)?;
let interpreter_context = serde_json::to_string(&cell_interpreter_context(&slice))?;
let permission_guidance = format!(
"Emit at most {} exact constituent- or named-member-attributed attempts. Copy each subject's allowed_effect_type: institution -> institution, gestalt -> gestalt, actor -> actor_move, named member -> member_migration. Institution posture must be a specific new commitment or withholding, never the current posture or a generic label. Gestalt pressure_resolutions must copy exact current_pressures that the attempted action resolves; pressure_additions are only new unresolved constraints, threats, obligations, or conditions, never completed actions. At least one and at most four total pressure changes are required. Use only that subject's permitted_state_references and allowed_public_channels; facet labels are not public channels. A named member uses one supplied migration destination; a population or arena cannot migrate a person. The runtime binds cell identity, revisions, membership, and effective state. The cell id is not an actor id. Use an empty actions array plus a concrete inaction_reason when nobody acts.",
"Emit at most {} exact constituent- or named-member-attributed attempts. Priority is an urgency score from 0 to 100 where higher numbers resolve first; never use ordinal list rank where 1 means first. Copy each subject's allowed_effect_type: institution -> institution, gestalt -> gestalt, actor -> actor_move, named member -> member_migration. Institution posture must be a specific new commitment or withholding, never the current posture or a generic label. Gestalt pressure_resolutions must copy exact current_pressures that the attempted action resolves; pressure_additions are only new unresolved constraints, threats, obligations, or conditions, never completed actions. At least one and at most four total pressure changes are required. Use only that subject's permitted_state_references and allowed_public_channels; facet labels are not public channels. A named member uses one supplied migration destination; a population or arena cannot migrate a person. The runtime binds cell identity, revisions, membership, and effective state. The cell id is not an actor id. Use an empty actions array plus a concrete inaction_reason when nobody acts.",
slice.max_actions
);
let mut request = ModelStageRequest {
@ -962,6 +962,10 @@ fn constrain_cell_proposal_schema(
"subject_id".into(),
serde_json::json!({"type":"string","enum":subject_ids}),
);
proposal.insert(
"priority".into(),
serde_json::json!({"type":"integer","minimum":0,"maximum":100}),
);
Ok(())
}
@ -1406,6 +1410,20 @@ mod tests {
assert!(cohesive_persona.contains("present-tense choice"));
assert!(cohesive_persona.contains("asking for a future decision"));
}
#[test]
fn cell_priority_schema_uses_a_bounded_higher_wins_score() {
let mut schema = serde_json::to_value(schema_for!(CellAppraisalProposal)).unwrap();
constrain_cell_proposal_schema(&mut schema, &fixture_cell_slice()).unwrap();
assert_eq!(
schema.pointer("/$defs/CellActionProposal/properties/priority/minimum"),
Some(&serde_json::json!(0))
);
assert_eq!(
schema.pointer("/$defs/CellActionProposal/properties/priority/maximum"),
Some(&serde_json::json!(100))
);
}
}
fn allowed_actor_references(slice: &PermittedActorSlice) -> Vec<String> {

View file

@ -1692,6 +1692,7 @@ fn validate_cell_proposal(
if proposal.subject_id == campaign.player_actor_id
|| proposal.intent.trim().is_empty()
|| proposal.intended_effect.trim().is_empty()
|| !(0..=100).contains(&proposal.priority)
{
return Err(anyhow!("cell proposal has no exact constituent authority"));
}
@ -2843,6 +2844,52 @@ pub(crate) mod tests {
assert!(validate_and_resolve_wave(&value, &make_wave(borrowed_secret)).is_err());
}
#[test]
fn consequence_cap_keeps_the_highest_numeric_priorities() {
let value = campaign(3, 1);
let cover = plan_cover(&value, default_demand(&value, "urgent choices")).unwrap();
assert_eq!(cover.cells.len(), 1);
let cell = &cover.cells[0];
let action = |subject_id: &str, priority: i16| CellActionProposal {
subject_id: subject_id.into(),
intent: format!("{subject_id} commits"),
intended_effect: format!("{subject_id} adopts an urgent posture"),
priority,
state_references: vec![],
public_channels: vec![],
effect: StrategicCellEffect::Institution {
institution_id: subject_id.into(),
posture: format!("urgent posture {priority}"),
location_ids: vec![],
},
};
let wave = ResolutionWaveCommit {
schema: "ghostlight.resolution_wave_commit.v1".into(),
world_revision: value.revision,
resolution_epoch: value.resolution_policy.resolution_epoch,
plan_receipt: plan_receipt(&value, &cover),
appraisals: vec![CellAppraisal {
schema: "ghostlight.cell_appraisal.v1".into(),
cell_id: cell.id.clone(),
world_revision: value.revision,
resolution_epoch: value.resolution_policy.resolution_epoch,
considered_subject_ids: cell.subject_ids.clone(),
actions: vec![
action("faction-0000", 1),
action("faction-0001", 100),
action("faction-0002", 50),
],
inaction_reason: None,
}],
cover,
model_receipt_hashes: vec![],
};
let plan = validate_and_resolve_wave(&value, &wave).unwrap();
assert_eq!(plan.institution_actions.len(), 2);
assert_eq!(plan.institution_actions[0].institution_id, "faction-0001");
assert_eq!(plan.institution_actions[1].institution_id, "faction-0002");
}
#[test]
fn fission_preserves_parent_and_member_delta_while_activating_child_leaves() {
let mut value = campaign(1, 1);