Stage 17 round 6 (#16-20): landing page, /app/ move, cache + stream fixes
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 11s
CI / ui (pull_request) Successful in 31s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 55s

Close out Stage 17 round 6:

- Landing page at / — one Vite build with two entries (index.html = game
  SPA, landing.html = a lightweight landing reusing the theme/i18n/
  aboutContent leaf modules, not the app store).
- Move the web game SPA to /app/; the Telegram Mini App stays at /telegram/
  (gateway webui.Handler(stripPrefix, indexName): landing at /, SPA at /app/
  + /telegram/). Per-language "Play in Telegram" link via new
  VITE_TELEGRAM_LINK_EN/_RU build vars (button hides when unset).
- Cache headers: hash-named /assets/* immutable, HTML shells no-cache (the
  go:embed zero modtime emitted no validators, so the client re-downloaded
  the whole bundle every launch).
- Live-stream 15s abort fix: an immediate heartbeat on open + a 10s default
  interval (the first tick at 15s raced the edge idle timeout -> reconnect
  storm).

PLAN/ARCHITECTURE(§13)/FUNCTIONAL(+ru)/gateway+ui+deploy READMEs updated;
round 6 closed. Tests: gateway webui/connectsrv units, ui landing unit + e2e,
full e2e (60) green.
This commit is contained in:
Ilia Denisov
2026-06-08 13:33:05 +02:00
parent b8787a4123
commit e16076c89e
27 changed files with 519 additions and 82 deletions
+16 -6
View File
@@ -99,12 +99,14 @@ func (s *Server) HTTPHandler() http.Handler {
// does not serve the app shell at the operator path.
mux.Handle("/_gm/", http.NotFoundHandler())
}
// The embedded single-page UI is served at the site root and, for the Telegram
// Mini App, under /telegram/ — the single-origin model (docs/ARCHITECTURE.md
// §13). Both mounts sit below the h2c wrap so the Connect edge (a more specific
// prefix) keeps priority; "/" is the catch-all SPA fallback for the hash router.
mux.Handle("/telegram/", webui.Handler("/telegram/"))
mux.Handle("/", webui.Handler(""))
// The embedded UI: the game SPA under /app/ (web) and /telegram/ (the Telegram Mini
// App), with a separate landing page at the catch-all "/" — the single-origin model
// (docs/ARCHITECTURE.md §13). All sit below the h2c wrap so the Connect edge (a more
// specific prefix) keeps priority. Each SPA mount falls back to the app shell
// (index.html) for the hash router; "/" falls back to the landing (landing.html).
mux.Handle("/telegram/", webui.Handler("/telegram/", "index.html"))
mux.Handle("/app/", webui.Handler("/app/", "index.html"))
mux.Handle("/", webui.Handler("", "landing.html"))
return h2c.NewHandler(mux, &http2.Server{})
}
@@ -184,6 +186,14 @@ func (s *Server) Subscribe(ctx context.Context, req *connect.Request[edgev1.Subs
events, cancel := s.hub.Subscribe(uid)
defer cancel()
// Send an immediate heartbeat so the stream's first byte flushes through the proxy chain
// right away and resets edge/client idle timers, instead of the connection sitting silent
// until the first tick — which otherwise raced a ~15 s idle timeout and forced a reconnect
// every interval (Stage 17).
if err := stream.Send(&edgev1.Event{Kind: heartbeatKind}); err != nil {
return err
}
ticker := time.NewTicker(s.heartbeat)
defer ticker.Stop()