v0.126.4: edge-safe error statuses + native-alert ban — writeDiskJSON maps 502/504→500 (CF swallows those bodies; the M1 refusal reached the operator as a JSON SyntaxError popup), M1 refusal = typed errLastUsableDrive → 409; all 29 native alert() swept to showAlert + native_confirm_gate now bans alert( (F-11 class complete)

This commit is contained in:
2026-07-13 14:13:05 +02:00
parent 6136461de6
commit c739003379
10 changed files with 147 additions and 40 deletions
@@ -84,6 +84,14 @@ func (s *Server) ProbeAgentChannel(ctx context.Context) (constructionErr bool, e
// writeDiskJSON writes the standard {ok,data,error} envelope used by the disk API.
func writeDiskJSON(w http.ResponseWriter, status int, ok bool, errMsg string, data interface{}) {
// Cloudflare replaces origin 502/504 bodies with its OWN HTML error page (no passthru on
// this plan) — the page JS then fails to parse JSON and the customer sees a SyntaxError
// alert instead of the Hungarian message (live-hit 2026-07-13: the M1 decommission refusal
// surfaced as "<!DOCTYPE ... is not valid JSON"). App-level JSON errors must never leave
// the origin as 502/504; 500 carries the body through the edge intact.
if status == http.StatusBadGateway || status == http.StatusGatewayTimeout {
status = http.StatusInternalServerError
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(status)
resp := map[string]interface{}{"ok": ok}