Files
EscapistsReintroduced/docs/item-station-teardown.md
T

5.0 KiB

Off-world medical-kit teardown

The installed vanilla SCR_BaseSupportStationComponent.OnDelete calls the virtual InitValidSetup before removing its damage listeners. The item-station validator requires a cached weak entity-catalog manager. An initialized station can outlive that manager, although teardown does not need the catalog. The native initialization routine also subscribes to resource replication independently of range; the native teardown's early return for non-range stations misses that subscription.

ERR_ItemStationTeardown.c changes only teardown of the exact stock US and USSR medical-kit resupply stations initialized off the main world while ERR_GameMode existed. Eligibility is recorded at the native damage-subscription phase, after the full virtual validation succeeded. The two non-range station types cannot have joined the support-station range manager. When their cached catalog has expired, cleanup cancels queued initialization and removes actual damage and resource subscriptions. A weak resource-component reference records the exact subscription source. No catalog is kept alive, fabricated, or replaced.

The default super path remains for valid catalogs, main-world stations, uninitialized stations, unrelated resources, other mission contexts, and edit mode. Startup/runtime InitValidSetup is never overridden. This is a bounded lifecycle correction, not an error filter.

Evidence limits

The archived companion restart at native-2026-09-19-084026-restart-station-error has two catalog errors between rounds despite 96 passing assertions. Diagnostic runs, including 08:58:27 on September 19, show the two initialized off-world kits deleted after the mode disappeared, but their cached/global catalogs were still present. They do not reproduce the expired-catalog condition. The identity of the native owner of these off-world objects (for example resource or preview cache) remains unproven. A clean targeted fixture cannot retroactively turn the archived restart failure into a pass or establish that this fix resolves it.

The optional station-teardown WORKBENCH probe owns a new preview world and two stock kits in sequence. It runs actual native initialization (explicitly if that preview world did not process the queued initialization), observes real resource and any installed damage-source invokers, then clears only the isolated station's cached catalog. It calls the production OnDelete boundary twice while the callback sources remain alive, verifies unsubscribing, and waits 500 ms to prove queued initialization does not run. Finally it deletes its kit and releases its world. It never alters a shared preview/cache entity, current mission stock, or the global manager.

This fixture is deliberately fault injection at the teardown boundary; it is not an observed spontaneous weak-reference expiry, a native restart reproduction, held UI interaction, or multiplayer evidence. Damage checks cover the sources actually installed on the stock prefab; a kit without damage sources cannot prove damage-callback removal dynamically. Python checks execute the actual scope predicate and check source invariants; they do not compile Enforce.

Native compilation and the opt-in fixture must pass before integration can be called verified. Follow with an ordinary companion restart with the diagnostic flag disabled and retain all script/VM errors without filtering.

Running the isolated case

The headless Workbench runner accepts --smoke station-teardown --project core --rounds 1, using its existing disposable prefix/profile and default timeout. Do not add --station-teardown-diagnostics for this qualification. Core steps 2000/2002 finish only after the probe returns success and then request the explicit fixture reset. Existing prison, map, and flight outcomes remain intact.

Seven station policy/integration/runner tests, five environment restart runner tests, and 32 ordinary game runner tests pass after integration. The runner checks stop at argument or missing-prefix validation and never launch a process or change audio. These counts are local checks, not native assertions.

Recorded native result

091641 passes 76 assertions with zero captured errors. Both US and USSR fixture kits execute native initialization and resource subscription, scoped cleanup, duplicate cleanup, callback detachment and delayed-initialization cancellation. Each reports nativeDamageSources=0; this run therefore does not dynamically verify damage-listener removal. The same global catalog remains alive and unchanged. Compilation and the targeted injected condition pass at that source; spontaneous catalog expiry and complete companion restart remain separate.

The 092512 full companion regression then completes two escape/restart rounds, 96 assertions and zero errors, with teardown diagnostics disabled. The earlier failing archive is retained. This is a clean subsequent pair, not evidence of deliberate catalog expiry during those resets or a guarantee against intermittent recurrence.