From 7f1de927dda0354d43ba9e2e2a0d246bc30c9d4a Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 7 Jun 2026 20:04:20 +0000 Subject: [PATCH] [client] Leave userMessage empty on deadline-rejected event; use metadata key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Daemon-layer PublishEvent userMessage strings are not localized — the UI reads metadata keys and builds its own locale-aware copy (same pattern as the session-warning events in event.go). Drop the hardcoded English sentence from the deadline-rejected event and instead surface the rejection reason via a new MetaSessionDeadlineRejected metadata key so the UI can detect and localize it. https://claude.ai/code/session_01Y3bQoNgcVjTD4zDTvv7a8u --- client/internal/auth/sessionwatch/event.go | 7 +++++++ client/internal/engine_authsession.go | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/internal/auth/sessionwatch/event.go b/client/internal/auth/sessionwatch/event.go index 7a0ec8ce7..81df3319a 100644 --- a/client/internal/auth/sessionwatch/event.go +++ b/client/internal/auth/sessionwatch/event.go @@ -33,6 +33,13 @@ const ( // for the T-10 event, FinalWarningLead for the T-2 event) so the UI // can show "expires in ~N minutes" without hardcoding either constant. MetaSessionLeadMinutes = "lead_minutes" + // MetaSessionDeadlineRejected is set to the rejection reason when the + // daemon discards a deadline received from the management server (e.g. + // pre-epoch, too far in the future, or past the clock-skew tolerance). + // The UI uses this key to detect the event and display a localized + // message; userMessage is intentionally left empty for the same reason + // as the warning events above. + MetaSessionDeadlineRejected = "session_deadline_rejected" ) // expiresAtLayout is the wire format used for MetaSessionExpiresAt. diff --git a/client/internal/engine_authsession.go b/client/internal/engine_authsession.go index c12b6de6b..8335c2cb5 100644 --- a/client/internal/engine_authsession.go +++ b/client/internal/engine_authsession.go @@ -10,6 +10,7 @@ import ( "google.golang.org/protobuf/types/known/timestamppb" cProto "github.com/netbirdio/netbird/client/proto" + "github.com/netbirdio/netbird/client/internal/auth/sessionwatch" "github.com/netbirdio/netbird/client/system" ) @@ -56,8 +57,8 @@ func (e *Engine) ApplySessionDeadline(ts *timestamppb.Timestamp) { cProto.SystemEvent_ERROR, cProto.SystemEvent_AUTHENTICATION, "session deadline rejected", - "The session expiry time from the server could not be applied. Re-login may be required.", - map[string]string{"reason": err.Error()}, + "", + map[string]string{sessionwatch.MetaSessionDeadlineRejected: err.Error()}, ) } }