Phase 2: maintenance tracking and alert engine#5
Merged
Conversation
- ServiceRecord, MaintenanceSchedule, Renewal and a polymorphic Alert model - Due-date logic: schedules track months/miles intervals and compute next-due; renewals and driver licenses track expiry with due-soon windows - Logging a service auto-syncs the matching schedule's last-performed markers - Alerts::Scanner reconciles an account's alerts idempotently (create / update in place / dismiss when cleared / swap due_soon->expired) - Alerts::Dispatcher emails opted-in users a digest and marks alerts sent - ScanAllAlertsJob fans out per-account AccountAlertsJob; scheduled daily via Solid Queue recurring tasks - In-app: alerts index, live nav badge, Turbo Stream dismiss - AlertsMailer digest (HTML + text) with a working mailer preview - Maintenance CRUD nested under vehicles, surfaced on the vehicle page - 129 specs green; demo seeds now generate renewals, service history and alerts Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds maintenance/compliance tracking and a proactive alert engine on top of the Phase 1 fleet core.
Data model
next_due_on/next_due_odometer.alertable) with category, severity and status enums.Alert engine
Alerts::Scannerreconciles an account's alerts idempotently: creates an alert when a condition holds, updates it in place when the underlying date changes, swapsdue_soon→expiredover time, and dismisses it once the condition clears. Covers overdue/expiring renewals, due maintenance (time or mileage), and expiring driver licenses.Alerts::Dispatcheremails opted-in users a digest and marks pending alerts assentso they aren't re-emailed.ScanAllAlertsJobfans out oneAccountAlertsJobper account; scheduled daily via Solid Queue recurring tasks (config/recurring.yml).UI & notifications
AlertsMailerdigest (HTML + text) with a working mailer preview.Test plan
db:seednow generates renewals, service history and ~55 open alerts for a lively demo🤖 Generated with Claude Code