Skip to content

Lot 17: a log that turns over each day, and a purge that leaves nothing - #18

Merged
geeooff merged 3 commits into
mainfrom
lot-17-log-rotation
Sep 26, 2026
Merged

geeooff merged 3 commits into
mainfrom
lot-17-log-rotation

Conversation

@geeooff

@geeooff geeooff commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Lot 17: the log turns over each day. Field-verified on the maintainer's machine, and closed.

  • A spike came first, on the maintainer's condition: a turnover that needed a restart would have ruled tracing out. It does not. tracing-appender checks at every write and opens the next file itself; its minutely rotation runs the daily one's code. One long writer and two short ones crossed two minute boundaries with every line whole. The spike also showed that every process prunes when it builds its appender, so max_log_files = log_days + 1. presence-probe log-turnover replays it with the program's own appender.
  • The log: one file a day, gamemode-executor.YYYY-MM-DD.log, written synchronously as before.
    • log_days (optional, 7 by default, a whole number of 1 or more) says how many files are kept.
    • The day turns at midnight UTC, the library offering no other; lines keep local time.
    • Open log opens the file written last. purge removes them all, and the old single file is pruned as the oldest.
  • Removed, because the library now does it:
    • the file opened by hand into a Mutex;
    • LOG_FILE_NAME and the one-file assumption in the tray, the service and purge;
    • the hand-made local timestamp, now tracing-subscriber's LocalTime, checked on Windows (its caveat is Unix's);
    • four copies of the log-folder rule.
  • purge leaves nothing behind:
    • The uninstall it starts runs stop and uninstall-task, which log what they did; their lines are now swept once msiexec has finished.
    • The updater's folder, updates, is now removed too; it is emptied but never deleted, and kept %LOCALAPPDATA%\GameModeExecutor alive.
    • The folder check no longer relies on Remove-Item failing: in a non-interactive shell it exits with 1 on a non-empty folder.
  • AGENTS.md: a third fewer words, every rule kept. Four rules join it that lived only in an agent's memory.

Seen in the field, 2026-09-25/26:

  • The real turnover happened in the running watcher, with no restart.
  • Open log on the file of the day.
  • A real purge of the installed copy, then the reinstall: init and install-task wrote into the day's file.
  • update --check wrote into the day's file.
  • Footprint unchanged: 161 handles and 1.99 MB just started, against 162 and 2.09 MB for 0.3.0. The executables grew by 90 KB.

Left to see:

  • the updater's zip path, at the next release;
  • the old file pruned, around 2026-10-01;
  • updates gone at the next real purge.

build.ps1 test OK locally, 220 tests.

🤖 Generated with Claude Code

geeooff and others added 3 commits September 26, 2026 15:59
The log was one file for ever. It is now one file a day,
gamemode-executor.YYYY-MM-DD.log, written through tracing-appender's
RollingFileAppender, synchronously as before, and the last log_days of
them are kept: a new key, optional, 7 when absent, a whole number of 1
or more. The day is UTC's, the library offering no other; the lines keep
local time.

A spike came first, the maintainer's condition: a turnover that needed a
restart would have ruled the library out. It does not. The appender
checks at every write and opens the next file itself, the minutely
rotation running the daily one's code; one long writer and two short
ones across two minute boundaries kept every line whole. It also showed
every process pruning when it builds its appender, one below its
maximum, so max_log_files is log_days + 1. presence-probe log-turnover
replays it with the program's own appender.

What the library now does is gone from our code: the file opened by hand
into a Mutex, LOG_FILE_NAME and the one-file assumption in the tray, the
service and purge, and the hand-made local timestamp, now
tracing-subscriber's LocalTime, whose local-offset caveat is Unix's.
Open log opens the file written last; purge removes every log file;
log_days, like log_dir, waits for the next start and says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
purge removes an installed copy through msiexec /x once it has exited,
and the package's uninstall runs stop and uninstall-task, which log what
they did -- to the default folder, the configuration being gone. So a log
file and its folders came back after every purge of an installed copy.
The shell purge leaves behind now waits for msiexec, then deletes the
log files there and the folders that leaves empty. The maintainer chose
this over a flag keeping those commands off the file, which would have
changed the package and two setup commands.

Testing it through the real shell showed purge relying on Remove-Item
without -Recurse to keep a folder that holds something: a non-interactive
shell turns the prompt into an error and exits with 1. Both uses now ask
whether the folder is empty first.

The maintainer's real purge on 2026-09-26 then left
%LOCALAPPDATA%\GameModeExecutor behind for another reason: the updater's
folder, which an update empties and never removes, and which purge did
not know. Nothing else writes there, so purge now takes it whole, its
path from update::updates_dir, the one place that names it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every rule kept, a third fewer words: the anecdotes behind them are in
the design record. Four rules that lived only in an agent's private
memory join it, since any agent working here should follow them: user
pages short with the detail in docs/design, words in their exact sense,
say who saw a verification, and the Remove-Item pitfall found in Lot 17.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@geeooff
geeooff merged commit 194d961 into main Sep 26, 2026
1 check passed
@geeooff
geeooff deleted the lot-17-log-rotation branch September 26, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant