# Spec Delta

## Purpose

Schedule recurring Pilot Plant maintenance, expose calendar occurrences and preserve independent execution and calibration results for each work order.

## ADDED Requirements

### Requirement: Maintenance plans
Subject to policy approval, ADMIN/SUPERVISOR SHALL create and update PREVENTIVE or CALIBRATION plans targeting Equipment or Item. Plans SHALL support ONCE, DAILY, WEEKLY, MONTHLY and YEARLY cycles, start date, optional end date and priority without technician assignment. Warehouse quarantine SHALL use corrective work rather than recurring plans.

#### Scenario: Future monthly plan
- **WHEN** a monthly plan starts next month
- **THEN** its projected occurrences appear in the calendar without creating actionable tickets early

### Requirement: Facility calendar semantics
Schedules SHALL use the facility timezone and preserve the original recurrence anchor. Missing month-end or leap-day dates SHALL clamp to the month's final day without moving subsequent anchors. Calendar reads SHALL be bounded by date range and SHALL NOT create work.

#### Scenario: January 31 anchor
- **WHEN** a monthly plan advances through February and March
- **THEN** its February occurrence is on the final day and its March occurrence returns to March 31

### Requirement: Retry-safe scheduled generation
A scheduled process SHALL create at most one WO per plan occurrence when release time arrives. Restart, overlapping runs and catch-up SHALL not duplicate or silently discard due occurrences. Paused plans SHALL stop future generation while existing work remains readable.

#### Scenario: Scheduler restarts after downtime
- **WHEN** several occurrences became due while the process was unavailable
- **THEN** bounded catch-up preserves each missed occurrence and retries do not duplicate work

### Requirement: Independent execution history
Calendar data SHALL distinguish projected occurrences from persisted work. Completing one WO SHALL not complete future occurrences. Plan edits SHALL affect future ungenerated occurrences and SHALL preserve existing work and historical outcomes.

#### Scenario: Complete this month's PM
- **WHEN** the current occurrence is completed
- **THEN** the next month remains independently scheduled

### Requirement: Proposed calibration completion
Subject to approval of the new completion fields, CALIBRATION work SHALL record performer, calibration date, result and next due date, with optional certificate reference and notes. The record SHALL match the WO's Pilot Plant target and be committed with completion. Next due date SHALL follow calibration date.

#### Scenario: Incomplete calibration result
- **WHEN** completion omits a required calibration result field
- **THEN** validation fails and neither the work nor calibration history changes
