---
id: w1/m4/t005
title: Verify sleep→wake; paid tiers stay always-on
worker: worker1
status: done
estimate: 20m
depends_on: [w1/m4/t001, w1/m4/t004]
---

## Objective

Prove the full free-tier hibernation loop and that paid tiers are unaffected.

## Verification

Unit tests in `lego/operator/internal/controller/idle_test.go` — all pass (`go test ./internal/controller/` — 23/23):

- `TestIsFreeApp`: `tier=""` and `tier="free"` → free; all paid tiers (starter, standard, pro, pro-plus) → not free.
- `TestShouldAutoHibernate`:
  - Free + TTL elapsed → hibernate.
  - Free + TTL not elapsed → no hibernate.
  - Paid tier (starter, pro) + any TTL → no hibernate (always-on).
  - Manually suspended → no auto-hibernate (defers to spec.suspended logic).
  - No `last-active` annotation → no hibernate (operator stamps it first).
- `TestIdleRequeueAfter`: correct requeue timing; 5s floor past-deadline.
- Existing envtest suite (5 specs) still passes — no regressions.

Full e2e (idle app → 0 replicas → request → wake → 200) requires a live cluster with `BEX_ACTIVATOR_SERVICE=bex-activator` set on the operator and `kubectl apply -k config/activator/`.
