mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-24 20:22:53 +00:00
fe9c64a4d3
The shell fetched `/api/state` on every sign-in for two reasons: to learn whether the session was authenticated, and to have something to render before the socket connected. On a real estate that is 96% resources, and the fetch sat on the critical path ahead of the websocket, which could not begin connecting until it returned. Neither reason survives. The session probe is now `/api/state/summary`, which passes the same auth and monitoring-read scope checks and returns a few hundred bytes. Navigation resolves from the platform admission facet. Nothing else in the shell read the payload: `state()` had exactly three consumers, two of them navigation and one an alert-count badge that the socket supplies. `/api/state` itself is untouched. It is the recovery path for a snapshot too large for a websocket frame, which is precisely what the largest estates need, so shrinking the endpoint would have removed the escape hatch for the installs that depend on it most. The seeded bootstrap state is gone rather than left empty. Keeping it would have been actively unsafe: `runtimeStateResolved()` meant "a payload arrived", so a bootstrap that no longer carried resources would still read as resolved and navigation would classify an empty estate, hiding every platform tab. Resolution is now websocket-backed, and an empty estate is answered by the facet admitting nothing, which is a resolved answer rather than an absent one. Verified against two backends built from this change: a populated estate resolves all six tabs, lands on the Proxmox overview and renders every platform page, and an estate with zero resources shows no platform tabs in the navigation landmark and lands on the infrastructure settings page. Both issue one summary probe and zero `/api/state` requests. Known regression: the alert-count badge is empty for the sub-second window before the socket delivers alerts, where the bootstrap payload used to supply it. The alerts store is not socket-synced, so reading the badge from it would have traded a brief empty count for a lastingly stale one. Tests that pinned the old mechanism were rewritten to their subjects: the SSO and proxy-auth cases keep their auth assertions, and the empty-estate distinction now asserts the facet admitting nothing rather than a full-state payload arriving. Contracts: performance-and-scalability records that the bootstrap is estate-independent and that `/api/state` stays the recovery path rather than a bootstrap surface; cloud-paid records the tenant probe.