diff --git a/cmd/server/routes_test.go b/cmd/server/routes_test.go
index 7b8a474a..02f1a899 100644
--- a/cmd/server/routes_test.go
+++ b/cmd/server/routes_test.go
@@ -121,6 +121,9 @@ func TestHealthEndpoint(t *testing.T) {
if _, ok := body["commit"]; !ok {
t.Error("expected commit field in health response")
}
+ if bt, ok := body["buildTime"]; !ok || bt == nil {
+ t.Error("expected non-nil buildTime field in health response")
+ }
// Verify memory has spec-defined fields (no heapMB or goRuntime per api-spec.md)
mem, ok := body["memory"].(map[string]interface{})
@@ -201,6 +204,9 @@ func TestStatsEndpoint(t *testing.T) {
if _, ok := body["commit"]; !ok {
t.Error("expected commit field in stats response")
}
+ if bt, ok := body["buildTime"]; !ok || bt == nil {
+ t.Error("expected non-nil buildTime field in stats response")
+ }
}
func TestPacketsEndpoint(t *testing.T) {
diff --git a/public/app.js b/public/app.js
index c7515348..b2804392 100644
--- a/public/app.js
+++ b/public/app.js
@@ -210,8 +210,13 @@ function formatEngineBadge(engine) {
return ` ${engine}`;
}
-function formatVersionBadge(version, commit, engine) {
+function formatVersionBadge(version, commit, engine, buildTime) {
if (!version && !commit && !engine) return '';
+ var buildAge = '';
+ if (buildTime && buildTime !== 'unknown') {
+ var age = timeAgo(buildTime);
+ if (age && age !== '—') buildAge = ' (' + age + ')';
+ }
var port = (typeof location !== 'undefined' && location.port) || '';
var isProd = !port || port === '80' || port === '443';
var GH = 'https://github.com/Kpa-clawbot/corescope';
@@ -222,7 +227,7 @@ function formatVersionBadge(version, commit, engine) {
}
if (commit && commit !== 'unknown') {
var short = commit.length > 7 ? commit.slice(0, 7) : commit;
- parts.push('' + short + '');
+ parts.push('' + short + '' + buildAge);
}
if (engine) parts.push('' + engine + '');
if (parts.length === 0) return '';
@@ -698,7 +703,7 @@ window.addEventListener('DOMContentLoaded', () => {
const stats = await api('/stats', { ttl: CLIENT_TTL.stats });
const el = document.getElementById('navStats');
if (el) {
- el.innerHTML = `${stats.totalPackets} pkts · ${stats.totalNodes} nodes · ${stats.totalObservers} obs${formatVersionBadge(stats.version, stats.commit, stats.engine)}`;
+ el.innerHTML = `${stats.totalPackets} pkts · ${stats.totalNodes} nodes · ${stats.totalObservers} obs${formatVersionBadge(stats.version, stats.commit, stats.engine, stats.buildTime)}`;
el.querySelectorAll('.stat-val').forEach(s => s.classList.add('updated'));
setTimeout(() => { el.querySelectorAll('.stat-val').forEach(s => s.classList.remove('updated')); }, 600);
}
diff --git a/public/index.html b/public/index.html
index fb55251f..2ede25e9 100644
--- a/public/index.html
+++ b/public/index.html
@@ -22,9 +22,9 @@
-
-
-
+
+
+
@@ -81,31 +81,31 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+