feat: owner review 2 phase 4b: mass conversion after import #13

Merged
Alby96 merged 82 commits from claude/owner-review-2-p4b-rc7 into main 2026-11-03 10:41:59 +01:00
53 changed files with 254 additions and 92 deletions
Showing only changes of commit ac121acf7c - Show all commits

No files matched your search

+4 -1
View File
@@ -91,7 +91,10 @@ admin panel shows under Settings so you can compare them.
continues in `.1.log`, `.2.log`… at 50 MB (`CHRONOS_LOG_MAX_FILE_MB`), files are kept 14 days
(`CHRONOS_LOG_RETENTION_DAYS`) and the oldest go when all of them pass 1024 MB (`CHRONOS_LOG_MAX_TOTAL_MB`; 0: no
limit). `CHRONOS_LOG_LEVEL` sets the level of the files and the console, `CHRONOS_LOG_CONSOLE_LEVEL` the console's
alone. Without these variables the admin panel changes them in Settings › Logs while the server runs.
alone. Without these variables the admin panel changes them in Settings › Logs while the server runs; a field a
variable fixes is read-only there, and its tooltip names the variable. The compose file and Unraid template of earlier
versions set `CHRONOS_LOG_LEVEL: Information`, which now fixes both levels: remove it (compose: delete the line;
Unraid: edit the container and clear *Log level*) to choose them in the panel.
- Other host ports: when you publish the container's ports as other host ports (`18443:8443`), set
`CHRONOS_PUBLIC_HTTPS_PORT` (and `CHRONOS_PUBLIC_HTTP_PORT`) to the host ports, so the admin panel's redirect to HTTPS
and LAN discovery name the ports clients can reach.
+1 -1
View File
@@ -74,7 +74,7 @@ Dependencies point one way: `Core` ← `Core.Windows`, `Data`, `Protocol` ← `S
| `Archive` | `CurrentArchive`, `ArchiveTree`, figures for the charts, maintenance reports, mass rename and move, delete and trash dialogs (`SequenceDeletion`, `DeletePlans`), `ArchiveFailures` |
| `Server` | `ServerSession`, `ConnectFlow` (trust on first use), `SyncHost` (sync engine, agent, metered hold, editor connections, Export Sync), sync table, `RemoteSequenceApi` |
| `Jobs`, `Settings`, `About` | Job list and buffering, `JobNotices` (which job endings raise a toast; `JobEndings` lets a batch speak once); the schedules of Jobs › Scheduled (`DesktopScheduleHost`: the desktop's `IScheduleHost` and its system schedules `archive-scan`, `index-backup`, `housekeeping`; `CacheTrimStep`, the host's clean-up step; `SchedulesViewModel`, `ScheduleRowViewModel`, `ScheduleEditorViewModel` and `ScheduleDialogs.xaml`, the in-window editor; `ScheduleText`); settings rows (`LogSettingsRows`: Advanced's log rows), encoder and format inventories, `ProcessingTuning` (Settings › Rendering and Analysis applied to each job: parallelism, memory budget, quality), `InterfacePriority`, language catalog, naming preview; `AboutViewModel` (owned by the shell, not a section: Settings › About, the update notice of Settings › Updates and the update check on start), update check and download |
| `Infrastructure` | `AppServices` (composition root), `AppSettings`, `AppLogging` (Settings › Advanced › Logs applied to the log files at start and at every save), `AppEnvironment` (installed or portable), `AppClock` (today's date, frozen by `--capture`), `StartWithWindows` (this copy's sign-in entry), `UiLanguage`, `LiveRegion`, `RenderNodeHost`, `DiagnosticsBundle`, `ShellActions` (BRIEF §8.6), `SingleInstance` (one Chronos per data folder; a later launch hands its file over a named pipe, or waits for a closing one to exit and starts in its place), device monitor |
| `Infrastructure` | `AppServices` (composition root), `AppSettings`, `AppLogging` (Settings › Advanced › Logs applied to the log files from their first line, a launch that only hands over included, and at every save), `AppEnvironment` (installed or portable), `AppClock` (today's date, frozen by `--capture`), `StartWithWindows` (this copy's sign-in entry), `UiLanguage`, `LiveRegion`, `RenderNodeHost`, `DiagnosticsBundle`, `ShellActions` (BRIEF §8.6), `SingleInstance` (one Chronos per data folder; a later launch hands its file over a named pipe, or waits for a closing one to exit and starts in its place), device monitor |
| `DesignTime` | `SampleData`: the archive, jobs and server the screenshots and smoke tests run on, dated from the fixed `SampleData.Now` |
### 2.4 Chronos.Ui and Chronos.Server
-1
View File
@@ -314,7 +314,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>اللغة</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>لغة رسائل الخادم عندما لا يطلب العميل لغة معينة</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>الحدود والاحتفاظ</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>يعيّنه متغير البيئة {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>أقصى حجم للملف (ميغابايت)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>أكبر حجم مقبول للملف الواحد المرفوع</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>الشبكة وبروتوكول TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Език</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Език на съобщенията на сървъра, когато клиентът не е поискал конкретен език</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Ограничения и съхранение</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Зададено от променливата на средата {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Макс. файл (МБ)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Най-голямото приемано единично качване</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Мрежа и TLS</value></data>
-1
View File
@@ -301,7 +301,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Jazyk</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Jazyk zpráv serveru, pokud klient žádný nevyžaduje</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limity a uchovávání</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Nastaveno proměnnou prostředí {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Max. soubor (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Největší přijatý jednotlivý soubor při nahrávání</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Síť a TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Sprog</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Sproget i servermeddelelser, når en klient ikke beder om et bestemt sprog</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Grænser og opbevaring</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Angivet af miljøvariablen {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Maks. fil (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Den største enkeltupload, der accepteres</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Netværk og TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Sprache</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Sprache der Servermeldungen, wenn ein Client keine angibt</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limits und Aufbewahrung</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Durch die Umgebungsvariable {0} festgelegt</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Max. Datei (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Größter angenommener Einzel-Upload</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Netzwerk und TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Γλώσσα</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Γλώσσα των μηνυμάτων του διακομιστή όταν ένα πρόγραμμα-πελάτης δεν ζητά καμία</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Όρια και διατήρηση</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Ορίζεται από τη μεταβλητή περιβάλλοντος {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Μέγ. αρχείο (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Το μεγαλύτερο μεμονωμένο αρχείο που γίνεται δεκτό σε μια αποστολή</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Δίκτυο και TLS</value></data>
+1 -2
View File
@@ -461,8 +461,7 @@
<data name="Admin.Settings.Level.Trace" xml:space="preserve"><value>Trace</value></data>
<data name="Admin.Settings.Level.Warning" xml:space="preserve"><value>Warning</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limits and retention</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Set by the environment variable {0}</value></data>
<data name="Admin.Settings.LockedEither.Tip" xml:space="preserve"><value>Set by the environment variable {0} or {1}</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Set by the environment variable {0}; remove the variable to change it here</value></data>
<data name="Admin.Settings.LogLevel" xml:space="preserve"><value>File level</value></data>
<data name="Admin.Settings.LogLevel.Tip" xml:space="preserve"><value>Least severe level written to the log files; Debug and Trace help find problems but fill the files fast</value></data>
<data name="Admin.Settings.LogMaxFileMb" xml:space="preserve"><value>File size (MB)</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Idioma</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Idioma de los mensajes del servidor cuando un cliente no pide ninguno</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Límites y retención</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Definido por la variable de entorno {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Archivo máx. (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Tamaño máximo aceptado para una sola subida</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Red y TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Keel</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Serveri teadete keel, kui klient keelt ei määra</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Piirangud ja säilitamine</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Määratud keskkonnamuutujaga {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Maks. fail (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Suurim vastuvõetav üksikfail</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Võrk ja TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Kieli</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Palvelimen viestien kieli, kun asiakasohjelma ei pyydä mitään kieltä</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Rajat ja säilytys</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Asetettu ympäristömuuttujalla {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Tiedosto enint. (Mt)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Suurin hyväksytty yksittäinen lähetys</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Verkko ja TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Langue</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Langue des messages du serveur quand un client n'en demande aucune</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limites et conservation</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Défini par la variable d'environnement {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Fichier max. (Mo)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Taille maximale acceptée pour un seul envoi</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Réseau et TLS</value></data>
-1
View File
@@ -301,7 +301,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>שפה</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>שפת ההודעות של השרת כאשר הלקוח אינו מבקש שפה</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>מגבלות ושמירה</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>נקבע על ידי משתנה הסביבה {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>קובץ מרבי (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>הקובץ הגדול ביותר שמתקבל בהעלאה בודדת</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>רשת ו-TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>भाषा</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>जब क्लाइंट कोई भाषा न माँगे, तब सर्वर संदेशों की भाषा</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>सीमाएँ और अवधारण</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>परिवेश चर {0} द्वारा सेट</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>अधिकतम फ़ाइल (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>स्वीकार किया जाने वाला सबसे बड़ा एकल अपलोड</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>नेटवर्क और TLS</value></data>
-1
View File
@@ -301,7 +301,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Jezik</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Jezik poruka poslužitelja kada klijent ne zatraži nijedan</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Ograničenja i čuvanje</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Vrijednost postavlja varijabla okruženja {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Najveća datoteka (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Najveći prihvaćeni pojedinačni prijenos</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Mreža i TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Nyelv</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>A szerverüzenetek nyelve, ha a kliens nem kér konkrét nyelvet</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Korlátok és megőrzés</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>A(z) {0} környezeti változó állítja be</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Max. fájlméret (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>A legnagyobb elfogadott egyedi feltöltés</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Hálózat és TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Bahasa</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Bahasa pesan server jika klien tidak meminta bahasa tertentu</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Batas dan retensi</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Diatur oleh variabel lingkungan {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>File maks. (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Ukuran unggahan tunggal terbesar yang diterima</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Jaringan dan TLS</value></data>
+1 -2
View File
@@ -460,8 +460,7 @@
<data name="Admin.Settings.Level.Trace" xml:space="preserve"><value>Trace</value></data>
<data name="Admin.Settings.Level.Warning" xml:space="preserve"><value>Avviso</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limiti e conservazione</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Impostato dalla variabile d'ambiente {0}</value></data>
<data name="Admin.Settings.LockedEither.Tip" xml:space="preserve"><value>Impostato dalla variabile d'ambiente {0} o {1}</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Impostato dalla variabile d'ambiente {0}; rimuovi la variabile per cambiarlo qui</value></data>
<data name="Admin.Settings.LogLevel" xml:space="preserve"><value>Livello file</value></data>
<data name="Admin.Settings.LogLevel.Tip" xml:space="preserve"><value>Livello minimo scritto nei file di log; Debug e Trace aiutano a trovare i problemi ma riempiono i file in fretta</value></data>
<data name="Admin.Settings.LogMaxFileMb" xml:space="preserve"><value>Dimensione file (MB)</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>言語</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>クライアントが言語を指定しない場合のサーバーメッセージの言語です。</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>制限と保持</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>環境変数 {0} で設定されています。</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>最大ファイル (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>1 回のアップロードで受け付ける最大サイズです。</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>ネットワークと TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>언어</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>클라이언트가 언어를 지정하지 않을 때 쓰는 서버 메시지 언어</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>제한 및 보존</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>환경 변수 {0}에서 설정됨</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>최대 파일(MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>허용되는 단일 업로드의 최대 크기</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>네트워크 및 TLS</value></data>
-1
View File
@@ -301,7 +301,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Kalba</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Serverio pranešimų kalba, kai klientas jos nenurodo</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Ribos ir saugojimas</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Nustatyta aplinkos kintamuoju {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Didžiausias failas (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Didžiausias priimamo vieno įkeliamo failo dydis</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Tinklas ir TLS</value></data>
-1
View File
@@ -301,7 +301,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Valoda</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Servera ziņojumu valoda, ja klients to nenorāda</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Ierobežojumi un glabāšana</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Iestatīts ar vides mainīgo {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Maks. fails (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Lielākais pieņemtais viena faila augšupielādes apjoms</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Tīkls un TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Bahasa</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Bahasa mesej pelayan apabila klien tidak meminta sebarang bahasa</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Had dan pengekalan</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Ditetapkan oleh pemboleh ubah persekitaran {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Fail maks (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Muat naik tunggal terbesar yang diterima</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Rangkaian dan TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Språk</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Språket i servermeldinger når en klient ikke ber om et bestemt språk</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Grenser og oppbevaring</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Angitt av miljøvariabelen {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Maks. filstørrelse (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Største enkeltopplasting som godtas</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Nettverk og TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Taal</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Taal van serverberichten als een client er geen opgeeft</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limieten en bewaartermijn</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Ingesteld door de omgevingsvariabele {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Max. bestand (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Grootste afzonderlijke upload die wordt geaccepteerd</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Netwerk en TLS</value></data>
-1
View File
@@ -314,7 +314,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Język</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Język komunikatów serwera, gdy klient nie wskaże żadnego</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limity i przechowywanie</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Ustawione przez zmienną środowiskową {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Maks. rozmiar pliku (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Największy akceptowany rozmiar pojedynczego przesyłanego pliku</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Sieć i TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Idioma</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Idioma das mensagens do servidor quando o cliente não pede nenhum</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limites e retenção</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Definido pela variável de ambiente {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Arquivo máximo (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Maior envio individual aceito</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Rede e TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Idioma</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Idioma das mensagens do servidor quando um cliente não pede nenhum</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limites e retenção</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Definido pela variável de ambiente {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Ficheiro máx. (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Maior carregamento individual aceite</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Rede e TLS</value></data>
-1
View File
@@ -301,7 +301,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Limbă</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Limba mesajelor serverului atunci când clientul nu cere una anume</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limite și păstrare</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Setat prin variabila de mediu {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Fișier maxim (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Cea mai mare încărcare individuală acceptată</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Rețea și TLS</value></data>
-1
View File
@@ -314,7 +314,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Язык</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Язык сообщений сервера, если клиент не указал свой</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Ограничения и хранение</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Задаётся переменной среды {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Макс. размер файла (МБ)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Наибольший размер одного принимаемого файла</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Сеть и TLS</value></data>
-1
View File
@@ -301,7 +301,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Jazyk</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Jazyk správ servera, keď klient žiadny nepožaduje</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Limity a uchovávanie</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Nastavené premennou prostredia {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Max. súbor (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Najväčší jednotlivý súbor, ktorý server pri nahrávaní prijme</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Sieť a TLS</value></data>
-1
View File
@@ -301,7 +301,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Jezik</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Jezik sporočil strežnika, kadar odjemalec ne zahteva nobenega</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Omejitve in hramba</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Nastavljeno s spremenljivko okolja {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Največja datoteka (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Največja sprejeta posamezna naložena datoteka</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Omrežje in TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Språk</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Språk för servermeddelanden när en klient inte begär något</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Gränser och lagringstid</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Anges av miljövariabeln {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Största fil (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Största enskilda uppladdning som accepteras</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Nätverk och TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>ภาษา</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>ภาษาของข้อความจากเซิร์ฟเวอร์เมื่อไคลเอนต์ไม่ได้ระบุภาษา</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>ขีดจำกัดและการเก็บรักษา</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>กำหนดโดยตัวแปรสภาพแวดล้อม {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>ไฟล์สูงสุด (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>ขนาดสูงสุดของการอัปโหลดไฟล์เดียวที่ยอมรับ</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>เครือข่ายและ TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Dil</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>İstemci bir dil istemediğinde sunucu iletilerinin dili</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Sınırlar ve saklama</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>{0} ortam değişkeniyle ayarlanır</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>En büyük dosya (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Kabul edilen en büyük tekil yükleme</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Ağ ve TLS</value></data>
-1
View File
@@ -314,7 +314,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Мова</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Мова повідомлень сервера, якщо клієнт не вказав жодної</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Обмеження та зберігання</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Задано змінною середовища {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Макс. файл (МБ)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Найбільший розмір одного вивантаженого файлу, який приймає сервер</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Мережа та TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>Ngôn ngữ</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>Ngôn ngữ của thông báo máy chủ khi máy khách không yêu cầu ngôn ngữ nào</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>Giới hạn và lưu giữ</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>Được đặt bởi biến môi trường {0}</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>Tệp tối đa (MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>Kích thước lớn nhất được chấp nhận cho một tệp tải lên</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>Mạng và TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>语言</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>客户端未指定语言时服务器消息使用的语言</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>限制与保留</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>由环境变量 {0} 设置</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>单文件上限(MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>可接受的单个上传文件的最大大小</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>网络和 TLS</value></data>
-1
View File
@@ -288,7 +288,6 @@
<data name="Admin.Settings.Language" xml:space="preserve"><value>語言</value></data>
<data name="Admin.Settings.Language.Tip" xml:space="preserve"><value>用戶端未指定語言時,伺服器訊息所使用的語言</value></data>
<data name="Admin.Settings.Limits" xml:space="preserve"><value>限制與保留</value></data>
<data name="Admin.Settings.Locked.Tip" xml:space="preserve"><value>由環境變數 {0} 設定</value></data>
<data name="Admin.Settings.MaxUploadMb" xml:space="preserve"><value>檔案上限(MB)</value></data>
<data name="Admin.Settings.MaxUploadMb.Tip" xml:space="preserve"><value>可接受的單一上傳檔案大小上限</value></data>
<data name="Admin.Settings.Network" xml:space="preserve"><value>網路與 TLS</value></data>
+3 -1
View File
@@ -41,7 +41,9 @@ public partial class App : Application
var capture = captureIndex >= 0;
// Capture never reads or writes the user's data folder.
Environment = capture ? AppEnvironment.ForCapture() : AppEnvironment.Detect();
_log = new FileLogSink(Environment.LogDirectory, "chronos");
// Settings › Advanced › Logs from the first line, which prunes the folder: also a launch that only hands over. The
// settings are read again once this launch owns the data folder, since a Chronos that was closing saves them on exit.
_log = AppLogging.Open(Environment.LogDirectory, capture ? new AppSettings() : AppSettings.Load(Environment.SettingsPath));
// Capture runs in CI: mirror the log to stderr so failures are visible in the job output.
Log.SetSink(capture ? new TeeLogSink(_log, new StderrLogSink()) : _log);
Log.Info("app", $"Chronos {AppServices.VersionText} starting; data at {Environment.DataDirectory}");
+25 -8
View File
@@ -5,7 +5,8 @@ namespace Chronos.App.Infrastructure;
/// <summary>
/// Settings › Advanced › Logs applied to this PC's log files (owner review 2, R11): the level, retention, size limits and
/// rotation of the <see cref="FileLogSink"/> App starts with, and the engine's <see cref="Log.MinimumLevel"/> (the files
/// are the only output outside screenshots). Values outside the ranges Settings offers are brought within them.
/// are the only output outside screenshots). Values outside the ranges Settings offers are brought within them, and a
/// total below one file is raised to that file (<see cref="LogFileOptions.TotalBelowFile"/>), which the server refuses.
/// </summary>
public static class AppLogging
{
@@ -16,18 +17,34 @@ public static class AppLogging
public const int MaxTotalMb = 1024 * 1024;
public const int MaxDiagnosticsLogMb = 1024;
public static LogFileOptions Options(AppSettings settings) => new()
public static LogFileOptions Options(AppSettings settings)
{
Level = Enum.IsDefined(settings.LogLevel) ? settings.LogLevel : LogLevel.Info,
RetentionDays = int.Clamp(settings.LogRetentionDays, 1, MaxRetentionDays),
MaxFileMb = int.Clamp(settings.LogMaxFileMb, 0, MaxFileMb),
MaxTotalMb = int.Clamp(settings.LogMaxTotalMb, 0, MaxTotalMb),
Rotation = Enum.IsDefined(settings.LogRotation) ? settings.LogRotation : LogRotation.Daily,
};
var file = int.Clamp(settings.LogMaxFileMb, 0, MaxFileMb);
var total = int.Clamp(settings.LogMaxTotalMb, 0, MaxTotalMb);
return new()
{
Level = Enum.IsDefined(settings.LogLevel) ? settings.LogLevel : LogLevel.Info,
RetentionDays = int.Clamp(settings.LogRetentionDays, 1, MaxRetentionDays),
MaxFileMb = file,
MaxTotalMb = LogFileOptions.TotalBelowFile(file, total) ? file : total,
Rotation = Enum.IsDefined(settings.LogRotation) ? settings.LogRotation : LogRotation.Daily,
};
}
/// <summary>Bytes the diagnostics bundle keeps from the end of each log file.</summary>
public static long DiagnosticsTailBytes(AppSettings settings) => int.Clamp(settings.DiagnosticsLogMb, 1, MaxDiagnosticsLogMb) * LogFileOptions.BytesPerMb;
/// <summary>
/// The log files App starts with, in <paramref name="directory"/>, with <paramref name="settings"/> from the first line:
/// that line opens a file and prunes, so the defaults would delete what the user keeps longer.
/// </summary>
public static FileLogSink Open(string directory, AppSettings settings)
{
var options = Options(settings);
Log.MinimumLevel = options.Level;
return new FileLogSink(directory, "chronos", options);
}
/// <summary>The settings to <paramref name="sink"/> and the engine, from the next line on.</summary>
public static void Apply(FileLogSink sink, AppSettings settings)
{
+61 -17
View File
@@ -8,8 +8,10 @@ namespace Chronos.App.Settings;
/// <summary>
/// The log rows of Settings › Advanced (owner review 2, R11): level, retention, file size, total size and rotation of this
/// PC's log files, and how much of each the diagnostics bundle keeps. Each choice is stored and saved at once, and saving
/// applies it to the files (<see cref="AppLogging"/>). A value set elsewhere (an imported settings file) is listed with
/// the presets, never shown as another one.
/// applies it to the files (<see cref="AppLogging"/>). The rows show the values the files get: one set elsewhere (an
/// imported or hand-edited settings file) is brought within range as <see cref="AppLogging.Options"/> does, then listed
/// with the presets. File sizes above the total and totals below the file size are not offered
/// (<see cref="LogFileOptions.TotalBelowFile"/>).
/// </summary>
public sealed class LogSettingsRows(AppSettings settings, Action save) : ObservableObject
{
@@ -28,28 +30,49 @@ public sealed class LogSettingsRows(AppSettings settings, Action save) : Observa
}
public IReadOnlyList<SettingsOption<int>> RetentionChoices =>
[.. With(RetentionPresets, settings.LogRetentionDays).Select(n => new SettingsOption<int>(n, Loc.Plural("Settings.Advanced.Days", n)))];
[.. With(RetentionPresets, Applied.RetentionDays).Select(n => new SettingsOption<int>(n, Loc.Plural("Settings.Advanced.Days", n)))];
public SettingsOption<int> SelectedRetention
{
get => RetentionChoices.First(c => c.Value == settings.LogRetentionDays);
get => Selected(RetentionChoices, Applied.RetentionDays);
set => Store(value, settings.LogRetentionDays, v => settings.LogRetentionDays = v);
}
public IReadOnlyList<SettingsOption<int>> FileSizeChoices => Sizes(FileSizePresets, settings.LogMaxFileMb);
public IReadOnlyList<SettingsOption<int>> FileSizeChoices
{
get
{
var applied = Applied;
return Sizes(FileSizePresets, applied.MaxFileMb, n => !LogFileOptions.TotalBelowFile(n, applied.MaxTotalMb));
}
}
public SettingsOption<int> SelectedFileSize
{
get => FileSizeChoices.First(c => c.Value == settings.LogMaxFileMb);
set => Store(value, settings.LogMaxFileMb, v => settings.LogMaxFileMb = v);
get => Selected(FileSizeChoices, Applied.MaxFileMb);
set
{
// The totals offered depend on the file size.
if (Store(value, settings.LogMaxFileMb, v => settings.LogMaxFileMb = v)) Changed(nameof(TotalSizeChoices), nameof(SelectedTotalSize));
}
}
public IReadOnlyList<SettingsOption<int>> TotalSizeChoices => Sizes(TotalSizePresets, settings.LogMaxTotalMb);
public IReadOnlyList<SettingsOption<int>> TotalSizeChoices
{
get
{
var applied = Applied;
return Sizes(TotalSizePresets, applied.MaxTotalMb, n => !LogFileOptions.TotalBelowFile(applied.MaxFileMb, n));
}
}
public SettingsOption<int> SelectedTotalSize
{
get => TotalSizeChoices.First(c => c.Value == settings.LogMaxTotalMb);
set => Store(value, settings.LogMaxTotalMb, v => settings.LogMaxTotalMb = v);
get => Selected(TotalSizeChoices, Applied.MaxTotalMb);
set
{
if (Store(value, settings.LogMaxTotalMb, v => settings.LogMaxTotalMb = v)) Changed(nameof(FileSizeChoices), nameof(SelectedFileSize));
}
}
public IReadOnlyList<SettingsOption<LogRotation>> Rotations =>
@@ -62,11 +85,11 @@ public sealed class LogSettingsRows(AppSettings settings, Action save) : Observa
}
public IReadOnlyList<SettingsOption<int>> DiagnosticsChoices =>
[.. With(DiagnosticsPresets, settings.DiagnosticsLogMb).Select(n => new SettingsOption<int>(n, Megabytes(n)))];
[.. With(DiagnosticsPresets, AppliedDiagnosticsMb).Select(n => new SettingsOption<int>(n, Megabytes(n)))];
public SettingsOption<int> SelectedDiagnostics
{
get => DiagnosticsChoices.First(c => c.Value == settings.DiagnosticsLogMb);
get => Selected(DiagnosticsChoices, AppliedDiagnosticsMb);
set => Store(value, settings.DiagnosticsLogMb, v => settings.DiagnosticsLogMb = v);
}
@@ -86,18 +109,39 @@ public sealed class LogSettingsRows(AppSettings settings, Action save) : Observa
/// <summary>Labels in the current language, values as the settings have them now.</summary>
internal void Refresh() => OnAllPropertiesChanged();
private void Store<T>(SettingsOption<T>? choice, T current, Action<T> set, [System.Runtime.CompilerServices.CallerMemberName] string? property = null)
/// <summary>The values the log files get from the settings now.</summary>
private LogFileOptions Applied => AppLogging.Options(settings);
private int AppliedDiagnosticsMb => (int)(AppLogging.DiagnosticsTailBytes(settings) / LogFileOptions.BytesPerMb);
/// <summary>
/// Stores a choice that differs from the stored value (<paramref name="current"/>, which may lie out of range: choosing
/// the value shown then saves it as applied) and saves; false when there was nothing to store.
/// </summary>
private bool Store<T>(SettingsOption<T>? choice, T current, Action<T> set, [System.Runtime.CompilerServices.CallerMemberName] string? property = null)
{
if (choice is null || EqualityComparer<T>.Default.Equals(choice.Value, current)) return;
if (choice is null || EqualityComparer<T>.Default.Equals(choice.Value, current)) return false;
set(choice.Value);
save();
OnPropertyChanged(property);
return true;
}
/// <summary>The presets in order, then "No limit" (0); <paramref name="current"/> joins them when it is another size.</summary>
private static IReadOnlyList<SettingsOption<int>> Sizes(int[] presets, int current) =>
private void Changed(string choices, string selected)
{
OnPropertyChanged(choices);
OnPropertyChanged(selected);
}
private static SettingsOption<int> Selected(IReadOnlyList<SettingsOption<int>> choices, int value) => choices.FirstOrDefault(c => c.Value == value) ?? choices[0];
/// <summary>
/// The presets <paramref name="offered"/> in order, then "No limit" (0); <paramref name="current"/> joins them when it
/// is another size.
/// </summary>
private static IReadOnlyList<SettingsOption<int>> Sizes(int[] presets, int current, Func<int, bool> offered) =>
[
.. With(presets, current).Where(n => n > 0).Select(n => new SettingsOption<int>(n, Megabytes(n))),
.. With(presets.Where(offered).ToArray(), current).Where(n => n > 0).Select(n => new SettingsOption<int>(n, Megabytes(n))),
new(0, Loc.L("Settings.Advanced.NoLimit")),
];
@@ -39,6 +39,12 @@ public sealed record LogFileOptions
public int MaxTotalMb { get; init; } = DefaultMaxTotalMb;
public LogRotation Rotation { get; init; } = LogRotation.Daily;
/// <summary>
/// Whether a total of <paramref name="maxTotalMb"/> is below one file of <paramref name="maxFileMb"/>: each finished file
/// would be deleted as soon as the next one opens. The server refuses such settings; the desktop raises the total.
/// </summary>
public static bool TotalBelowFile(int maxFileMb, int maxTotalMb) => maxTotalMb > 0 && maxFileMb > maxTotalMb;
}
/// <summary>
+3 -1
View File
@@ -2,7 +2,8 @@ namespace Chronos.Protocol;
/// <summary>
/// <c>GET/PUT /api/v1/server/settings</c> (admin): the editable part of the server configuration. Settings named in
/// <see cref="Locked"/> come from environment variables and cannot be changed here; <see cref="RestartRequired"/> says
/// <see cref="Locked"/> come from environment variables and cannot be changed here; <see cref="LockedBy"/> names the
/// variable that fixes each of them (ignored when saving); <see cref="RestartRequired"/> says
/// that saved values (ports, TLS, chunk size) wait for a restart; <see cref="JobHistoryDays"/> is what the housekeeping
/// schedule is reset to (owner review 2, R10). <see cref="ProxyWarning"/> is set in responses when TLS mode is proxy and
/// the request did not come through a trusted proxy over HTTPS (ignored when saving).
@@ -29,6 +30,7 @@ public sealed record ServerSettingsDto(
int UploadRetentionHours,
LogSettingsDto Logs,
IReadOnlyList<string> Locked,
IReadOnlyDictionary<string, string> LockedBy,
bool RestartRequired,
bool ProxyWarning);
+6 -13
View File
@@ -9,16 +9,6 @@ import { t, applyStrings, languages } from "../i18n.js";
import { escapeHtml, attr, toast, errorText, nativeName, fingerprint, formatDuration, markInvalid, clearInvalid, invalidText, escapeReverts, routeParams, PROXY_WARNING } from "../ui.js";
import { kindLabel } from "../jobs.js";
/** Setting → environment variable that can fix it (BRIEF §14.9). */
const VARIABLES = {
serverName: "CHRONOS_SERVER_NAME", httpPort: "CHRONOS_HTTP_PORT", httpsPort: "CHRONOS_HTTPS_PORT", tlsMode: "CHRONOS_TLS_MODE",
tlsCert: "CHRONOS_TLS_CERT", tlsKey: "CHRONOS_TLS_KEY", language: "CHRONOS_LANG", parallelism: "CHRONOS_PARALLELISM", discovery: "CHRONOS_DISCOVERY",
priorityQueue: "CHRONOS_PRIORITY_QUEUE", logLevel: "CHRONOS_LOG_LEVEL", logRetentionDays: "CHRONOS_LOG_RETENTION_DAYS",
logMaxFileMb: "CHRONOS_LOG_MAX_FILE_MB", logMaxTotalMb: "CHRONOS_LOG_MAX_TOTAL_MB", logRotation: "CHRONOS_LOG_ROTATION",
auditRetentionDays: "CHRONOS_AUDIT_RETENTION_DAYS", diagnosticsLogMb: "CHRONOS_DIAGNOSTICS_LOG_MB",
// CHRONOS_LOG_LEVEL sets the console's level too, unless CHRONOS_LOG_CONSOLE_LEVEL sets its own.
consoleLogLevel: ["CHRONOS_LOG_CONSOLE_LEVEL", "CHRONOS_LOG_LEVEL"],
};
/** Levels of the priority queue, highest first. */
const LEVELS = ["high", "normal", "low"];
/** Log levels, least severe first (the server's wire names). */
@@ -47,9 +37,12 @@ export async function render(root, { api, info, setMeta, actions }) {
actions.innerHTML = `<button class="btn primary" type="submit" form="settings-form" data-i18n="Admin.Common.Save" data-i18n-title="Admin.Common.Save.Tip"></button>`;
applyStrings(actions);
const locked = (name) => settings.locked.some((l) => l.toLowerCase() === name.toLowerCase());
const lockedTip = (variable) => Array.isArray(variable) ? t("Admin.Settings.LockedEither.Tip", variable[0], variable[1]) : t("Admin.Settings.Locked.Tip", variable);
const lock = (name) => locked(name) ? `disabled title="${attr(lockedTip(VARIABLES[name] ?? name))}"` : `data-i18n-title="Admin.Settings.${cap(name)}.Tip"`;
const same = (a, b) => a.toLowerCase() === b.toLowerCase();
const locked = (name) => settings.locked.some((l) => same(l, name));
// The server names the variable that fixes each locked setting: CHRONOS_LOG_LEVEL fixes the console's level too, unless
// CHRONOS_LOG_CONSOLE_LEVEL sets its own (BRIEF §14.9).
const variable = (name) => Object.entries(settings.lockedBy ?? {}).find(([setting]) => same(setting, name))?.[1] ?? name;
const lock = (name) => locked(name) ? `disabled title="${attr(t("Admin.Settings.Locked.Tip", variable(name)))}"` : `data-i18n-title="Admin.Settings.${cap(name)}.Tip"`;
const field = (name, input) => `<label class="field"><span data-i18n="Admin.Settings.${cap(name)}"></span>${input}</label>`;
const number = (name, value, attrs = "") => field(name, `<input class="input narrow num" type="number" name="${name}" value="${attr(value)}" ${attrs} ${lock(name)}>`);
const text = (name, value, attrs = "dir=\"auto\"") => field(name, `<input class="input" name="${name}" value="${attr(value ?? "")}" ${attrs} ${lock(name)}>`);
@@ -88,6 +88,9 @@ public sealed class ServerOptions
/// </summary>
public const string DefaultTrustedProxies = "127.0.0.0/8, ::1/128";
/// <summary>The environment variable that sets <paramref name="setting"/> (of two, the one that wins), or null.</summary>
public static string? VariableOf(string setting) => Variables.LastOrDefault(v => v.Setting == setting).Variable;
/// <summary>The environment variables the server reads (<c>--help</c> lists them all).</summary>
public static IEnumerable<string> EnvironmentVariables => Variables.Select(v => v.Variable).Distinct(StringComparer.Ordinal).Prepend("CHRONOS_DATA_PATH");
@@ -248,6 +251,13 @@ public sealed class ServerOptions
[JsonIgnore]
public IReadOnlyCollection<string> Locked { get; internal set; } = [];
/// <summary>
/// The environment variable that fixes each setting of <see cref="Locked"/>, which the admin panel names: of two that
/// set one (<c>CHRONOS_LOG_LEVEL</c> and <c>CHRONOS_LOG_CONSOLE_LEVEL</c>), the one that wins.
/// </summary>
[JsonIgnore]
public IReadOnlyDictionary<string, string> LockedBy { get; internal set; } = new Dictionary<string, string>(StringComparer.Ordinal);
[JsonIgnore]
public string LogPath => Path.Combine(DataPath, "logs");
@@ -292,6 +302,7 @@ public sealed class ServerOptions
options.DataPath = dataPath;
var locked = new List<string>();
var lockedBy = new Dictionary<string, string>(StringComparer.Ordinal);
foreach (var (variable, setting, apply) in Variables)
{
if (Env(variable) is not { } value) continue;
@@ -304,8 +315,11 @@ public sealed class ServerOptions
throw new InvalidOperationException($"{variable} has an invalid value.", ex);
}
locked.Add(setting);
// Listed in the order they apply: a later variable wins.
lockedBy[setting] = variable;
}
options.Locked = [.. locked.Distinct(StringComparer.Ordinal)];
options.LockedBy = lockedBy;
// The admin panel saves only values it accepts: one it cannot change (an environment variable) must be one of them.
options.Parallelism = Math.Clamp(options.Parallelism, 1, MaxParallelism);
options.Validate();
@@ -89,6 +89,7 @@ public sealed class ServerSettingsStore(ServerOptions options, ServerLogging log
JobPriorities = Priorities(PriorityQueue(options)),
Logs = Logs(options),
Locked = [.. options.Locked],
LockedBy = LockedBy(options),
RestartRequired = restart,
ProxyWarning = false,
};
@@ -99,7 +100,11 @@ public sealed class ServerSettingsStore(ServerOptions options, ServerLogging log
private static ServerSettingsDto Snapshot(ServerOptions o, bool restartRequired) => new(
o.ServerName, o.HttpPort, o.HttpsPort, o.TlsMode.ToString().ToLowerInvariant(), o.TlsCert, o.TlsKey, o.Language, o.Parallelism, o.PriorityQueue,
Priorities(PriorityQueue(o)), o.Discovery, o.MaxUploadBytes, o.ChunkSizeBytes, o.JobHistoryDays, o.TokenLifetimeDays, o.UploadRetentionHours,
Logs(o), [.. o.Locked], restartRequired, ProxyWarning: false);
Logs(o), [.. o.Locked], LockedBy(o), restartRequired, ProxyWarning: false);
/// <summary>The variable that fixes every locked setting (for one a test locks directly, the variable that would).</summary>
private static Dictionary<string, string> LockedBy(ServerOptions o) => o.Locked.Distinct(StringComparer.Ordinal).ToDictionary(s => s,
s => o.LockedBy.TryGetValue(s, out var variable) ? variable : ServerOptions.VariableOf(s) ?? s, StringComparer.Ordinal);
private static LogSettingsDto Logs(ServerOptions o) => new(ServerLogging.Wire(o.LogLevel), ServerLogging.Wire(o.ConsoleLogLevel), o.LogRetentionDays,
o.LogMaxFileMb, o.LogMaxTotalMb, ServerLogging.Wire(o.LogRotation), o.AuditRetentionDays, o.DiagnosticsLogMb);
+1 -2
View File
@@ -149,8 +149,7 @@ public sealed class ServerLogging
{
if (retentionDays is < 1 or > MaxRetentionDays) return nameof(ServerOptions.LogRetentionDays);
if (maxFileMb is < 0 or > MaxFileMb) return nameof(ServerOptions.LogMaxFileMb);
// A total below one file would delete every finished file at once.
if (maxTotalMb is < 0 or > MaxTotalMb || (maxTotalMb > 0 && maxFileMb > maxTotalMb)) return nameof(ServerOptions.LogMaxTotalMb);
if (maxTotalMb is < 0 or > MaxTotalMb || LogFileOptions.TotalBelowFile(maxFileMb, maxTotalMb)) return nameof(ServerOptions.LogMaxTotalMb);
if (auditRetentionDays is < 0 or > MaxAuditRetentionDays) return nameof(ServerOptions.AuditRetentionDays);
if (diagnosticsLogMb is < 1 or > MaxDiagnosticsLogMb) return nameof(ServerOptions.DiagnosticsLogMb);
return null;
@@ -1,4 +1,5 @@
using System.Globalization;
using System.IO;
using Chronos.App.Infrastructure;
using Chronos.App.Settings;
using Chronos.Core.Diagnostics;
@@ -58,6 +59,18 @@ public sealed class LogSettingsTests
var odd = new AppSettings { LogLevel = (LogLevel)42, LogRetentionDays = 0, LogMaxFileMb = -3, LogMaxTotalMb = -1, LogRotation = (LogRotation)7, DiagnosticsLogMb = 0 };
Assert.Equal(new LogFileOptions { RetentionDays = 1, MaxFileMb = 0, MaxTotalMb = 0 }, AppLogging.Options(odd));
Assert.Equal(1L << 20, AppLogging.DiagnosticsTailBytes(odd));
var huge = new AppSettings { LogRetentionDays = 99_999, LogMaxFileMb = 99_999, LogMaxTotalMb = int.MaxValue, DiagnosticsLogMb = 5000 };
Assert.Equal(new LogFileOptions { RetentionDays = 3650, MaxFileMb = 10_240, MaxTotalMb = 1_048_576 }, AppLogging.Options(huge));
Assert.Equal(1024L << 20, AppLogging.DiagnosticsTailBytes(huge));
// A total below one file would delete each finished file as the next one opens: it is raised to the file (the
// server refuses it). Without a file limit any total holds.
Assert.True(LogFileOptions.TotalBelowFile(500, 256));
Assert.False(LogFileOptions.TotalBelowFile(256, 256) || LogFileOptions.TotalBelowFile(500, 0) || LogFileOptions.TotalBelowFile(0, 256));
var below = AppLogging.Options(new AppSettings { LogMaxFileMb = 500, LogMaxTotalMb = 256 });
Assert.Equal((500, 500), (below.MaxFileMb, below.MaxTotalMb));
var free = AppLogging.Options(new AppSettings { LogMaxFileMb = 0, LogMaxTotalMb = 256 });
Assert.Equal((0, 256), (free.MaxFileMb, free.MaxTotalMb));
var level = Log.MinimumLevel;
using var sink = new FileLogSink(_context.CreateTempDirectory(), "chronos");
@@ -73,6 +86,33 @@ public sealed class LogSettingsTests
}
}
[Test]
public void TheLogFilesStartWithTheSettings()
{
// App opens its files with the settings: the first line opens a file and prunes, at every start and at every launch
// that only hands over to the running Chronos, so the defaults would delete what the user keeps longer.
var level = Log.MinimumLevel;
try
{
foreach (var (settings, kept) in new[] { (new AppSettings { LogLevel = LogLevel.Debug, LogRetentionDays = 365, LogMaxTotalMb = 0 }, true), (new AppSettings(), false) })
{
var dir = _context.CreateTempDirectory();
var old = Path.Combine(dir, $"chronos-{DateTime.UtcNow.AddDays(-30):yyyyMMdd}.log");
File.WriteAllText(old, "a month ago");
File.SetLastWriteTimeUtc(old, DateTime.UtcNow.AddDays(-30));
using var sink = AppLogging.Open(dir, settings);
Assert.Equal((AppLogging.Options(settings), settings.LogLevel), (sink.Options, Log.MinimumLevel));
sink.Write(LogLevel.Info, "app", "Chronos starting", null);
Assert.Equal(kept, File.Exists(old), $"retention {settings.LogRetentionDays} days");
Assert.FileExists(sink.CurrentPath);
}
}
finally
{
Log.MinimumLevel = level;
}
}
[Test]
public void EachRowStoresAndSavesItsChoice()
{
@@ -100,7 +140,9 @@ public sealed class LogSettingsTests
Assert.Equal((LogLevel.Debug, 90, 0, 5120, LogRotation.Hourly, 16),
(settings.LogLevel, settings.LogRetentionDays, settings.LogMaxFileMb, settings.LogMaxTotalMb, settings.LogRotation, settings.DiagnosticsLogMb));
Assert.Equal(6, saves);
Assert.SequenceEqual(["SelectedLevel", "SelectedRetention", "SelectedFileSize", "SelectedTotalSize", "SelectedRotation", "SelectedDiagnostics"], changed);
// A size changes the choices of the other.
Assert.SequenceEqual(["SelectedLevel", "SelectedRetention", "SelectedFileSize", "TotalSizeChoices", "SelectedTotalSize", "SelectedTotalSize",
"FileSizeChoices", "SelectedFileSize", "SelectedRotation", "SelectedDiagnostics"], changed);
// The same choice again, or none (a list being rebuilt), changes nothing.
rows.SelectedLevel = rows.Levels.Single(l => l.Value == LogLevel.Debug);
@@ -122,4 +164,58 @@ public sealed class LogSettingsTests
Assert.Equal(string.Empty, changed.Single());
Assert.Equal(6, saves);
}
[Test]
public void TheSizeRowsNeverOfferATotalBelowOneFile()
{
var settings = new AppSettings { LogMaxFileMb = 500 };
var saves = 0;
var rows = new LogSettingsRows(settings, () => saves++);
Assert.SequenceEqual([512, 1024, 2048, 5120, 10240, 0], rows.TotalSizeChoices.Select(c => c.Value));
Assert.SequenceEqual([10, 20, 50, 100, 200, 500, 0], rows.FileSizeChoices.Select(c => c.Value));
rows.SelectedTotalSize = rows.TotalSizeChoices.Single(c => c.Value == 512);
rows.SelectedFileSize = rows.FileSizeChoices.Single(c => c.Value == 100);
rows.SelectedTotalSize = rows.TotalSizeChoices.Single(c => c.Value == 256);
Assert.Equal((100, 256, 3), (settings.LogMaxFileMb, settings.LogMaxTotalMb, saves));
Assert.SequenceEqual([10, 20, 50, 100, 200, 0], rows.FileSizeChoices.Select(c => c.Value));
// Without a file limit every total is offered, and without a total every file size.
rows.SelectedFileSize = rows.FileSizeChoices[^1];
Assert.SequenceEqual([256, 512, 1024, 2048, 5120, 10240, 0], rows.TotalSizeChoices.Select(c => c.Value));
rows.SelectedTotalSize = rows.TotalSizeChoices[^1];
Assert.SequenceEqual([10, 20, 50, 100, 200, 500, 0], rows.FileSizeChoices.Select(c => c.Value));
// An imported file with a total below its file size shows the total the files get.
settings.LogMaxFileMb = 500;
settings.LogMaxTotalMb = 256;
Assert.Equal(("500 MB", "500 MB"), (rows.SelectedFileSize.Label, rows.SelectedTotalSize.Label));
Assert.SequenceEqual([500, 512, 1024, 2048, 5120, 10240, 0], rows.TotalSizeChoices.Select(c => c.Value));
}
[Test]
public void OutOfRangeValuesShowWhatTheFilesGet()
{
// A hand-edited or imported settings file: every row shows the value applied, and none fails to find its choice.
var settings = new AppSettings { LogLevel = (LogLevel)42, LogRetentionDays = 0, LogMaxFileMb = -3, LogMaxTotalMb = -1, LogRotation = (LogRotation)7, DiagnosticsLogMb = 0 };
var saves = 0;
var rows = new LogSettingsRows(settings, () => saves++);
Assert.Equal(("Information", "1 day", "No limit", "No limit", "Daily", "1 MB"), (rows.SelectedLevel.Label, rows.SelectedRetention.Label,
rows.SelectedFileSize.Label, rows.SelectedTotalSize.Label, rows.SelectedRotation.Label, rows.SelectedDiagnostics.Label));
Assert.SequenceEqual(LogSettingsRows.RetentionPresets, rows.RetentionChoices.Select(c => c.Value));
Assert.SequenceEqual([.. LogSettingsRows.FileSizePresets, 0], rows.FileSizeChoices.Select(c => c.Value));
Assert.SequenceEqual(LogSettingsRows.DiagnosticsPresets, rows.DiagnosticsChoices.Select(c => c.Value));
// Choosing the value shown saves it as applied.
var (shownFile, shownRetention) = (rows.SelectedFileSize, rows.SelectedRetention);
rows.SelectedFileSize = shownFile;
rows.SelectedRetention = shownRetention;
Assert.Equal((0, 1, 2), (settings.LogMaxFileMb, settings.LogRetentionDays, saves));
settings.LogRetentionDays = 99_999;
settings.LogMaxFileMb = 99_999;
settings.LogMaxTotalMb = int.MaxValue;
settings.DiagnosticsLogMb = 5000;
Assert.Equal(("3650 days", "10,240 MB", "1,048,576 MB", "1,024 MB"),
(rows.SelectedRetention.Label, rows.SelectedFileSize.Label, rows.SelectedTotalSize.Label, rows.SelectedDiagnostics.Label));
}
}
@@ -142,9 +142,12 @@ public sealed class FileLogSinkTests(TestContext context)
var sink = new FileLogSink(dir, "setup", 7);
Assert.Equal(new LogFileOptions { RetentionDays = 7 }, sink.Options);
Assert.Equal((LogLevel.Info, 50, 1024, LogRotation.Daily), (sink.Options.Level, sink.Options.MaxFileMb, sink.Options.MaxTotalMb, sink.Options.Rotation));
var before = DateTime.UtcNow;
sink.Write(LogLevel.Warning, "setup", "written", null);
var expected = Path.Combine(dir, $"setup-{DateTime.UtcNow:yyyyMMdd}.log");
Assert.Equal(expected, sink.CurrentPath);
var after = DateTime.UtcNow;
// The system clock: a write across midnight UTC names either day.
var expected = sink.CurrentPath;
Assert.Contains(expected, new[] { before, after }.Select(day => Path.Combine(dir, $"setup-{day:yyyyMMdd}.log")));
sink.Dispose();
// Engine code may log after the host closed its sink: the line is dropped.
sink.Write(LogLevel.Error, "setup", "after", null);
@@ -147,19 +147,28 @@ public sealed partial class LoggingTests(TestContext context)
[Test]
public async Task LevelsSetByTheEnvironmentAreLocked()
{
await using var server = await TestServer.StartAsync(context, o => o.Locked = [nameof(ServerOptions.LogLevel), nameof(ServerOptions.ConsoleLogLevel)]);
// An install upgraded with the earlier compose file or Unraid template: CHRONOS_LOG_LEVEL fixes both levels.
await using var server = await TestServer.StartAsync(context, o =>
{
o.Locked = [nameof(ServerOptions.LogLevel), nameof(ServerOptions.ConsoleLogLevel), nameof(ServerOptions.LogRotation)];
o.LockedBy = new Dictionary<string, string> { [nameof(ServerOptions.LogLevel)] = "CHRONOS_LOG_LEVEL", [nameof(ServerOptions.ConsoleLogLevel)] = "CHRONOS_LOG_LEVEL" };
});
var admin = await server.AdminAsync();
var settings = await SettingsAsync(admin);
Assert.Contains("ConsoleLogLevel", settings.Locked);
// The panel's tooltip names the variable that fixes each; one locked without it is named by the variable that would.
string[] lockedBy = ["ConsoleLogLevel=CHRONOS_LOG_LEVEL", "LogLevel=CHRONOS_LOG_LEVEL", "LogRotation=CHRONOS_LOG_ROTATION"];
Assert.SequenceEqual(lockedBy, settings.LockedBy.Select(l => $"{l.Key}={l.Value}").Order(StringComparer.Ordinal));
var edited = settings with { HttpPort = 18080, HttpsPort = 18443 };
using (var refused = await admin.PutAsJsonAsync("/api/v1/server/settings", edited with { Logs = edited.Logs with { ConsoleLevel = "debug" } },
ProtocolJson.Default.ServerSettingsDto))
Assert.Equal("ConsoleLogLevel", (await refused.ExpectErrorAsync(HttpStatusCode.Conflict, "setting_locked")).Details);
Assert.Equal(LogLevel.Warning, server.Options.ConsoleLogLevel);
// The settings no variable fixes still save.
using (var saved = await admin.PutAsJsonAsync("/api/v1/server/settings", edited with { Logs = edited.Logs with { RetentionDays = 7 } },
ProtocolJson.Default.ServerSettingsDto))
await saved.ExpectAsync(HttpStatusCode.OK);
// What a request says about the locks is ignored.
using (var saved = await admin.PutAsJsonAsync("/api/v1/server/settings",
edited with { Logs = edited.Logs with { RetentionDays = 7 }, LockedBy = new Dictionary<string, string>() }, ProtocolJson.Default.ServerSettingsDto))
Assert.SequenceEqual(lockedBy, (await saved.ReadAsync(ProtocolJson.Default.ServerSettingsDto)).LockedBy.Select(l => $"{l.Key}={l.Value}").Order(StringComparer.Ordinal));
Assert.Equal(7, server.Options.LogRetentionDays);
}
@@ -72,6 +72,8 @@ public sealed class StartupTests(TestContext context)
["CHRONOS_DISCOVERY"] = "false",
});
Assert.SequenceEqual(["Database", "HttpPort", "Discovery"], options.Locked);
// The admin panel names the variable that fixes each of them.
Assert.Equal(("CHRONOS_DB", "CHRONOS_HTTP_PORT", "CHRONOS_DISCOVERY"), (options.LockedBy["Database"], options.LockedBy["HttpPort"], options.LockedBy["Discovery"]));
Assert.Throws<InvalidOperationException>(() => ServerOptions.Load(new Dictionary<string, string?> { ["CHRONOS_DATA_PATH"] = root, ["CHRONOS_DB"] = "postgres", ["CHRONOS_WORKERS"] = "many" }));
}
@@ -86,6 +88,7 @@ public sealed class StartupTests(TestContext context)
var former = ServerOptions.Load(new Dictionary<string, string?> { ["CHRONOS_DATA_PATH"] = root, ["CHRONOS_DB"] = "postgres", ["CHRONOS_WORKERS"] = "5" });
Assert.Equal((5, true), (former.Parallelism, former.FormerWorkersVariable));
Assert.SequenceEqual(["Database", "Parallelism"], former.Locked);
Assert.Equal("CHRONOS_WORKERS", former.LockedBy["Parallelism"]);
var both = ServerOptions.Load(new Dictionary<string, string?>
{
["CHRONOS_DATA_PATH"] = root,
@@ -96,6 +99,7 @@ public sealed class StartupTests(TestContext context)
});
Assert.Equal((7, true), (both.Parallelism, both.PriorityQueue));
Assert.SequenceEqual(["Database", "Parallelism", "PriorityQueue"], both.Locked);
Assert.Equal("CHRONOS_PARALLELISM", both.LockedBy["Parallelism"]);
Assert.False(ServerOptions.Load(new Dictionary<string, string?> { ["CHRONOS_DATA_PATH"] = root, ["CHRONOS_DB"] = "postgres", ["CHRONOS_PARALLELISM"] = "2" })
.FormerWorkersVariable);
Assert.Throws<InvalidOperationException>(() => ServerOptions.Load(new Dictionary<string, string?> { ["CHRONOS_DATA_PATH"] = root, ["CHRONOS_DB"] = "postgres", ["CHRONOS_PRIORITY_QUEUE"] = "often" }));
@@ -174,6 +178,8 @@ public sealed class StartupTests(TestContext context)
var both = ServerOptions.Load(Env(("CHRONOS_LOG_LEVEL", "debug")));
Assert.Equal((Microsoft.Extensions.Logging.LogLevel.Debug, Microsoft.Extensions.Logging.LogLevel.Debug), (both.LogLevel, both.ConsoleLogLevel));
Assert.SequenceEqual(["Database", "LogLevel", "ConsoleLogLevel"], both.Locked);
// The earlier compose file and Unraid template set CHRONOS_LOG_LEVEL: the panel names it on both levels.
Assert.Equal(("CHRONOS_LOG_LEVEL", "CHRONOS_LOG_LEVEL"), (both.LockedBy["LogLevel"], both.LockedBy["ConsoleLogLevel"]));
var all = ServerOptions.Load(Env(("CHRONOS_LOG_LEVEL", "Trace"), ("CHRONOS_LOG_CONSOLE_LEVEL", "warn"), ("CHRONOS_LOG_RETENTION_DAYS", "30"),
("CHRONOS_LOG_MAX_FILE_MB", "0"), ("CHRONOS_LOG_MAX_TOTAL_MB", "2048"), ("CHRONOS_LOG_ROTATION", "Hourly"), ("CHRONOS_AUDIT_RETENTION_DAYS", "365"),
@@ -183,6 +189,7 @@ public sealed class StartupTests(TestContext context)
Assert.Equal((Chronos.Core.Diagnostics.LogRotation.Hourly, 365, 16), (all.LogRotation, all.AuditRetentionDays, all.DiagnosticsLogMb));
Assert.SequenceEqual(["Database", "LogLevel", "ConsoleLogLevel", "LogRetentionDays", "LogMaxFileMb", "LogMaxTotalMb", "LogRotation", "AuditRetentionDays",
"DiagnosticsLogMb"], all.Locked);
Assert.Equal(("CHRONOS_LOG_LEVEL", "CHRONOS_LOG_CONSOLE_LEVEL"), (all.LockedBy["LogLevel"], all.LockedBy["ConsoleLogLevel"]));
foreach (var invalid in new[]
{