---
name: rt-a1-effective-rest-state
description: REMOTE-TRUTH A-1 — the shared effective_rest_state derivation, and the fixture-liveness trap that breaks pre-existing apply_event tests when from becomes liveness-aware.
metadata:
  type: project
---

REQ-EFFECTIVE-INSTANCE-STATE (REMOTE-TRUTH A-1, ADR-0033): one shared
`spt_daemon::resting::effective_rest_state(alive, unbound, intent) -> RestState`
now backs BOTH `registryhost::advertised_status` (RestState->Status map) and
`resting::apply_event`'s `from`. It replaced apply_event's liveness-blind
`unwrap_or(RestState::Active)` (the NO_EDGE-on-a-suspended-endpoint field bug).

**Why (the fixture trap — bit us here, will recur on A-2+ resting/liveness work):**
making `apply_event`'s `from` liveness-aware (it now calls
`spt_store::liveness::is_perch_alive/is_perch_unbound` on the perch path) broke
5 pre-existing `apply_event` unit tests in resting.rs. Their fixtures wrote
`InfoJson::new(..., 4242, ...)` with NO `status` field — "live" in the test prose
but with a dead/arbitrary pid, so `is_perch_alive` now reads false and derives
`from=Suspended` instead of the intended `Active`. The old code never checked
liveness, so the under-specified fixtures passed anyway.

**How to apply:** when a fixture's prose says "a live/recordless-Active perch",
the fixture MUST actually establish liveness — `set_status(perch, STATUS_ONLINE)`
after `write_info` (from `spt_store::info::set_status` +
`spt_store::liveness::STATUS_ONLINE`). For a COLD perch, `set_status(STATUS_OFFLINE)`
makes both is_perch_alive AND is_perch_unbound false ⇒ effective = Suspended.
registryhost's `advertised_status_splits_unbound_warm_from_cold_suspended`
(@~1740) already did this correctly (uses `std::process::id()` for alive, a
DEAD_PID const for cold) — mirror it. See [[daemon-lib-tests-deadlock-on-live-host]].

RED-first proof that worked: a cold void perch (offline, no rest_state) —
`apply_event(Wake)` under old code returned Ok(None) (from=Active ⇒ Wake no-edge);
`apply_event(Suspend)` faked an Active->Suspended edge + fired a spurious echo.
Both flipped correct after the fix.
