Files
opengenesislinkserver/tools/ci/verify_avatar_evacuation.py
T
OpenGenesis (MPL 2.0) bac8e86d0d feat: evacuate avatars before region restart and full simulator shutdown (#362)
* feat: move root viewer avatars to nearest online grid region before restart or shutdown

* feat: evacuate avatars before normal region restart, abort if transfers remain

* feat: evacuate full simulator to other online host before closing scenes

* build: include simulator avatar evacuation service

* feat: safely evacuate residents before managed region stop or restart

* config: enable graceful region and instance avatar evacuation by default

* test: guard nearest online region evacuation before restart and full-instance shutdown

* ci: run avatar evacuation safety contracts with region-control validation

* docs: define graceful region and instance avatar relocation and operational limitations

* fix: retry next nearest online region on rejected or timed-out teleport without racing transfers

* fix: enforce one process-wide shutdown evacuation timeout across all hosted regions

* test: recognize verified root-presence polling in multi-target evacuation loop

* feat: launch instance-wide avatar evacuations concurrently within one bounded shutdown deadline
2026-11-02 01:16:23 +01:00

59 lines
3.0 KiB
Python

#!/usr/bin/env python3
"""Regression guard: graceful region restart and all-server shutdown routing."""
from pathlib import Path
r = Path(__file__).resolve().parents[2]
def load(name):
return (r / name).read_text(encoding="utf-8-sig")
evac=load("OpenSim/Region/Framework/Scenes/NexVerseAvatarEvacuation.cs")
scene=load("OpenSim/Region/Framework/Scenes/Scene.cs")
server=load("OpenSim/Region/Application/OpenSimBase.cs")
managed=load("NexVerse/RegionModules/NodeAgent/NexVerseManagedRegionHostPlugin.cs")
project=load("OpenSim/Region/Framework/OpenSim.Region.Framework.csproj")
config=load("bin/OpenSim.ini")
checks={
"in-process scene lifecycle":
('NexVerseAvatarEvacuation.Evacuate(this' in scene and
scene.index('NexVerseAvatarEvacuation.Evacuate(this') <
scene.index('Close();',scene.index('public void RestartNow()')) and
'Cancelled restart of' in scene),
"process-wide before shutdown":
('NexVerseAvatarEvacuation.EvacuateInstance(' in server and
server.index('NexVerseAvatarEvacuation.EvacuateInstance(') <
server.index('SceneManager.Close();',server.index('protected override void ShutdownSpecific()'))),
"every local region excluded":
('scenes.Where(s => s != null).Select(s => s.RegionInfo.RegionID)' in evac and
'excluded.Contains(region.RegionID)' in evac),
"genuine online regions only":
('scene.GridService.GetOnlineRegions(' in evac and
'scopeID' not in evac and
'region.RegionHandle != scene.RegionInfo.RegionHandle' in evac),
"closest deterministic destination":
('.OrderBy(region =>' in evac and '.ThenBy(region => region.RegionID.ToString())' in evac),
"real viewer-only root relocation":
('!sp.IsChildAgent && !sp.IsNPC' in evac and
'transfer.Teleport(sp, destination.RegionHandle' in evac),
"native access policies preserved":
('IEntityTransferModule' in evac and 'TPFlags.ViaLocation' in evac and
'DoTeleport(' not in evac),
"wait for actual avatar exit":
('List<ScenePresence> remaining = Residents(scene)' in evac and
'if (remaining.Count == 0)' in evac and
'Thread.Sleep(250)' in evac and 'Environment.TickCount64' in evac),
"managed stop and restart":
(managed.count('NexVerseAvatarEvacuation.Evacuate(')==2 and
managed.count('region_evacuation_incomplete')==2 and
managed.count('region_not_nexverse_managed')>=2),
"no silent success when missing target":
('if (targets.Count == 0)' in evac and
'return false;' in evac and 'return left == 0;' in evac),
"compiled and enabled":
('Scenes\\NexVerseAvatarEvacuation.cs' in project and
'[NexVerseAvatarEvacuation]' in config and 'Enabled = true' in config and
'WaitSeconds = 25' in config),
}
for title,ok in checks.items():
if not ok:
raise AssertionError("AVATAR_EVACUATION_REGRESSION: "+title)
print("PASS:", title)
print("NEXVERSE_AVATAR_EVACUATION_CONTRACT_PASS",len(checks))