Files
EscapistsReintroduced/docs/native-guard-cancellation.md

3.3 KiB

Native initial guard cancellation fixture

--project core --smoke guard-cancel runs a bounded WORKBENCH-only test in a disposable world. It does not recreate any mission site, refill stock, register groups with HQ, assign a player, or change normal guard population behavior. Three separate instances of a test subclass of ERR_SiteService own one six-slot successor guard group each. The subclass only supplies the owned-group portion of a PENDING preparation; it calls the unchanged production Stop and Rollback methods.

The first group is stopped twice in the same script call as creation, after verifying that native EOnInit has initialized its cached group utility, its all-members initialization has not completed, and no initial member or native dispatch has occurred. This rejects the native ignore-spawning shortcut and a cancellation made before initialization. It stays alive to expose a late request instead of hiding cancellation behind deletion. The second group is allowed to receive actual native dispatch until it has between one and five physical members. The following fixture tick stops it twice, outside the native dispatch stack, after that dispatch can finish re-enqueuing the partial request. It also remains alive. The third group is an uncancelled control and must finish its six-member native population while both cancelled groups remain unchanged for at least fifteen seconds.

Installed SCR_AIGroup.GetSpawnQueueSize() always returns zero for compatibility, and the generated ChimeraAIWorld interface exposes enqueue/purge but no raw queue query. Therefore this test does not claim to measure pending queue length. A WORKBENCH-only ExpandOneMember override counts calls only on explicitly tagged fixture groups and always calls unchanged super.ExpandOneMember(). Zero new dispatches plus stable physical member identities, observed alongside a successfully populated control, is the evidence for effective cancellation. Normal groups are not tagged.

After observation, each fixture owner rolls back once. The test retains weak references to every physical partial/control member and verifies that the three groups and all their characters are actually deleted. It then waits six seconds for late dispatches and verifies that the original mission site groups and READY service remain intact. Native errors remain visible to the ordinary raw-log checker. The fixture fails rather than claiming coverage if a partial squad cannot be observed before it fills, if the control cannot complete, or if the overall ninety-second deadline expires.

This fixture has not yet been run natively. Its evidence will cover the installed engine, tested timing and one disposable server world, not arbitrary multiplayer timing or performance acceptance.

Primary installed sources: scripts/Game/Entities/SCR_AIGroup.c (EOnInit, RequestSpawn, ExpandOneMember, GetSpawnQueueSize, DespawnMembers) and scripts/Game/generated/AI/ChimeraAIWorld.c (PurgeSpawnRequestsForGroup). No original Escapists code or assets are reused.

Native cancellation now passes in 073601: 68 assertions, no engine/script errors. Empty and partial groups remain stable through a fifteen-second observation while the uncancelled control fills. Owned rollback deletes all captured actors/groups, and the original mission groups remain unchanged.