Kaizen
Browse modulesBookingsbookings/serverTypes

Type Alias: SweeperStaleness

type SweeperStaleness = {
  kind: SweeperKind;
  lastRunAt: Date | null;
  neverRan: boolean;
  stale: boolean;
};

Defined in: server/bookings/scheduler-health.ts:60

Staleness entry for a single lifecycle sweeper.

Remarks

A sweeper whose lastRunAt is null (never emitted any event) is reported as neverRan: true with stale: false and does NOT contribute to the alert trigger. Event-derived watermarks cannot distinguish "alive but idle on a fresh system" from "dead cron that has never run" — alerting on a null watermark would cause false positives on brand-new deployments where no bookings have yet transitioned through a sweeper. Consumers who know their system has been live long enough to expect sweeper activity may treat neverRan: true as an alert condition in their own onAlert hook.

A sweeper whose lastRunAt is non-null but lags the staleness threshold (lastRunAt < now - maxSweepLagMs) counts toward the alert trigger — this is the canonical "dead cron is observable" signal (spec §11). Note that idle sweepers with old watermarks (e.g. a resource that had no completable bookings for many hours) can still false-positive here; consumers should filter by their own traffic knowledge if needed.

Properties

kind

kind: SweeperKind;

Defined in: server/bookings/scheduler-health.ts:61


lastRunAt

lastRunAt: Date | null;

Defined in: server/bookings/scheduler-health.ts:63

Latest occurrence of a sweeper-emitted event, or null if never run.


neverRan

neverRan: boolean;

Defined in: server/bookings/scheduler-health.ts:73

True when lastRunAt is null — the sweeper has never emitted a watermark event. Not an alert condition by itself (see type remarks).


stale

stale: boolean;

Defined in: server/bookings/scheduler-health.ts:68

True when lastRunAt is non-null AND lastRunAt < now - maxSweepLagMs. Never true when neverRan is true (null watermark → not alertable).

On this page