Skip to content

Admin: check a calendar now - #26

Merged
Wjouter merged 2 commits into
mainfrom
admin-refresh-calendar
Nov 12, 2026
Merged

Wjouter merged 2 commits into
mainfrom
admin-refresh-calendar

Conversation

@Wjouter

@Wjouter Wjouter commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Roadmap item "Add option for admins to refresh a calendar now". No spec.

How it works

  • POST /api/admin/calendars/{id}/check (admin and 2FA required, like every /api/admin route) sets next_check_at to now. The dispatcher already looks for due calendars every second, so a normal check runs right away: same lease, host budget, diffing and notifications. There's no second check path.
  • An already-overdue calendar keeps its place (least(...)).
  • A calendar with a live lease is mid-check, so it gets 409 check_running; pulling it forward would let a second worker claim it. A lease left over from a crashed check (past its expiry) doesn't block.
  • Unknown id → 404 not_found. Success → 202.
  • The admin calendars page has a Check now button on each card, with a toast ("reload to see the result") and an error notice for refusals. Texts in English and Dutch.

Testing

  • New ApiTests.CheckNow covers: due later → pulled to now; overdue → unchanged; running → 409 and unchanged; expired lease → allowed; unknown → 404.
  • ApiTests and AdminTests pass (36, plus 2 explicit tests skipped); EveryAdminRouteNeedsAnAdminWithASecondFactor covers the new route.
  • svelte-check is clean; vitest passes (174).
  • Not checked in the browser: the admin pages need an admin session with 2FA. After restarting the dev API, click Check now on /admin/calendars to confirm.

Not included: a "check all" button, a live-updating status, and an audit log entry.

Closes #29

🤖 Generated with Claude Code

Wjouter and others added 2 commits November 12, 2026 21:44
POST /api/admin/calendars/{id}/check pulls next_check_at forward to now,
so the normal dispatcher runs the check within a second (respecting the
host budget). A calendar with a live lease is mid-check and gets a 409
check_running; an expired lease from a crashed check doesn't block.
The admin calendars page gets a "Check now" button per calendar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Wjouter
Wjouter merged commit 1d6238c into main Nov 12, 2026
6 checks passed
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.

Add option for admins to refresh a calendar now

1 participant