Repository navigation
Add the Cron section and move notifications-cleanup to it - #2882
Conversation
First step of replacing Hangfire (#2807): a Cron section runs the jobs listed in CronJobIds on their cron schedules, keeps 90 days of runs in cron_runs, and shows them at /Cron. Hangfire keeps every other job and skips the moved ids. - One run per job at a time (in-process lock); a busy tick is recorded as skipped. A job that fell due while the app was down runs once at start-up. Runs in flight are waited for on shutdown. - notifications-cleanup moves over; its Hangfire attribute, metric call and wrapper tests go. - cron-runs-prune deletes runs older than 90 days. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0186neA4aUHmCsNPH217ApRk
|
@codex review Generated by Claude Code |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
| { | ||
| var (resolvedDeleted, staleDeleted, retiredDeleted) = | ||
| await notifications.PurgeExpiredAsync(cancellationToken); | ||
| var (resolvedDeleted, staleDeleted, retiredDeleted) = await notifications.PurgeExpiredAsync(cancellationToken); |
There was a problem hiding this comment.
WARN — humans.job_runs_total loses its cleanup_notifications series
Ref: AGENTS.md "The Board can see what happened" / "Hit every surface".
This PR removes metrics.RecordJobRun("cleanup_notifications", "success"|"failure") and its tests, and nothing replaces it: CronRunner.ExecuteAsync never calls IHumansMetrics. Any dashboard or alert built on humans.job_runs_total for this job will just go quiet, and a failure will look the same as no data. Every job moved to Cron later will lose its metric the same way.
Fix: inject IHumansMetrics into CronRunner and call RecordJobRun(job.Id, "success"/"failure") in ExecuteAsync, so each Cron job gets the metric for free. Add a CronRunnerTests case for it. Or, if this metric is being retired on purpose, say so in the PR.
There was a problem hiding this comment.
Retired on purpose: Peter decided no job-run metrics, and #2881 deletes the humans.job_runs_total counter. Cron's run history on /Cron (90 days, failures in red) is what shows a job's outcome now. No change.
Generated by Claude Code
|
Reviewed commit 69019c3. 2 inline finding(s) posted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69019c3e36
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
PR Surface ReportCompared Summary: 44 changed file(s) | EF migrations: 1 added file(s), max 1/1 per context Reforge Surface Score
Section Deltas
Section Size & Complexity Deltas
Rule Deltas
Corpus Size & Complexity
At head: largest class Published Write Surface15 of 58 sections publish write capability, 47 interfaces (0). Interface SurfaceNo new interfaces or interface members. Diff Size
New Files
EF Migrations (OK)
|
Run now can start a job that deletes members' data, so the service writes a CronJobRunByHand audit entry naming the admin and the run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0186neA4aUHmCsNPH217ApRk
A due time that fell while Cron started could be missed by both the catch-up and the first schedule pass. Run now buttons no longer use a C# boolean attribute; the server already says when a job is running. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0186neA4aUHmCsNPH217ApRk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0186neA4aUHmCsNPH217ApRk
Requested by Peter · project thread
What
First step of replacing Hangfire: a new
Humans.Cronsection runs scheduled jobs, keeps 90 days of runs, and shows them at/Cron. It runs two jobs:notifications-cleanup(moved from Hangfire) and its owncron-runs-prune. Hangfire keeps the other 33 and skips the moved ids.Why
Hangfire owns tables nobody owns, takes database locks on a single server, and makes 19 projects reference it for one attribute. Peter chose a staged move: build Cron, move one job, prove it, then move the rest in batches; the last PR deletes Hangfire.
Existing surface checked
ISectionJobs/RecurringJobDescriptor/IRecurringJobas they are; no change to how sections contribute jobs.CronJobIds(the moved ids), temporary, deleted with Hangfire.<page-header>,_StatTile,_Table,<status-badge>.UI changes / screenshots
/Cron(job list, Run now for Admin, Hangfire jobs folded away) and/Cron/{id}(recent runs). Looked at locally on desktop and phone.Checklist
tier:standard.InitialCronSectionfromdotnet ef migrations add.No NOT NULL column added to an existing tablenew table only.mainonpeterdrier/Humansorigin/mainNew project rule?none.Reviewer notes
Cron:SchedulerEnabled=false.Closes
Part of #2807 (not closed: more batches follow).
Generated by Claude Code