Skip to content

A forgotten clock-out, closed at the longest shift

The rule

Someone forgets to clock out. The next punch is their in the next morning, so the engine sees an in without its out: the shift has no end, counts no time, and is a missing_out exception. Many employers set a longest shift (12 or 16 hours): work that goes longer with no punch is flagged, and the system clocks the person out at the limit, so the day shows its hours and a supervisor corrects it to the real time.

Who uses it

Employers whose staff often forget the out punch: field crews, healthcare, restaurants. Closing at the limit keeps payroll from paying nothing (or holding the whole timecard) for a forgotten punch, while the flag makes sure someone puts in the real time.

How the recipe does it

Configuration only: a package (package.toml) of one layer running the standard longest_shift step, in the pair stage: work with no out within 12 hours is flagged and closed at 12 hours.

[[layer]]
id = "longest-shift"
[[layer.step]]
id = "longest"
uses = "standard/longest_shift"
params = { longest = "12h", close = true }

For each in punch whose next punch (on its workday, or the first of a later one) is more than longest after it, the step raises shift_too_long about the punch, and with close calls ctx:close(id, at, why): the work that punch starts ends at the limit if nothing ended it before. The engine pairs the punches with that end (a segment that ends with no punch), stamped, and what comes next starts afresh. An in with no punch after it yet is left alone: the person may still be at work.

Parameters

ParameterMeaning
longestThe longest a shift may go without a punch ("16h").
closeEnd the work at the limit (true), or only flag it (default).

What the scenarios show

  • closed-at-twelve-hours: Monday’s forgotten out is closed at 20:00 and flagged; Tuesday is unaffected; Wednesday’s open in is still going on.
  • flagged-not-closed: without close the shift stays open and counts nothing, flagged with why; 11 hours is within the limit.

This is a common way companies handle a forgotten clock-out; check the rules where you operate. The hours paid must be the hours actually worked: the time closed at the limit is a placeholder for a correction, not a substitute for one.

Get the recipe

The recipe’s package and its scenarios are in the example packages repository: attendance/forgotten_clock_out. Test it, or your own copy of it, with hourctl attend test, and publish it with hourctl attend pkg publish.

The policy package

The package’s layers, with the standard steps each one runs and their settings:

forgotten_clock_out/package.toml
name = "forgotten_clock_out"
version = "1.0.0"
description = "Work with no punch for longer than the longest shift is flagged, and optionally ended at the limit, so a forgotten clock-out neither pays nothing nor runs on for a day."
# Work with no out punch within 12 hours of its in is flagged
# (shift_too_long) and closed at 12 hours.
[[layer]]
id = "longest-shift"
[[layer.step]]
id = "longest"
uses = "standard/longest_shift"
params = { longest = "12h", close = true }

Scenarios

Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).

Monday's clock-out was forgotten; the next punch is Tuesday's in. With a 12-hour longest shift and close on, Monday's work ends at 20:00 (stamped), counts its 12 hours, and is flagged shift_too_long for a supervisor to correct; Tuesday starts afresh, no missing_out. Wednesday's in with no punch after it is still going on: nothing is said, and it counts nothing yet
scenarios/closed-at-twelve-hours.toml
description = "Monday's clock-out was forgotten; the next punch is Tuesday's in. With a 12-hour longest shift and close on, Monday's work ends at 20:00 (stamped), counts its 12 hours, and is flagged shift_too_long for a supervisor to correct; Tuesday starts afresh, no missing_out. Wednesday's in with no punch after it is still going on: nothing is said, and it counts nothing yet"
punch = [
{ at = "2026-10-05 08:00", kind = "in" },
{ at = "2026-10-06 08:00", kind = "in" }, { at = "2026-10-06 16:00", kind = "out" },
{ at = "2026-10-07 08:00", kind = "in" },
]
[policy]
zone = "America/Chicago"
[expect]
week = "2026-10-05"
days = { "2026-10-05" = "12h", "2026-10-06" = "8h" }
segments = ["work 2026-10-05 08:00-20:00", "work 2026-10-06 08:00-16:00", "work 2026-10-07 08:00-open"]
stamps = ["2026-10-05 08:00-20:00 work: longest [[email protected]/longest-shift rev 1]: closed the work started at 08:00:00 at 20:00:00: the longest a shift may be"]
exceptions = [{ kind = "shift_too_long", at = "2026-10-05 08:00", detail = "no punch for more than 12h" }]
Without close, a shift past the limit is only flagged: Monday's in with no out before Tuesday's stays without an end (missing_out) and counts nothing, and shift_too_long says why. An out 11 hours after an in is within the 12-hour limit: no flag
scenarios/flagged-not-closed.toml
description = "Without close, a shift past the limit is only flagged: Monday's in with no out before Tuesday's stays without an end (missing_out) and counts nothing, and shift_too_long says why. An out 11 hours after an in is within the 12-hour limit: no flag"
punch = [
{ at = "2026-10-05 08:00", kind = "in" },
{ at = "2026-10-06 08:00", kind = "in" }, { at = "2026-10-06 19:00", kind = "out" },
]
[policy]
zone = "America/Chicago"
# A company that only flags the long shift, for a supervisor to fix.
[[layer]]
id = "flag-only"
[[layer.step]]
id = "longest"
change = "params"
params = { close = false }
[expect]
week = "2026-10-05"
days = { "2026-10-06" = "11h" }
exceptions = [
{ kind = "missing_out", at = "2026-10-05 08:00" },
{ kind = "shift_too_long", at = "2026-10-05 08:00" },
]