Files
canvas-frontend/nginx.conf
T
canvas-bot dd6175d038
build-and-publish / test (pull_request) Has been cancelled
build-and-publish / image (pull_request) Has been cancelled
feat(dogfood-wave1): fix Studio retries, Chat error, LLM gateway, kill snapshot, topbar cleanup
User dogfood found many bugs. This wave addresses:

- nginx.conf: proxy_next_upstream + retries on 502/503/504, explicit
  proxy_ssl_name, 8s connect timeout. The DNS-resolver race that
  caused the Studio 'apply_patch 502' is now eaten by nginx retry.

- src/lib/wizardApi.ts: applyBatch retries 3x on 502/503/504 with
  exponential backoff. Even if nginx misses the retry the client
  takes a second shot.

- src/lib/chatApi.ts: listThreads now THROWS when ensureInbox fails
  instead of silently returning []. Chat scene shows the error +
  retry button instead of an empty 'No conversations' state that
  hides the real failure.

- src/scenes/Chat.tsx: explicit error banner with 'Try again' button.

- src/lib/llmClient.ts: rewritten to call /api/v1/llm/generate
  (real demo gateway, same as dev.flow-master.ai uses). Removed the
  local /internal/canvas-llm/chat sidecar entirely.

- src/scenes/Agent.tsx: removed the LLM-state probe + 'off by
  default' OFF pill. LLM is now part of the assistant unconditionally.

- src/lib/flowCuration.ts: dropped the STARTABLE_FLOW_KEYS allowlist
  gate in curatedPublishedFlows so list_processes now returns every
  published business process, not just pr_to_po_def.

- src/state/store.ts + tests: DataMode is now 'live' only. Removed
  the SNAPSHOT branch; live is the only mode. Renamed the failure
  toast accordingly. Initial scene is 'mission' not 'landing'.

- src/scenes/Login.tsx + test: post-login navigates to 'mission'
  instead of the empty landing splash.

- src/scenes/Settings.tsx + src/components/CommandBar.tsx: removed
  every snapshot/setMode reference. Settings shows 'EA2 · live
  always'. Command palette no longer offers a snapshot switch.

- src/App.tsx: topbar redesign. Removed Settings + Home tabs
  (now in user menu), removed standalone Light/Dark + Console
  buttons (collapsed into user menu), removed the SNAPSHOT/LIVE
  mode pill + topbar refresh. New UserMenu component shows a 2-char
  avatar circle; clicking opens a dropdown with Home / Settings /
  Refresh data / theme toggle / API console toggle. Topbar now has:
  brand · tabs · cmd-k · notification bell · avatar.

- src/index.css: user-menu styles + chat-err styles + dark variants.

30/30 vitest pass. tsc + vite build green.
2026-06-15 18:29:39 +04:00

86 lines
3.8 KiB
Nginx Configuration File

map $sent_http_content_type $csp_header {
default "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' data: https://fonts.gstatic.com; img-src 'self' data: blob: https://*.tile.openstreetmap.org https://unpkg.com; connect-src 'self' https://demo.flow-master.ai https://canvas.flow-master.ai wss://canvas.flow-master.ai; frame-ancestors 'none'; base-uri 'self'; form-action 'self'; object-src 'none'";
}
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Hardening — every response carries these.
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(self), geolocation=(self), payment=()" always;
add_header Content-Security-Policy $csp_header always;
add_header Cross-Origin-Opener-Policy "same-origin" always;
add_header Cross-Origin-Resource-Policy "same-origin" always;
add_header X-Robots-Tag "noindex, nofollow" always;
# Use the cluster CoreDNS resolver for in-cluster Services AND public
# resolvers as fallback for external hostnames (demo.flow-master.ai etc.).
# k3s CoreDNS by default forwards external lookups, but if the forward
# is missing the proxy_pass to demo.flow-master.ai fails with 502/504.
# Listing public resolvers alongside ensures lookups succeed in both
# cases. Targets use $variable form to force lazy per-request resolution.
resolver 10.43.0.10 1.1.1.1 8.8.8.8 valid=30s ipv6=off;
# Reverse-proxy /api to the demo backend so live mode is same-origin.
# Pinned to the Cloudflare anycast IP for canvas.flow-master.ai (also
# serves demo) so per-request DNS resolution can NEVER fail mid-flight.
# 30s connect, 30s read, retry once on transient upstream failure.
location /api/ {
set $upstream_demo "https://demo.flow-master.ai";
proxy_pass $upstream_demo;
proxy_set_header Host demo.flow-master.ai;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_ssl_server_name on;
proxy_ssl_name demo.flow-master.ai;
proxy_http_version 1.1;
proxy_connect_timeout 8s;
proxy_send_timeout 30s;
proxy_read_timeout 30s;
proxy_buffering off;
proxy_next_upstream error timeout http_502 http_503 http_504;
proxy_next_upstream_tries 3;
proxy_next_upstream_timeout 10s;
}
# In-cluster LLM proxy. Returns 503 when no provider key is configured,
# so the frontend's deterministic fallback fires gracefully.
location /internal/canvas-llm/ {
set $upstream_llm "http://canvas-llm-proxy.demo.svc.cluster.local:8080";
proxy_pass $upstream_llm;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_http_version 1.1;
proxy_read_timeout 60s;
proxy_buffering off;
}
# SPA fallback to index.html for client-side routing.
location / {
try_files $uri $uri/ /index.html;
add_header Cache-Control "no-cache" always;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(self), geolocation=(self), payment=()" always;
add_header Content-Security-Policy $csp_header always;
}
# Hashed static assets cache forever.
location /assets/ {
try_files $uri =404;
add_header Cache-Control "public, max-age=31536000, immutable" always;
}
# Hide nginx version on errors.
server_tokens off;
}