# OpsLint — Multi-Engine Cron & DST Verification Workbench

Canonical URL: https://opslint.dev/cron/
Remote MCP Endpoint: https://opslint.dev/mcp (tool: `lint_cron_schedule`)

## Overview
OpsLint verifies cron and calendar schedules deterministically across 5 production engines without leaking corporate expressions to server query logs:
1. **POSIX / Linux Vixie Cron** (5-field `min hr dom mon dow`)
2. **GitHub Actions `on.schedule`** (native `timezone:` YAML support, `>=5m` interval floor check, `:00` queue jitter check)
3. **Kubernetes `CronJob` (`batch/v1`)** (`.spec.timeZone` GA in v1.27+, `concurrencyPolicy: Forbid`)
4. **AWS EventBridge Scheduler & Rules** (6-field `cron(min hr dom mon dow yr)`, `?` mutual exclusion, `1=SUN..7=SAT`, `L`/`W`/`#` modifiers)
5. **`systemd.timer` `OnCalendar=`** (`..` ranges, `min/step` intervals, `~01` reverse month-end, boolean `AND` day intersection)

## Zero-Leakage Deep-Link Schema
All interactive state lives inside the URI `#hash` fragment:
- `https://opslint.dev/cron/#expr=30%202%20*%20*%20*&tz=America%2FNew_York`
- `https://opslint.dev/cron/#expr=0%209%2013%20*%205&tz=UTC&dialect=posix`
- `https://opslint.dev/cron/#expr=0%209%20%3F%20*%202%231&tz=America%2FNew_York&dialect=aws-eventbridge`

## Critical Protocol Traps Verified
- **POSIX `OR` vs `systemd` `AND` Boolean Trap (`0 9 13 * 5`)**: POSIX combines non-`*` Day-of-Month and Day-of-Week with boolean `OR` (every 13th PLUS every Friday). `systemd` reverses this to `AND` (`Fri *-*-13 09:00:00`). AWS EventBridge forbids both without `?`. OpsLint emits copy-pasteable Host Guard Wrappers (`0 9 13 * * [ "$(date +\%d)" = "13" ] && [ "$(date +\%u)" = "5" ] && your_cmd`).
- **Non-Bijective Modifier Guards (`2#1`, `L`, `15W`)**: Translating EventBridge `2#1` (1st Monday) into `0 9 1-7 * 1` is a bug because POSIX evaluates DOM+DOW as `OR`. OpsLint emits `0 9 1-7 * *` with `DOW='*'` plus `[ "$(date +\%u)" = "1" ] && your_cmd`.
- **5-Engine Daylight Saving Time Divergence**:
  - **Linux Vixie Cron**: Spring `<3h` gap runs catch-up immediately at `03:00` for fixed hours (wildcard `*`/`*/n` hours skip the nonexistent hour); Fall overlap runs once on 1st pass for fixed hours and in both passes for wildcard hours.
  - **Kubernetes CronJob (`robfig/cron`)**: Spring gap is **skipped/missed**; Fall overlap **runs TWICE** 60m apart.
  - **GitHub Actions**: Spring gap rolls forward to next valid local time + runner queue delay; Fall overlap deduplicates.
  - **AWS EventBridge Scheduler**: Spring gap is **skipped**; Fall overlap runs once on **2nd pass** (post-transition offset).
  - **`systemd.timer`**: Spring gap skips nonexistent local occurrence (`Persistent=true` recovers missed downtime); Fall overlap coalesces into single run.

