From a7d09291b88b6f85db276198b365323cfd1aa1b0 Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 6 Mar 2026 21:05:39 +0000 Subject: [PATCH] Add version logging and route decision logging to sx-browser boot-init prints SX_VERSION (build timestamp) to console on startup. tryClientRoute logs why it falls through: has-data, no content, eval failed, #main-panel not found. tryEvalContent logs the actual error. Added logWarn platform function. Co-Authored-By: Claude Opus 4.6 --- shared/static/scripts/sx-browser.js | 3 ++- shared/sx/ref/boot.sx | 1 + shared/sx/ref/bootstrap_js.py | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/shared/static/scripts/sx-browser.js b/shared/static/scripts/sx-browser.js index 3214d2e..9282400 100644 --- a/shared/static/scripts/sx-browser.js +++ b/shared/static/scripts/sx-browser.js @@ -14,6 +14,7 @@ // ========================================================================= var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } }); + var SX_VERSION = "2026-03-06T21:05:23Z"; function isNil(x) { return x === NIL || x === null || x === undefined; } function isSxTruthy(x) { return x !== false && !isNil(x); } @@ -2349,7 +2350,7 @@ callExpr.push(dictGet(kwargs, k)); } } })(); }; // boot-init - var bootInit = function() { return (initCssTracking(), initStyleDict(), processSxScripts(NIL), processPageScripts(), sxHydrateElements(NIL), processElements(NIL)); }; + var bootInit = function() { return (logInfo((String("sx-browser ") + String(SX_VERSION))), initCssTracking(), initStyleDict(), processSxScripts(NIL), processPageScripts(), sxHydrateElements(NIL), processElements(NIL)); }; // ========================================================================= diff --git a/shared/sx/ref/boot.sx b/shared/sx/ref/boot.sx index 41e7fec..0e95e85 100644 --- a/shared/sx/ref/boot.sx +++ b/shared/sx/ref/boot.sx @@ -336,6 +336,7 @@ ;; 5. Hydrate [data-sx] elements ;; 6. Process engine elements (do + (log-info (str "sx-browser " SX_VERSION)) (init-css-tracking) (init-style-dict) (process-sx-scripts nil) diff --git a/shared/sx/ref/bootstrap_js.py b/shared/sx/ref/bootstrap_js.py index c63e54e..f39c979 100644 --- a/shared/sx/ref/bootstrap_js.py +++ b/shared/sx/ref/bootstrap_js.py @@ -476,6 +476,7 @@ class JSEmitter: "process-sx-scripts": "processSxScripts", "process-component-script": "processComponentScript", "init-style-dict": "initStyleDict", + "SX_VERSION": "SX_VERSION", "boot-init": "bootInit", "resolve-mount-target": "resolveMountTarget", "sx-render-with-env": "sxRenderWithEnv", @@ -1288,7 +1289,9 @@ def compile_ref_to_js( parts.append(CONTINUATIONS_JS) parts.append(public_api_js(has_html, has_sx, has_dom, has_engine, has_orch, has_cssx, has_boot, has_parser, adapter_label, has_deps, has_router)) parts.append(EPILOGUE) - return "\n".join(parts) + from datetime import datetime, timezone + build_ts = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ") + return "\n".join(parts).replace("BUILD_TIMESTAMP", build_ts) # --------------------------------------------------------------------------- @@ -1312,6 +1315,7 @@ PREAMBLE = '''\ // ========================================================================= var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } }); + var SX_VERSION = "BUILD_TIMESTAMP"; function isNil(x) { return x === NIL || x === null || x === undefined; } function isSxTruthy(x) { return x !== false && !isNil(x); }