feat(v0.6): route lease-freshness callsites through IsStale

InspectLease, CleanupStaleLease, runActiveLeaseCheck, and statusAt now
use the PID-aware IsStale predicate. A dead local owner PID makes a lease
stale immediately; SessionStatus / list / info reflect this with no
display-code change.

Corrects three cmd-package session-display test fixtures that built
"active" leases with the local hostname but synthetic PIDs — now that
freshness is PID-aware, an active session must be owned by a live
process, so the fixtures use os.Getpid().
This commit is contained in:
2026-05-15 14:29:50 -04:00
parent f379a6d059
commit d575ddd0f5
7 changed files with 70 additions and 10 deletions
+1 -1
View File
@@ -189,7 +189,7 @@ func CleanupStaleLease(path string, staleAfter time.Duration) (*Lease, error) {
}
return nil, nil
}
if IsFresh(&l, time.Now(), staleAfter) {
if !IsStale(&l, time.Now(), staleAfter) {
return nil, nil
}
if rmErr := os.Remove(path); rmErr != nil && !errors.Is(rmErr, os.ErrNotExist) {