fix: local timezone for replies + quiet-hours; guard presence "ago" overflow

Timezone: the container ran in UTC, so mavend answered clock/date queries
(voice.go replySystem) and evaluated quiet-hours (gather.go) in UTC. Fixed at
the root — process TZ — rather than per-call: TZ=Europe/Samara in compose +
tzdata in the image (debian-slim strips it, without which Go ignores TZ and
stays UTC). One knob fixes replies and quiet-hours for every daemon; change the
zone in compose.

Overflow: the dash "ago" helper ran time.Since on a zero timestamp (no presence
yet / fresh db), saturating to ~292y and rendering "2562047h47m…". Guard zero →
"never".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
kami
2026-07-04 00:13:13 +04:00
parent 1a3ef572d1
commit a38e733514
3 changed files with 16 additions and 2 deletions
+4 -1
View File
@@ -47,8 +47,11 @@ RUN go build -o /out/mavend ./cmd/mavend && \
go build -o /out/mavcaldav ./cmd/mavcaldav
FROM debian:trixie-slim AS runtime
# tzdata so the TZ env (set in compose) resolves — otherwise Go can't load the
# zone and time.Now() stays UTC, and mavend answers clock/date queries and
# evaluates quiet-hours in UTC.
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates libvulkan1 mesa-vulkan-drivers libgomp1 && \
ca-certificates libvulkan1 mesa-vulkan-drivers libgomp1 tzdata && \
rm -rf /var/lib/apt/lists/*
# runtime native libs: whisper/ggml (incl. vulkan) are real files in deps/lib.
+8 -1
View File
@@ -50,7 +50,14 @@ var dashHTML string
// text in facts/nudges. Read-only: browses the append-only store via CoreAPI,
// never writes — the store IS the audit trail, this just shows it.
var dashTmpl = template.Must(template.New("dash").Funcs(template.FuncMap{
"ago": func(t time.Time) string { return time.Since(t).Round(time.Second).String() + " ago" },
"ago": func(t time.Time) string {
// A zero timestamp (no presence signal yet, fresh DB) would make
// time.Since saturate to ~292y (MaxInt64) and render as garbage.
if t.IsZero() {
return "never"
}
return time.Since(t).Round(time.Second).String() + " ago"
},
}).Parse(dashHTML))
func noCache(h http.Handler) http.Handler {
+4
View File
@@ -15,6 +15,10 @@ x-image: &image
build: .
pull_policy: never # only ever the locally-built image
restart: unless-stopped
# local time for clock/date replies AND quiet-hours evaluation. Change to
# your zone; needs tzdata in the image (installed in the Dockerfile).
environment:
- TZ=Europe/Samara
services:
mavend: