From ac7aabe43b951b1d948fc8d87c293ed6a210c844 Mon Sep 17 00:00:00 2001 From: Oliver Kieselbach Date: Tue, 31 Mar 2026 03:41:22 +0200 Subject: [PATCH] fix ntpserver default --- src/Agent/AutopilotMonitor.Agent/buildcounter.txt | 2 +- .../DataAccess/TableStorage/TableConfigRepository.cs | 2 +- tasks/lessons.md | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Agent/AutopilotMonitor.Agent/buildcounter.txt b/src/Agent/AutopilotMonitor.Agent/buildcounter.txt index dc3a10aa..8766d8a9 100644 --- a/src/Agent/AutopilotMonitor.Agent/buildcounter.txt +++ b/src/Agent/AutopilotMonitor.Agent/buildcounter.txt @@ -1 +1 @@ -731 +732 diff --git a/src/Backend/AutopilotMonitor.Functions/DataAccess/TableStorage/TableConfigRepository.cs b/src/Backend/AutopilotMonitor.Functions/DataAccess/TableStorage/TableConfigRepository.cs index bd6ac2ec..94c2855d 100644 --- a/src/Backend/AutopilotMonitor.Functions/DataAccess/TableStorage/TableConfigRepository.cs +++ b/src/Backend/AutopilotMonitor.Functions/DataAccess/TableStorage/TableConfigRepository.cs @@ -464,7 +464,7 @@ namespace AutopilotMonitor.Functions.DataAccess.TableStorage RebootDelaySeconds = entity.GetInt32("RebootDelaySeconds"), EnableGeoLocation = entity.GetBoolean("EnableGeoLocation"), EnableTimezoneAutoSet = entity.GetBoolean("EnableTimezoneAutoSet"), - NtpServer = entity.GetString("NtpServer") ?? "", + NtpServer = entity.GetString("NtpServer") ?? "time.windows.com", EnableImeMatchLog = entity.GetBoolean("EnableImeMatchLog"), LogLevel = entity.GetString("LogLevel"), MaxBatchSize = entity.GetInt32("MaxBatchSize"), diff --git a/tasks/lessons.md b/tasks/lessons.md index f980001a..ded00d4b 100644 --- a/tasks/lessons.md +++ b/tasks/lessons.md @@ -14,6 +14,11 @@ ## Common Mistakes +### Table Storage mapping defaults must match domain defaults (2026-03-31) +**What went wrong:** Added `NtpServer` mapping with `?? ""` fallback. Existing tenants had no value stored → got empty string instead of `"time.windows.com"` → agent NTP check broke. +**Rule:** When adding missing Table Storage read mappings, the `??` fallback MUST match the domain/model default (check `AgentConfigResponse`, `GetAgentConfigFunction`, or the property initializer). Never use empty string as fallback for fields that have a meaningful default. +**Severity:** PRODUCTION — silently breaks agent functionality for all existing tenants. + ### PowerShell scripts deployed via Intune MUST be pure ASCII (2026-03-30) **What went wrong:** Em-dash characters `—` (U+2014) and Unicode symbols (✓, →, ✗) in Bootstrap .ps1 scripts caused cascading PowerShell parse errors in production. The IME (Intune Management Extension) uses PowerShell 5.1 which reads scripts without BOM as ANSI — multi-byte UTF-8 chars get corrupted. **Rule:** ALL `.ps1` files under `scripts/Bootstrap/` (and any other scripts deployed via Intune) MUST contain only ASCII characters (0x00-0x7F). No em-dashes, no Unicode symbols, no special quotes. Use `-` instead of `—`, `[OK]` instead of `✓`, etc.