## Built-in Trap Presets
- **02:30 DST Spring Gap** (`30 2 * * *`, `America/New_York`, `posix`): Nonexistent 02:30 local wall-clock during US Spring Forward: Vixie catches up at 03:00 while K8s & EventBridge skip.
- **01:30 DST Fall Overlap** (`30 1 * * *`, `America/New_York`, `k8s-cronjob`): Ambiguous repeated 01:30 local hour during US Fall Back: Kubernetes robfig/cron fires twice 60 minutes apart.
- **Friday the 13th OR Trap** (`0 9 13 * 5`, `UTC`, `posix`): POSIX evaluates non-* DOM and DOW as boolean OR (every 13th PLUS every Friday), whereas systemd evaluates as AND.
- **EventBridge 1st Monday (2#1)** (`0 9 ? * 2#1`, `America/New_York`, `aws-eventbridge`): EventBridge 2#1 (1=SUN, 2=MON) translated safely to POSIX 1-7 DOM superset + date +%u shell guard without OR bug.
- **Last Day of Month (L)** (`0 9 L * ? *`, `UTC`, `aws-eventbridge`): Month-end L modifier across 28/29/30/31-day months mapped to POSIX 28-31 + tomorrow-is-01 guard and systemd ~01.
- **Mid-Month Payroll (15W)** (`0 9 15W * ? *`, `America/New_York`, `aws-eventbridge`): Nearest weekday to the 15th (shifts Sat->Fri 14th, Sun->Mon 16th) with pure POSIX shell guard.
- **GitHub Actions */2 Clamp** (`*/2 * * * *`, `UTC`, `github-actions`): Sub-5-minute interval rejected/clamped by GitHub Actions workflow scheduler floor.

## Sample Report (`30 2 * * *` in `America/New_York`)

### OpsLint Cron & DST Verification Report

- **Expression**: `30 2 * * *` (Normalized: `30 2 * * *`)
- **Detected Dialect**: `posix`
- **Timezone**: `America/New_York` (DST-observing, current offset -05:00)
- **Human Explanation**: At 02:30.
- **Boolean Day Logic**: Only one day axis (either Day-of-Month or Day-of-Week, or wildcard) is restricted — boolean union vs intersection behavior is identical across all 5 engines.

### Warnings & Protocol Advisories
- **[WARNING] Schedule hits America/New_York Spring-Forward DST gap (2027-03-14)** (`DST_SPRING_FORWARD_GAP_HIT`): HITS SPRING GAP: 1 scheduled occurrence(s) (2027-03-14 02:30) fall inside the nonexistent local window on 2027-03-14. Kubernetes CronJob and AWS EventBridge Scheduler SKIP this execution completely; Linux Vixie Cron fires a catch-up run immediately after the jump.

### 5-Dialect Directional Translations

### POSIX / Linux Vixie Cron [EXACT]
Expression: `30 2 * * *`
```
### Crontab entry (verify daemon supports CRON_TZ, or configure host localtime to America/New_York):
CRON_TZ=America/New_York
30 2 * * * your_cmd
```
- Standard BSD/BusyBox cron ignores CRON_TZ and uses system /etc/localtime; Red Hat/Ubuntu Vixie cron honors CRON_TZ=America/New_York for wall-clock matching.

### GitHub Actions (on.schedule) [EXACT]
Expression: `30 2 * * *`
```
on:
  schedule:
    - cron: '30 2 * * *'
      timezone: 'America/New_York'
```
- GitHub Actions natively supports 'timezone: "America/New_York"' on 'on.schedule' entries.
- Public repositories automatically disable scheduled workflows after 60 days of repository inactivity.

### Kubernetes CronJob (batch/v1) [EXACT]
Expression: `30 2 * * *`
```
apiVersion: batch/v1
kind: CronJob
metadata:
  name: opslint-scheduled-job
spec:
  schedule: "30 2 * * *"
  timeZone: "America/New_York"
  concurrencyPolicy: Forbid
  startingDeadlineSeconds: 300
  jobTemplate:
    spec:
      template:
        spec:
          restartPolicy: OnFailure
          containers:
            - name: job
              image: ubuntu:24.04
              command: ["/bin/sh", "-c"]
              args:
                - |-
                  your_cmd
```
- Requires Kubernetes v1.27+ for GA '.spec.timeZone: "America/New_York"' (never place TZ= or CRON_TZ= inside .spec.schedule — kube-apiserver rejects it).
- Set 'concurrencyPolicy: Forbid' to prevent overlapping pods during Fall-Back DST double-runs or slow executions.

### AWS EventBridge (Scheduler & Rules) [EXACT]
Expression: `cron(30 2 * * ? *)`
```
{
  "Name": "opslint-verified-schedule",
  "ScheduleExpression": "cron(30 2 * * ? *)",
  "ScheduleExpressionTimezone": "America/New_York",
  "FlexibleTimeWindow": {
    "Mode": "OFF"
  }
}
```
- EventBridge Scheduler ('scheduler:CreateSchedule') natively supports ScheduleExpressionTimezone='America/New_York'.
- Legacy EventBridge Rules ('events:PutRule') are strictly UTC-only — hardcoding shifted UTC hours breaks twice a year across DST transitions.

### systemd.timer (OnCalendar) [EXACT]
Expression: `OnCalendar=*-*-* 02:30:00 America/New_York`
```
[Timer]
OnCalendar=*-*-* 02:30:00 America/New_York
Persistent=true
AccuracySec=1s
```
- Verified systemd.time(7) syntax ('..' for ranges, 'min/step' for intervals, '~01' for month-end).

### 5-Engine Daylight Saving Time (DST) Simulation (America/New_York)
- **Spring Forward (2027-03-14)**: HITS SPRING GAP: 1 scheduled occurrence(s) (2027-03-14 02:30) fall inside the nonexistent local window on 2027-03-14.
- **Fall Back (2027-11-07)**: Outside overlap on 2027-11-07: schedule does not fire inside the 01:00–01:59 repeated window (daily UTC offset shifts -04:00 -> -05:00).

- **Linux Vixie Cron** [SAFE]: Spring -> Catch-up at 03:00 (-04:00): for <3h DST forward jumps, Vixie Cron executes missed non-wildcard jobs (02:30) immediately when the clock hits 03:00. | Fall -> Not in Fall overlap on 2027-11-07 (non-wildcard runs once on 1st pass; '*' wildcard runs twice).
- **Kubernetes CronJob (robfig/cron)** [DANGER]: Spring -> SKIPPED / MISSED completely on 2027-03-14: Go robfig/cron finds zero valid instants for 02:30 and drops the run without catch-up. | Fall -> Not in Fall overlap on 2027-11-07 (rule if inside overlap: RUNS TWICE on both passes!).
- **GitHub Actions (schedule + timezone)** [CAUTION]: Spring -> Rolled forward to next valid time (03:00 -04:00) on 2027-03-14, plus typical 5–20m runner queue delay. | Fall -> Not in Fall overlap on 2027-11-07 (rule if inside overlap: deduplicated single run + queue delay).
- **AWS EventBridge Scheduler** [DANGER]: Spring -> SKIPPED on 2027-03-14: EventBridge Scheduler does NOT fire nonexistent 02:30 local wall-clock occurrences. | Fall -> Not in Fall overlap on 2027-11-07 (rule if inside overlap: runs once on second pass -05:00).
- **systemd.timer** [DANGER]: Spring -> SKIPPED on 2027-03-14: systemd OnCalendar skips nonexistent 02:30 local wall-clock occurrences on live hosts (note: Persistent=true only recovers host downtime/reboots, not DST gaps). | Fall -> Not in Fall overlap on 2027-11-07 (rule if inside overlap: coalesced single run on first pass).

### Next 5 Scheduled Runs (America/New_York)
- `Sat 2026-11-28 02:30:00 (-05:00)` -> UTC `2026-11-28T07:30:00Z`
- `Sun 2026-11-29 02:30:00 (-05:00)` -> UTC `2026-11-29T07:30:00Z`
- `Mon 2026-11-30 02:30:00 (-05:00)` -> UTC `2026-11-30T07:30:00Z`
- `Tue 2026-12-01 02:30:00 (-05:00)` -> UTC `2026-12-01T07:30:00Z`
- `Wed 2026-12-02 02:30:00 (-05:00)` -> UTC `2026-12-02T07:30:00Z`

### Interactive Deep Link
https://opslint.dev/cron/#expr=30%202%20*%20*%20*&tz=America%2FNew_York
