fa491c752b
The gateway can lose connectivity to the Galaxy database, and the database is often unreachable exactly when the gateway restarts. The hierarchy cache was purely in-memory, so a cold start with no database left clients with an Unavailable browse surface until SQL came back. Add a JSON snapshot store: each successful heavy refresh writes the raw hierarchy and attribute rowsets to disk atomically (temp file + rename), and the first refresh after startup restores that snapshot before any SQL runs. Restored data is served as Stale until a live query confirms it; a live query that observes the same time_of_last_deploy promotes it to Healthy with no heavy re-query. Persistence is on by default (MxGateway:Galaxy:PersistSnapshot) and writes to C:\ProgramData\MxGateway\galaxy-snapshot.json. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>