All work

Deadline-Driven Escalation Engine on Laravel 13 and Reverb

Client K-12 education client · Contract
Role Lead Application Developer · Contract
Period Jan 2026
  • Laravel
  • Horizon
  • Reverb
  • PostgreSQL

One idempotent hourly job replaced manual deadline checks, and by construction it cannot advance the same record twice no matter how many times it runs.

Outcome

One idempotent hourly job replaced manual deadline checks, and by construction it cannot advance the same record twice no matter how many times it runs.

Context

This was contract work for a K-12 education platform built on Laravel 13, Horizon, Reverb, and PostgreSQL. I worked with the client team on a scheduling path where staff manage time-sensitive interventions; my scope was overdue detection, escalation, and live alerting.

Problem

The platform needed to detect missed deadlines without relying on manual monitoring. Tracked by hand across an organization, misses slip through and follow-up becomes inconsistent. The platform needed a deadline-driven engine that detects overdue records on its own, advances each one through a fixed escalation path, and tells the people watching the board the moment something changes.

Constraints

  • "Overdue" is defined in each organization's local day, not server UTC, so the boundary is timezone and DST sensitive.
  • Due dates move, so any decision computed in advance can be wrong by the time it would fire.
  • Advancing the same record twice is a real-world harm, not just a data glitch, so the engine has to be idempotent under retries and races.
  • Staff watch live boards that must reflect overdue records and escalations without a manual refresh.
  • Contract work under NDA, so figures and product-specific workflow names stay high-level.

Decisions and trade-offs

Rejected: a delayed job dispatched at record creation time, scheduled to fire at the due date. It reads clean until a due date changes. Rescheduled or excused records leave queued jobs that must be found and cancelled, and a job queued days out drifts against a local clock across a DST change. The queue becomes a second source of truth to reconcile.

Rejected: a scheduled broadcast that only nudges staff to act. It pushes the judgment back onto humans and never creates the escalation record itself, which is the whole point.

Chosen: an hourly poll that reads current state each run. The scheduled job runs hourly, withoutOverlapping and onOneServer, and transitions records that are still overdue using the organization's local day. Because it re-reads state every hour, a record rescheduled between runs simply no longer matches. There is no stale job to cancel.

Escalation is a separate action, and idempotency lives there. It takes a row-level lockForUpdate, guards that the record is still in the expected state, advances exactly one rung of a fixed ladder, and exits safely when the ladder is exhausted. The lock plus the status guard mean a repeated poll, a retried queue job, or a double click all collapse to a single escalation. There is no backoff to tune because there is nothing unsafe to retry. Every state change then emits a broadcast over Reverb so open boards update in place.

Implementation

I implemented the hourly, non-overlapping, single-server job within the client team's scheduling platform. The escalation action uses a row lock and status guard before advancing one tier, then broadcasts each committed change through Reverb for live boards.

Results

Detection is timezone-correct and self-correcting: it always acts on the current schedule, so reschedules and exceptions need no cleanup. Escalation is idempotent by construction rather than by convention, which removes the class of bug where one missed deadline creates duplicate consequences. Staff see overdue records and escalations appear live. The engine's behavior is now a walkable design with each trade-off written down: poll over delayed job, locked ladder over hopeful retries, broadcast over inbox.

Takeaways

When the scheduled fact can change, derive it from current state rather than trusting work queued far in advance. For consequences with real-world impact, make retries safe at the state transition itself.

Back to resume