Skip to content

fix: the pending banner now knows about the daily-restart schedule - #70

Merged
FMSMITH91 merged 1 commit into
mainfrom
fix/banner-knows-the-daily-restart
Aug 9, 2026
Merged

fix: the pending banner now knows about the daily-restart schedule#70
FMSMITH91 merged 1 commit into
mainfrom
fix/banner-knows-the-daily-restart

Conversation

@FMSMITH91

Copy link
Copy Markdown
Owner

Same shape as the Autostart switch — found by going looking for more of it rather than waiting for it to be reported.

Two mechanisms mean "restart once empty", and the page only knew about one:

how it works
the panel's restart_pending column, queued from the UI, acted on by _run_due_restarts()
the box's set_daily_restart() writes 0 5 * * * touch ~/.restart-pending plus an hourly line that restarts once gamedig sees 0 players

The panel writes that cron and then can't see it. So with Daily restart on and players connected at 05:00, a restart genuinely is queued — and the banner that exists to say exactly that stayed hidden until it fired.

Fix

The monitor sweep already talks to every host once a minute, so it now also runs one ls -1d /home/*/.restart-pending per host and maps the paths back to game users. The detail page shows the banner for either source, and names the schedule when it's the cron's.

Display only, deliberately. Nothing writes restart_pending from the flag: the two queues stay independent, so a server can't be restarted twice by both tickers racing, and the panel's own queue is never cleared by a box that happens not to have the file.

Both halves tested — because the first version wasn't

My banner check set the dict directly, so deleting the code that populates it still passed. Mutation caught that. There's now a monitor test that drives a real pass with the flag stubbed:

banner mutation  -> 1 check fails
monitor mutation -> 3 checks fail

unit 839 · smoke 300 → 307 · rbac 65 · manage 21 · template_actions 7 · lint clean.

🤖 Generated with Claude Code

Same shape as the Autostart switch, found by looking for more of it rather
than waiting for it to be reported: two mechanisms mean "restart once empty",
and the page only knew about one.

  the panel's   restart_pending column, queued from the UI, acted on by
                _run_due_restarts()
  the box's     set_daily_restart() writes `0 5 * * * touch ~/.restart-pending`
                plus an hourly line that restarts once gamedig sees 0 players

The panel WRITES that cron and then cannot see it. So with Daily restart on
and players connected at 05:00, a restart really is queued — and the banner
that exists to say exactly that stayed hidden until it happened.

The monitor sweep already talks to every host once a minute, so it now also
runs one `ls -1d /home/*/.restart-pending` per host and maps the paths back to
game users. The detail page shows the banner for either source and names the
schedule when it is the cron's.

Display only, deliberately. Nothing writes restart_pending from the flag: the
two queues stay independent, so a server cannot be restarted twice by both
tickers racing, and the panel's own queue is never cleared by a box that
happens not to have the file.

Both halves are tested, because the first version was not. The banner check
set the dict directly, so removing the code that POPULATES it still passed —
mutation caught that, and there is now a monitor test that drives a real pass
with the flag stubbed. Removing either half fails: the banner mutation trips
one check, the monitor mutation trips three.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Aug 9, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage 50.00% diff coverage · +0.48% coverage variation

Metric Results
Coverage variation +0.48% coverage variation (-1.00%)
Diff coverage 50.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (b1ec072) 11957 5772 48.27%
Head commit (9b6e464) 11965 (+8) 5833 (+61) 48.75% (+0.48%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#70) 8 4 50.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@FMSMITH91
FMSMITH91 merged commit 7e2ace5 into main Aug 9, 2026
19 checks passed
@FMSMITH91
FMSMITH91 deleted the fix/banner-knows-the-daily-restart branch August 9, 2026 13:32
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