Unify migration state references
This commit is contained in:
parent
14e1a08984
commit
3e8eaf4abf
5 changed files with 71 additions and 38 deletions
|
|
@ -2162,6 +2162,40 @@ pub fn validate_member_migration(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn gestalt_migration_destinations(
|
||||
campaign: &Campaign,
|
||||
source_gestalt_id: &str,
|
||||
origin_location_id: &str,
|
||||
) -> BTreeMap<String, String> {
|
||||
campaign
|
||||
.agency_relations
|
||||
.values()
|
||||
.filter(|relation| {
|
||||
relation.active
|
||||
&& relation.kind == AgencyRelationKind::Migration
|
||||
&& relation.from_subject_id == source_gestalt_id
|
||||
})
|
||||
.filter_map(|relation| {
|
||||
let destination = campaign.gestalts.get(&relation.to_subject_id)?;
|
||||
let profile = campaign.agency_profiles.get(&destination.id)?;
|
||||
if !profile.active_leaf || !profile.simulation_eligible {
|
||||
return None;
|
||||
}
|
||||
let reachable = origin_location_id == destination.home_location_id
|
||||
|| campaign
|
||||
.locations
|
||||
.get(origin_location_id)
|
||||
.is_some_and(|location| {
|
||||
location.routes.values().any(|route| {
|
||||
route.destination_id == destination.home_location_id
|
||||
&& route.travel_minutes <= campaign.tick_hours.saturating_mul(60)
|
||||
})
|
||||
});
|
||||
reachable.then(|| (destination.id.clone(), destination.home_location_id.clone()))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn member_state_references(campaign: &Campaign, member_id: &str) -> Result<BTreeSet<String>> {
|
||||
let member = campaign
|
||||
.gestalt_members
|
||||
|
|
@ -2342,6 +2376,12 @@ pub fn subject_state_references(campaign: &Campaign, subject_id: &str) -> Result
|
|||
.map(|value| format!("resource:{value}")),
|
||||
),
|
||||
);
|
||||
for (destination_id, location_id) in
|
||||
gestalt_migration_destinations(campaign, subject_id, &gestalt.home_location_id)
|
||||
{
|
||||
references.insert(format!("gestalt:{destination_id}"));
|
||||
references.insert(format!("location:{location_id}"));
|
||||
}
|
||||
}
|
||||
Ok(references)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -522,8 +522,11 @@ fn member_exceptions(campaign: &Campaign, cell: &SimulationCell) -> Result<Vec<C
|
|||
.last_location_id
|
||||
.clone()
|
||||
.unwrap_or_else(|| source.home_location_id.clone());
|
||||
let destinations =
|
||||
gestalt_migration_destinations(campaign, &member.gestalt_id, &origin);
|
||||
let destinations = crate::resolution::gestalt_migration_destinations(
|
||||
campaign,
|
||||
&member.gestalt_id,
|
||||
&origin,
|
||||
);
|
||||
let activity_targets =
|
||||
crate::resolution::member_activity_targets(campaign, &member.id).ok()?;
|
||||
if destinations.is_empty() && activity_targets.is_empty() {
|
||||
|
|
@ -626,40 +629,6 @@ fn member_exceptions(campaign: &Campaign, cell: &SimulationCell) -> Result<Vec<C
|
|||
.collect()
|
||||
}
|
||||
|
||||
fn gestalt_migration_destinations(
|
||||
campaign: &Campaign,
|
||||
source_gestalt_id: &str,
|
||||
origin_location_id: &str,
|
||||
) -> BTreeMap<String, String> {
|
||||
campaign
|
||||
.agency_relations
|
||||
.values()
|
||||
.filter(|relation| {
|
||||
relation.active
|
||||
&& relation.kind == crate::domain::AgencyRelationKind::Migration
|
||||
&& relation.from_subject_id == source_gestalt_id
|
||||
})
|
||||
.filter_map(|relation| {
|
||||
let destination = campaign.gestalts.get(&relation.to_subject_id)?;
|
||||
let profile = campaign.agency_profiles.get(&destination.id)?;
|
||||
if !profile.active_leaf || !profile.simulation_eligible {
|
||||
return None;
|
||||
}
|
||||
let reachable = origin_location_id == destination.home_location_id
|
||||
|| campaign
|
||||
.locations
|
||||
.get(origin_location_id)
|
||||
.is_some_and(|location| {
|
||||
location.routes.values().any(|route| {
|
||||
route.destination_id == destination.home_location_id
|
||||
&& route.travel_minutes <= campaign.tick_hours.saturating_mul(60)
|
||||
})
|
||||
});
|
||||
reachable.then(|| (destination.id.clone(), destination.home_location_id.clone()))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn overlay(
|
||||
baseline: &BTreeSet<String>,
|
||||
additions: &BTreeSet<String>,
|
||||
|
|
@ -736,8 +705,11 @@ fn constituent_slice(campaign: &Campaign, id: &str) -> Result<CellConstituentSli
|
|||
value.resources = gestalt.resources.clone();
|
||||
value.goals = gestalt.goals.clone();
|
||||
value.pressures = gestalt.pressures.clone();
|
||||
value.migration_destinations =
|
||||
gestalt_migration_destinations(campaign, id, &gestalt.home_location_id);
|
||||
value.migration_destinations = crate::resolution::gestalt_migration_destinations(
|
||||
campaign,
|
||||
id,
|
||||
&gestalt.home_location_id,
|
||||
);
|
||||
value
|
||||
.migration_destinations
|
||||
.retain(|_, location_id| location_id != &gestalt.home_location_id);
|
||||
|
|
|
|||
|
|
@ -352,6 +352,14 @@ knowledge is never treated as an information channel; while dematerialized,
|
|||
the member can publish only through channels owned by their current leaf
|
||||
gestalt's agency profile.
|
||||
|
||||
`subject_state_references` is the single derivation path for canonical
|
||||
constituent references used by both prompt slicing and wave admission. For a
|
||||
Gestalt it includes reachable destinations produced by active migration
|
||||
relations, along with the destination population and location references. The
|
||||
scheduler does not append a second opinion after the fact, so a reference
|
||||
shown to the Interpreter cannot become invalid merely by reaching the wave
|
||||
resolver.
|
||||
|
||||
`subject_id` is the sole model-facing owner attribution. Nested effect owner
|
||||
IDs are absent from the model contract: Ghostlight derives `institution_id`,
|
||||
`gestalt_id`, `actor_id`, or the raw member ID during binding. The canonical
|
||||
|
|
|
|||
|
|
@ -179,6 +179,13 @@ current location. It never creates the ordinary role, a reply, acceptance, or
|
|||
an outcome. One domain method owns which activity kinds allow this shape, and
|
||||
the Interpreter membrane, wave resolver, and kernel all use it.
|
||||
|
||||
The following run produced semantically clean Mira and population migrations,
|
||||
but the wave resolver rejected destination references that the scheduler had
|
||||
shown to the Interpreter. `resolution::subject_state_references` now owns the
|
||||
canonical constituent reference set, including active reachable migration
|
||||
destinations. Scheduler slicing and wave admission consume that same
|
||||
derivation; the scheduler's private migration-destination helper was deleted.
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -92,6 +92,12 @@ proposal. The model cannot disagree with itself about `member:mira-venn` versus
|
|||
raw `mira-venn`, and the prompt/output contract spends fewer tokens copying
|
||||
invariants Ghostlight already owns.
|
||||
|
||||
Canonical constituent references have one owner:
|
||||
`resolution::subject_state_references`. Scheduler slices consume that set
|
||||
directly, including active reachable migration destinations, and wave
|
||||
validation recomputes the same set. Prompt construction cannot append
|
||||
references the resolver does not recognize.
|
||||
|
||||
Cell perspective attribution is runtime-bound too. The Projector returns one
|
||||
to the cell action limit `subject_id → narrative` segments; the schema admits
|
||||
only exact constituents and selected member exceptions. Ghostlight rejects
|
||||
|
|
|
|||
Loading…
Reference in a new issue