Preserve individual agency through diaspora
This commit is contained in:
parent
8bd5688507
commit
73c3477090
5 changed files with 325 additions and 4 deletions
|
|
@ -2364,6 +2364,310 @@ mod tests {
|
|||
assert_eq!(actor.memories, identity_before.memories);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn diaspora_distributes_people_across_nested_population_branches_without_merging_identity() {
|
||||
let mut value = hierarchical_refugee_campaign();
|
||||
value.locations.get_mut("camp").unwrap().routes.insert(
|
||||
"to-hills".into(),
|
||||
Route {
|
||||
destination_id: "hills".into(),
|
||||
distance: "along the ridge road".into(),
|
||||
travel_minutes: 120,
|
||||
},
|
||||
);
|
||||
value.locations.insert(
|
||||
"hills".into(),
|
||||
Location {
|
||||
id: "hills".into(),
|
||||
name: "North hills".into(),
|
||||
container_id: None,
|
||||
routes: BTreeMap::new(),
|
||||
persistent_features: vec!["terraced gardens".into()],
|
||||
},
|
||||
);
|
||||
|
||||
let population = |id: &str, name: &str, location: &str| GestaltPersonaState {
|
||||
schema: "ghostlight.gestalt_persona_state.v1".into(),
|
||||
id: id.into(),
|
||||
name: name.into(),
|
||||
version: 0,
|
||||
home_location_id: location.into(),
|
||||
shared_capabilities: BTreeSet::from([format!("live among {name}")]),
|
||||
shared_knowledge: BTreeSet::from([format!("routines of {name}")]),
|
||||
resources: BTreeSet::new(),
|
||||
goals: vec![format!("sustain {name}")],
|
||||
pressures: vec![],
|
||||
};
|
||||
for (id, name, location) in [
|
||||
("displaced-root", "Displaced people", "camp"),
|
||||
("crisis-refugees", "Crisis refugees", "camp"),
|
||||
("displaced-other", "Other displaced people", "camp"),
|
||||
("crisis-other", "Other crisis refugees", "camp"),
|
||||
("southport-root", "Southport residents", "docks"),
|
||||
("harbor-populations", "Harbor populations", "docks"),
|
||||
("harbor-other", "Other harbor residents", "docks"),
|
||||
("inland-other", "Inland residents", "hills"),
|
||||
("hill-neighbors", "North hill neighbors", "hills"),
|
||||
("inland-unknown", "Other inland residents", "hills"),
|
||||
] {
|
||||
value
|
||||
.gestalts
|
||||
.insert(id.into(), population(id, name, location));
|
||||
}
|
||||
crate::resolution::ensure_agency_profiles(&mut value);
|
||||
|
||||
for parent_id in [
|
||||
"displaced-root",
|
||||
"crisis-refugees",
|
||||
"southport-root",
|
||||
"harbor-populations",
|
||||
"inland-other",
|
||||
] {
|
||||
let profile = value.agency_profiles.get_mut(parent_id).unwrap();
|
||||
profile.active_leaf = false;
|
||||
profile.simulation_eligible = false;
|
||||
}
|
||||
for (child_id, parent_id) in [
|
||||
("crisis-refugees", "displaced-root"),
|
||||
("displaced-other", "displaced-root"),
|
||||
("refugees-east", "crisis-refugees"),
|
||||
("crisis-other", "crisis-refugees"),
|
||||
("harbor-populations", "southport-root"),
|
||||
("inland-other", "southport-root"),
|
||||
("dock-neighbors", "harbor-populations"),
|
||||
("harbor-other", "harbor-populations"),
|
||||
("hill-neighbors", "inland-other"),
|
||||
("inland-unknown", "inland-other"),
|
||||
] {
|
||||
value
|
||||
.agency_profiles
|
||||
.get_mut(child_id)
|
||||
.unwrap()
|
||||
.parent_subject_id = Some(parent_id.into());
|
||||
}
|
||||
let lineage =
|
||||
|parent: &str, children: [&str; 2], residual: &str, axis: AgencyAxis| GestaltLineage {
|
||||
schema: "ghostlight.gestalt_lineage.v1".into(),
|
||||
parent_gestalt_id: parent.into(),
|
||||
child_gestalt_ids: children.iter().map(|id| (*id).into()).collect(),
|
||||
partition_axis: axis,
|
||||
partition_values: BTreeMap::from([
|
||||
(children[0].into(), "selected".into()),
|
||||
(children[1].into(), "other/unknown".into()),
|
||||
]),
|
||||
residual_child_id: residual.into(),
|
||||
source_revision: value.revision,
|
||||
};
|
||||
value.gestalt_lineages.insert(
|
||||
"displaced-root".into(),
|
||||
lineage(
|
||||
"displaced-root",
|
||||
["crisis-refugees", "displaced-other"],
|
||||
"displaced-other",
|
||||
AgencyAxis::Ideology,
|
||||
),
|
||||
);
|
||||
value.gestalt_lineages.insert(
|
||||
"crisis-refugees".into(),
|
||||
lineage(
|
||||
"crisis-refugees",
|
||||
["refugees-east", "crisis-other"],
|
||||
"crisis-other",
|
||||
AgencyAxis::Geography,
|
||||
),
|
||||
);
|
||||
value.gestalt_lineages.insert(
|
||||
"southport-root".into(),
|
||||
lineage(
|
||||
"southport-root",
|
||||
["harbor-populations", "inland-other"],
|
||||
"inland-other",
|
||||
AgencyAxis::Geography,
|
||||
),
|
||||
);
|
||||
value.gestalt_lineages.insert(
|
||||
"harbor-populations".into(),
|
||||
lineage(
|
||||
"harbor-populations",
|
||||
["dock-neighbors", "harbor-other"],
|
||||
"harbor-other",
|
||||
AgencyAxis::EconomyRole,
|
||||
),
|
||||
);
|
||||
value.gestalt_lineages.insert(
|
||||
"inland-other".into(),
|
||||
lineage(
|
||||
"inland-other",
|
||||
["hill-neighbors", "inland-unknown"],
|
||||
"inland-unknown",
|
||||
AgencyAxis::Authority,
|
||||
),
|
||||
);
|
||||
|
||||
let mut tovan = value.gestalt_members["mira"].clone();
|
||||
tovan.id = "tovan".into();
|
||||
tovan.name = "Tovan Ser".into();
|
||||
tovan.version = 9;
|
||||
tovan.capability_additions = BTreeSet::from(["tend terrace herbs".into()]);
|
||||
tovan.knowledge_additions = BTreeSet::from(["the player found his daughter".into()]);
|
||||
tovan.equipment = BTreeSet::from(["copper seed case".into()]);
|
||||
tovan.conditions = BTreeSet::from(["healed broken wrist".into()]);
|
||||
tovan.obligations = BTreeSet::from(["send medicine back to the camp".into()]);
|
||||
tovan.relationships = BTreeMap::from([(
|
||||
"player".into(),
|
||||
"remembers that they found his daughter".into(),
|
||||
)]);
|
||||
tovan.memories = vec!["The player found Lio beneath the fallen awning.".into()];
|
||||
value.gestalt_members.insert("tovan".into(), tovan);
|
||||
value.agency_relations.insert(
|
||||
"hill-resettlement".into(),
|
||||
AgencyRelation {
|
||||
schema: "ghostlight.agency_relation.v1".into(),
|
||||
id: "hill-resettlement".into(),
|
||||
from_subject_id: "refugees-east".into(),
|
||||
to_subject_id: "hill-neighbors".into(),
|
||||
kind: AgencyRelationKind::Migration,
|
||||
strength: 85,
|
||||
active: true,
|
||||
evidence_receipt_ids: vec![],
|
||||
},
|
||||
);
|
||||
|
||||
let before = value.gestalt_members.clone();
|
||||
let source_before = value.gestalts["refugees-east"].clone();
|
||||
let docks_before = value.gestalts["dock-neighbors"].clone();
|
||||
let hills_before = value.gestalts["hill-neighbors"].clone();
|
||||
let effective_goals = |campaign: &Campaign, id: &str| {
|
||||
let member = &campaign.gestalt_members[id];
|
||||
if member.goals.is_empty() {
|
||||
campaign.gestalts[&member.gestalt_id]
|
||||
.goals
|
||||
.iter()
|
||||
.cloned()
|
||||
.collect::<BTreeSet<_>>()
|
||||
} else {
|
||||
member.goals.iter().cloned().collect::<BTreeSet<_>>()
|
||||
}
|
||||
};
|
||||
let effective_before = ["mira", "tovan"]
|
||||
.into_iter()
|
||||
.map(|id| {
|
||||
(
|
||||
id,
|
||||
(
|
||||
crate::resolution::effective_member_capabilities(&value, id).unwrap(),
|
||||
crate::resolution::effective_member_knowledge(&value, id).unwrap(),
|
||||
effective_goals(&value, id),
|
||||
),
|
||||
)
|
||||
})
|
||||
.collect::<BTreeMap<_, _>>();
|
||||
|
||||
let events = apply_strategic_tick_plan(
|
||||
&mut value,
|
||||
StrategicTickPlan {
|
||||
member_migrations: vec![
|
||||
StrategicMemberMigration {
|
||||
member_id: "mira".into(),
|
||||
source_gestalt_id: "refugees-east".into(),
|
||||
destination_gestalt_id: "dock-neighbors".into(),
|
||||
destination_location_id: "docks".into(),
|
||||
public_channels: vec![],
|
||||
},
|
||||
StrategicMemberMigration {
|
||||
member_id: "tovan".into(),
|
||||
source_gestalt_id: "refugees-east".into(),
|
||||
destination_gestalt_id: "hill-neighbors".into(),
|
||||
destination_location_id: "hills".into(),
|
||||
public_channels: vec![],
|
||||
},
|
||||
],
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
for (id, destination, location) in [
|
||||
("mira", "dock-neighbors", "docks"),
|
||||
("tovan", "hill-neighbors", "hills"),
|
||||
] {
|
||||
let member = &value.gestalt_members[id];
|
||||
let old = &before[id];
|
||||
assert_eq!(member.id, old.id);
|
||||
assert_eq!(member.name, old.name);
|
||||
assert_eq!(member.gestalt_id, destination);
|
||||
assert_eq!(member.last_location_id.as_deref(), Some(location));
|
||||
assert_eq!(member.version, old.version + 1);
|
||||
assert_eq!(member.relationships, old.relationships);
|
||||
assert_eq!(member.memories, old.memories);
|
||||
assert_eq!(member.equipment, old.equipment);
|
||||
assert_eq!(member.conditions, old.conditions);
|
||||
assert_eq!(member.obligations, old.obligations);
|
||||
assert_eq!(
|
||||
crate::resolution::effective_member_capabilities(&value, id).unwrap(),
|
||||
effective_before[id].0
|
||||
);
|
||||
assert_eq!(
|
||||
crate::resolution::effective_member_knowledge(&value, id).unwrap(),
|
||||
effective_before[id].1
|
||||
);
|
||||
assert_eq!(effective_goals(&value, id), effective_before[id].2);
|
||||
let actor = materialize_actor(
|
||||
&value.gestalts[destination],
|
||||
member,
|
||||
&format!("member:{id}"),
|
||||
location,
|
||||
);
|
||||
assert_eq!(actor.name, old.name);
|
||||
assert_eq!(actor.relationships, old.relationships);
|
||||
assert_eq!(actor.memories, old.memories);
|
||||
}
|
||||
for (id, before, version_increment) in [
|
||||
("refugees-east", source_before, 2),
|
||||
("dock-neighbors", docks_before, 1),
|
||||
("hill-neighbors", hills_before, 1),
|
||||
] {
|
||||
let after = &value.gestalts[id];
|
||||
assert_eq!(after.name, before.name);
|
||||
assert_eq!(after.home_location_id, before.home_location_id);
|
||||
assert_eq!(after.shared_capabilities, before.shared_capabilities);
|
||||
assert_eq!(after.shared_knowledge, before.shared_knowledge);
|
||||
assert_eq!(after.resources, before.resources);
|
||||
assert_eq!(after.goals, before.goals);
|
||||
assert_eq!(after.pressures, before.pressures);
|
||||
assert_eq!(after.version, before.version + version_increment);
|
||||
}
|
||||
assert_eq!(events.len(), 2);
|
||||
assert_eq!(events[0].actor_ids, vec!["member:mira"]);
|
||||
assert_eq!(events[1].actor_ids, vec!["member:tovan"]);
|
||||
assert_eq!(
|
||||
events[0].gestalt_ids,
|
||||
vec!["refugees-east", "dock-neighbors"]
|
||||
);
|
||||
assert_eq!(
|
||||
events[1].gestalt_ids,
|
||||
vec!["refugees-east", "hill-neighbors"]
|
||||
);
|
||||
|
||||
let depth = |leaf_id: &str| {
|
||||
let mut current = leaf_id;
|
||||
let mut depth = 0;
|
||||
while let Some(lineage) = value.gestalt_lineages.values().find(|lineage| {
|
||||
lineage
|
||||
.child_gestalt_ids
|
||||
.iter()
|
||||
.any(|child| child == current)
|
||||
}) {
|
||||
depth += 1;
|
||||
current = &lineage.parent_gestalt_id;
|
||||
}
|
||||
depth
|
||||
};
|
||||
assert_eq!(depth("refugees-east"), 2);
|
||||
assert_eq!(depth("dock-neighbors"), 2);
|
||||
assert_eq!(depth("hill-neighbors"), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn gestalt_migration_moves_only_the_population_leaf() {
|
||||
let mut value = hierarchical_refugee_campaign();
|
||||
|
|
|
|||
|
|
@ -820,7 +820,7 @@ impl CellProjectionEngine {
|
|||
"Emit at most {} exact constituent- or named-member-attributed attempts. Priority is an urgency score from 0 to 100 where higher numbers resolve first. ",
|
||||
"Copy each subject's allowed_effect_type: institution -> institution, gestalt -> gestalt pressure transition, gestalt_activity, or gestalt_migration, actor -> actor_move, named member -> member_migration or member_activity. ",
|
||||
"Use gestalt_activity or member_activity for a concrete attempt that does not itself change pressure. Map attempts narrowly: communicate means speak, send, offer, ask, or notify; coordinate means arrange a joint attempt; prepare means the subject's own concrete work; investigate means seek information; recruit means invite; trade means offer an exchange; obstruct means attempt interference. ",
|
||||
"target_subject_ids and location_ids must come from that exact subject's permissions. A member_activity uses exactly the member's source_location_id. Internal work is prepare with no targets. A local investigate may have no target and use the exact current location to seek information from the environment or an unnamed ordinary role; asking an unnamed clerk or dock master for facts maps here and records only the inquiry, never a reply or discovery. A local communicate may likewise have no target at the exact current location when the Persona speaks, sends, offers, asks permission, or notifies an unnamed ordinary role; it records only the source's outgoing attempt, never a listener, reply, acceptance, or outcome. Communication with a canonical subject requires that exact target ID. Never substitute a containing population, related institution, or merely permitted ID for an unnamed role. ",
|
||||
"target_subject_ids and location_ids must come from that exact subject's permissions. Every activity has at most four unique target_subject_ids; choose the four most causally relevant when more permitted subjects are involved. A member_activity uses exactly the member's source_location_id. Internal work is prepare with no targets. A local investigate may have no target and use the exact current location to seek information from the environment or an unnamed ordinary role; asking an unnamed clerk or dock master for facts maps here and records only the inquiry, never a reply or discovery. A local communicate may likewise have no target at the exact current location when the Persona speaks, sends, offers, asks permission, or notifies an unnamed ordinary role; it records only the source's outgoing attempt, never a listener, reply, acceptance, or outcome. Communication with a canonical subject requires that exact target ID. Never substitute a containing population, related institution, or merely permitted ID for an unnamed role. ",
|
||||
"Write intended_effect as the attempted act, never its hoped-for outcome or target response. Institution posture must be a specific new commitment or withholding of at most 240 characters. Gestalt pressure_resolutions copy exact current_pressures; additions are new unresolved constraints, never completed actions. Use only permitted state references and public channels. ",
|
||||
"A population that chooses to board, depart, or relocate together to one supplied migration_destinations key emits gestalt_migration; do not reduce it to prepare. It relocates only that exact population leaf and never implies a named member traveled. A named member who chooses to board, depart, travel, or join a supplied destination emits member_migration; use prepare only while departure remains unchosen. ",
|
||||
"A population or arena cannot migrate a person. Runtime binds identity and effect owner IDs from subject_id. Do not emit institution_id, gestalt_id, actor_id, or member_id inside effect. Use an empty actions array plus a concrete inaction_reason when nobody acts."
|
||||
|
|
@ -1274,7 +1274,7 @@ fn validate_cell_appraisal(
|
|||
|| location_ids[0] != member.source_location_id
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"named member {} proposed {:?} toward {:?} at {:?}; exact allowed targets are {:?} and location is {:?}",
|
||||
"named member {} proposed {:?} toward {:?} at {:?}; exact allowed targets (choose at most four unique IDs) are {:?} and location is {:?}",
|
||||
member.member_id,
|
||||
activity,
|
||||
target_subject_ids,
|
||||
|
|
@ -1413,7 +1413,7 @@ fn validate_constituent_effect(
|
|||
.any(|location| !subject.location_ids.contains(location))
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"gestalt {} proposed {:?} toward {:?} at {:?}; exact allowed targets are {:?} and locations are {:?}",
|
||||
"gestalt {} proposed {:?} toward {:?} at {:?}; exact allowed targets (choose at most four unique IDs) are {:?} and exact locations (choose at most four unique IDs) are {:?}",
|
||||
subject.subject_id,
|
||||
activity,
|
||||
target_subject_ids,
|
||||
|
|
|
|||
|
|
@ -497,6 +497,14 @@ lineage parents as simulation subjects, and repeats the identity/callback check
|
|||
after sustained compression. Both migration endpoints must be active leaves at
|
||||
lineage depth two or greater.
|
||||
|
||||
A deterministic diaspora test drives two durable people from the same
|
||||
depth-two refugee leaf to two different depth-two destination branches in one
|
||||
strategic plan. It proves exact effective capabilities, knowledge, goals,
|
||||
memories, relationships, possessions, conditions, and obligations survive the
|
||||
rebases; destination populations receive none of that private state. Only the
|
||||
source and destination population version counters change. Each person can then
|
||||
materialize from their new local baseline with the same name and private delta.
|
||||
|
||||
The Starfire deployment smoke ran a live provider-backed wave over three
|
||||
eligible singleton cells, committed three offscreen events and three
|
||||
channel-accessible news items in 19.55 seconds, and preserved the absent player.
|
||||
|
|
|
|||
|
|
@ -211,6 +211,15 @@ budget 1 for 23 additional waves, require all 24 debt-selected foci across the
|
|||
initial plus sustained ticks, reject inactive lineage parents, and repeat the
|
||||
callback after compression.
|
||||
|
||||
The first 24-tick fairness attempt stopped safely after 20 total ticks when a
|
||||
named member selected six valid communication targets although an activity may
|
||||
encode at most four. The rejected wave did not commit. The Interpreter contract
|
||||
and same-snapshot correction now state the cardinality explicitly instead of
|
||||
making the model infer it from JSON Schema. A deterministic diaspora regression
|
||||
also moves two remembered refugees from one depth-two source leaf to different
|
||||
depth-two destination branches in one plan and proves their effective and
|
||||
private state remains distinct.
|
||||
|
||||
The multiresolution body is deployed on Starfire. Typed health matched the
|
||||
immutable release, DeepSeek was ready, and the disposable live strategic-cell
|
||||
smoke committed three offscreen events plus three accessible news items without
|
||||
|
|
|
|||
|
|
@ -268,5 +268,5 @@ data_flow:
|
|||
|
||||
current_status:
|
||||
summary: GhostlightDungeon production remains on the verified Starfire release. The strict 24-subject multiresolution golden is complete: a budget-one rival arena, independent population/member migration, 26 background consequences across 11 subjects, stable identity through 1/4/8/4 resolution changes, and automatic rematerialization of the same refugee. Production state remains untouched.
|
||||
next_action: Run the new 24-tick budget-one fairness stress. Require every canonical subject to receive runtime-selected debt focus, reject inactive lineage parents, preserve Mira through sustained aggregate activity, and rematerialize the same person. Then run the 1/4/8/32 scale matrix and compare cache and cognitive-efficiency profiles.
|
||||
next_action: Rerun the 24-tick budget-one fairness stress with the explicit four-target Interpreter contract. Require every canonical subject to receive runtime-selected debt focus, reject inactive lineage parents, preserve Mira through sustained aggregate activity, and rematerialize the same person. Then run the 1/4/8/32 scale matrix and compare cache and cognitive-efficiency profiles.
|
||||
gestalt_population: Gestalt Personas own shared population baselines; persistent member deltas own named individuality; WorldKernel materialization and approval-gated fission preserve lineage and identity. Presence projection is limited to nearby active leaves and exact-location dormant members. Simulation cells are derived covers only.
|
||||
|
|
|
|||
Loading…
Reference in a new issue