fix(server): show the audit clean-up's real age limit and lock it before the first pass

Settings › Logs › Keep audit showed ServerOptions.AuditRetentionDays, a second
copy of the audit clean-up schedule's age limit. Edits made on Jobs › Scheduled
never reached it, so the panel could say "kept forever" while entries were
being deleted every night. Saving 0 there then changed nothing, because the
endpoint only compared against the stale option value.

- GET and PUT /server/settings now report the schedule's limit in force (0
  while the schedule is off). Saving compares against that value. A value sent
  back unchanged leaves the server.json reset default and the env lock alone. A
  new value sets the schedule and becomes the reset default.
- ApplyAgeAsync also turns the schedule on when it already holds the days but
  is off.
- CHRONOS_AUDIT_RETENTION_DAYS is now applied before the scheduler's first
  pass, through a new Scheduler.StartAsync overload with a beforeFirstPass hook.
  Before, a missed 04:30 run was caught up at start with the stale days, which
  could delete entries the variable says to keep. While the variable fixes a
  limit above 0, turning the schedule off is a 409 setting_locked.
- Corrected the comments in SchedulerHost, ServerOptions, ServerSettingsStore,
  LogSettingsDto, the header of settings.js and ARCHITECTURE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 490ed286e9f32745174b13b1963d6ec91955196b)
This commit is contained in:
Alby96 committed 2026-10-27 09:56:46 +01:00
1 parent ac121acf7c
commit 422f33d5f3
12 files changed
+232 -52

No files matched your search

+5 -4
View File
@@ -38,10 +38,11 @@ public sealed record ServerSettingsDto(
/// The log settings of <see cref="ServerSettingsDto"/> (owner review 2, R11): the least severe level of the files and of the
/// console (<c>trace</c>, <c>debug</c>, <c>information</c>, <c>warning</c>, <c>error</c>, <c>critical</c>, <c>none</c>), the
/// days log files are kept, the size at which a file continues in a numbered one and the size of all of them (MB of 2²⁰
/// bytes, 0 = no limit), the rotation (<c>daily</c> or <c>hourly</c>, UTC), the days audit entries are kept (0 = forever)
/// and the MB of the end of each log file in the diagnostics zip. Their locks use the server.json names (<c>LogLevel</c>,
/// <c>ConsoleLogLevel</c>, <c>LogRetentionDays</c>, <c>LogMaxFileMb</c>, <c>LogMaxTotalMb</c>, <c>LogRotation</c>,
/// <c>AuditRetentionDays</c>, <c>DiagnosticsLogMb</c>).
/// bytes, 0 = no limit), the rotation (<c>daily</c> or <c>hourly</c>, UTC), the days audit entries are kept (the audit
/// clean-up schedule's age limit; 0 = forever, as while that schedule is off) and the MB of the end of each log file in
/// the diagnostics zip. Their locks use the server.json names (<c>LogLevel</c>, <c>ConsoleLogLevel</c>,
/// <c>LogRetentionDays</c>, <c>LogMaxFileMb</c>, <c>LogMaxTotalMb</c>, <c>LogRotation</c>, <c>AuditRetentionDays</c>,
/// <c>DiagnosticsLogMb</c>).
/// </summary>
public sealed record LogSettingsDto(
string FileLevel,