Server lifecycle
Server lifecycle and background authentication maintenance
Section titled “Server lifecycle and background authentication maintenance”Status: not yet released; this page describes the server lifecycle as built, with its scope and limitations.
The native CLI remains the composition root: erp server --config /private/server.toml discovers
addons, composes the registry and authorization policy, and opens the configured HTTP listener.
erp-server uses framework services; addons do not become dependencies of the transport crate.
Registration and readiness
Section titled “Registration and readiness”An application process registers in the tenant database through an ADR 0057 membership. Its node connection uses a role separate from both the request role and the schema owner. Role memberships, including NOINHERIT/SET/ADMIN paths, must not cross the request/heartbeat boundary; privilege admission examines reachable roles as well as directly effective grants. Publish that role’s node-table grants through the operator command before starting the service. Request transactions must never use the heartbeat pool.
Point serving configurations at prepared runtime addon trees. Release preparation excludes build tool dependencies and caches; a development tree containing package-manager links is not a runtime artifact. Node identity still checks the whole configured catalogue and refuses links in dev sources.
The membership compares build, addon and shared-configuration identities. Replicas of the same
service use the same canonical public_origin; their listener addresses may differ. A process becomes ready
only after its settle interval and identity checks succeed. New requests check the membership’s
local lease fence at admission, including when the heartbeat task has not run recently. A listening
socket alone does not establish readiness: probe GET /erp/health/ready and require HTTP 200;
HTTP 503 means that lease, registry or required authentication-maintenance health is not ready.
The GC health gate does not change the membership’s separately authoritative lease fence.
Registry and authorization changes use the existing SIGNAL path. A replacement publishes its complete service generation together, while work already admitted can finish on its previous generation. Failed publication remains visible as maintenance; a write is never replayed as recovery.
Authentication maintenance
Section titled “Authentication maintenance”The interim authentication collector exists until the job scheduler owns scheduling. It uses the existing authentication collector for expired/idle sessions and old throttle state. Scheduling must preserve its sweep cursor in shared durable storage and coordinate work across replicas; an in-memory cursor that starts again at page zero after restart is insufficient. A partial failure still returns the cursor of committed work, which the scheduler must preserve before reporting the failure.
A new WebApp starts with unknown collection health: HTTP readiness and both login methods
are closed. Native composition publishes health through WebApp::set_login_available only from
the supervised collector; an embedder must provide the same maintenance lifecycle.
The server starts the collector before exposing login. A failure disables both GET and POST
/erp/login while leaving HTTP and registry-refresh supervision alive. It retries with bounded
5/10/20/30-second backoff and exits on the fifth consecutive failure. A completed collection resets
the failure count and reopens login. A successful privilege/state probe followed by validated
NotDue may also establish or restore admission, because only successful collection advances the
shared due time. Busy alone never heals a prior failure. Contention with a valid fenced batch returns Busy without waiting for its lock;
it does not count as a failure of the healthy replica. Logs preserve error kinds and sanitized
cause categories, and repeated lack of progress produces a warning. Node self-fencing and registry
admission remain independently authoritative. A collector that stops or cannot maintain its
required state must produce a visible failure instead of leaving login active without cleanup. Addon
session-end hooks run under the collector’s existing transaction restrictions; they must propagate
errors and may not silently turn a refused operation into successful cleanup.
Shutdown
Section titled “Shutdown”On the operator’s termination signal the server stops admission, drains its membership, stops accepting connections and gives admitted requests the configured drain interval. HTTP cleanup, membership acknowledgements and runtime shutdown share one absolute deadline. Blocking jobs already started by Tokio cannot be cooperatively cancelled; runtime shutdown stops waiting at the remaining deadline, and CLI process exit reclaims unfinished blocking work. The drain setting is bounded; it never means an unlimited shutdown. The node lease protects admission after unexpected process loss, while scheduled exclusive work requires its own fencing at each effect.
Browser primitives and limits
Section titled “Browser primitives and limits”The framework’s signed anonymous preference cookie and CSRF tokens remain separate from session authentication. A per-response nonce primitive is available for shell page composition; consumers must obtain a new nonce for each response and propagate random-source failures. This slice does not claim that every page already consumes the primitive.
D14 startup validation checks accepted values and cross-setting byte-budget relationships. A passing startup check does not establish runtime implementation of an otherwise pending upload, websocket, streaming or performance slice. Product performance evidence remains deferred to milestone end under ADR 0065.
See the CLI guide for command configuration and authentication for the session lifecycle.