# Reserve Scope — Rules

Scope: Reserve lines (`LCR` / `SCR`) under the 2022 Republic Airways Pilot
Agreement. Ruleset: `src/rulesets/reserve-rca-pilot-2025.json`.

## Constants in the original union tool, mapped

The original tool is a single December calendar page. Each hardcoded value is
listed here with its contractual basis and verification status.

| Original tool constant | Meaning | Source | Status |
|---|---|---|---|
| `offlimit = 12` | Planner target: exactly 12 days off | CBA Art. 23.E.1: "at least 12 Days Off in Base per Bid Period" (printed 23-3, PDF p. 267) | Verified minimum; **target of 12** is the reserve-line construction value (Handbook p. 23; semantics notes §0.21) |
| `minonlimit = 2` | Minimum reserve *work* sequence, default | CBA Art. 6.G.9.c.iii: "No single Days Off, single RAPs, or single RCPs, except on the first or last day of the Bid Month … or as requested by the Pilot" (printed 6-18, PDF p. 82) | Verified |
| `minonlimit = 3` when `scr` unchecked | LCR sequences need 3+ days | Handbook p. 23: "LCR sequences must be three or more days" | **Unverified in CBA** — company line-construction practice; confirm with Committee |
| `maxon = 6` ("must always have 6 or less") | Max 6 consecutive duty days | CBA Art. 23.B.3: at least 30 consecutive hours free from duty within any 168 consecutive hours (printed 23-1, PDF p. 266) | Verified by derivation |
| `minofflimit` / `minoff < 2` | Off blocks of 2+, plus "Allows Single Days Off" waiver | CBA Art. 23.E.2: other periods of Days Off "as groups of at least two except for the first and last day of the Bid Month" (printed 23-3, PDF p. 267) | Verified |
| `threedayblocks` (0/1/2) | Two groups of three consecutive days off; each waivable | CBA Art. 23.E.2 and footnote 3 ("the Pilot may waive the two groups of three days off individually") (printed 23-3, PDF p. 267) | Verified |
| first/last-day singles | Single off day allowed at month edges | CBA Art. 23.E.2 and 6.G.9.c.iii | Verified |
| `offset = 5`, `lastday = 31`, "Nov 31"/"Jan 1" spill | December 2025 page layout | Implementation detail only | N/A — generalized in the rewrite |
| `invert_weekends()` (`i % 7`) | Weekend = Sat/Sun toggle | UI convenience only, not contractual | N/A |
| fixed 75:00 credit, 4.12 hr/day | Reserve line value | CBA Art. 3.K.1 (MMG 75:00, printed 3-4, PDF p. 40); Art. 3.B.1.c (4h12m daily guarantee, printed 3-1, PDF p. 37); Handbook p. 23 | Verified |

Note: the original tool enforces **exactly** 12 days off while the Contract
sets a **minimum** of 12. For reserve lines built to a fixed 75:00 guarantee,
12 is the constructed value; the rewrite keeps `daysOff.target = 12` but
models the contractual minimum separately so partial-availability proration
(Table 23-1, printed 23-4, PDF p. 268) can be added later.

Additional contractual rules the original tool does not model:

| Rule | Source |
|---|---|
| No mixing LCR and SCR in one Reserve Line | CBA Art. 6.G.9.c.ii (printed 6-18, PDF p. 82) |
| At least one LCR line per ten SCR reserve pilots (system-wide) | CBA Art. 6.G.9.b |
| SCR RAP call-out windows: 0200–0459 → 10 h; 0500–1459 → 12 h ending no later than 0159; 1500–0159 → 10 h | CBA Art. 6.G.9.g (printed 6-18/6-19, PDF p. 83) |
| Carryover Reserve sequences: max 4 days from first RAP, waivable to 5 or 6; virtual credit per carryover day | CBA Art. 6.G.9.h (printed 6-19, PDF p. 83) |
| RAP/RCP count as a day of work for days-off calculations | CBA Art. 6.G.9.f |
| Reserve Day = a day containing a RAP, RCP, or ASR | CBA Art. 1.214 (PDF p. ~30) |
| Bidding window: opens 1200 on the 11th, closes 1200 on the 14th | Handbook Q3 p. 13 (citing Contract 6.F.7.c.iv.5-6) |
| Awards uploaded no later than 1600 on the 20th | CBA Art. 6.F.7 (build-up blackout) |

## IBS/CrewPBS behavior that affects output

These are engine semantics, not calendar rules, but the output generator must
respect them:

| Behavior | Source |
|---|---|
| Day-off requests display as "Desire" but process as "Avoid" | Handbook p. 6 |
| "Period" = all-or-nothing; "String" = run from start date, prefix-maximizing | Handbook Terminology p. 18–19; semantics notes §0.12 |
| Reserve Line is a hard override; can only be used once per bid | Handbook Appendix 3 p. 23; FAQ Q39 |
| IBS day runs 0200–0159, not midnight | Handbook FAQ Q44 p. 16 |
| CrewPBS cannot separate reserve types; only reorder them | Handbook Q13 p. 13 |
| 6-days-in-a-row bid option "not available currently" (legality still applies) | Handbook Q27 p. 14 |

## Output constructs (Reserve scope)

Menu availability is verified against the live CrewPBS Reserve tab; the full
catalog with displayed descriptions lives in
[`docs/pbs-options-catalog.md`](../pbs-options-catalog.md).

Generated from a validated day selection:

- Single off day → `Specific Date Off <date>` in both parity and advanced mode;
  never a one-day `Period`/`String`
- Multi-day off run → `Period Of Dates Off` (all-or-nothing reach) plus
  `String of Dates Off` in advanced mode, with a narrower-string ladder
- Max consecutive duty run → `Consecutive Working Days` (not more than 6)
- Zero three-day blocks → waiver `Do not assign any block of 3 days Off if
  possible`; one block → `Only assign one block of 3 days Off if possible`
- Two adjacent three-day blocks → suggest `Combine the two blocks of 3 days
  off into one block of 6 days if possible`
- Any off group smaller than 2 (other than month edges) → `Accept Single Days
  Off in Reserve Lines` (+ `Allow Single Day Off in Regular and Reserve line`)
  — note the original tool prints "Allows Single Days Off in Reserve Lines";
  use the live menu label, which is "Accept".

Reserve-tab options the planner exposes manually: `As Many Weekends Off`,
`Day Of Week Off`, `Period Of Days Off`, `String of Days Off`, `Consecutive
Days Off`, `Reserve Day Of Week`, `Reserve on Date`.

`Work on Date` is **not** offered on the Reserve tab, but `Consecutive Working
Days` **is** — the accurate split is: only `Consecutive Working Days` from the
work group, plus no pairing/layover constructs (verified Nov 2026 catalog;
supersedes the earlier "all work-on constructs are Regular-only" shorthand in
the semantics notes). `Load Schedule` is available on Reserve; emit only a
conflict warning for early-month protected windows.

Every shared Planning Session Option (waivers) applies to both scopes and is
not duplicated per scope — see
[`src/rulesets/options-shared-rca-2025.json`](../../src/rulesets/options-shared-rca-2025.json).

## Engine modes

The core ships two evaluators:

- **Contract mode** (`analyzeReserve`) — implements the rules as written,
  including month-edge forgiveness for a single duty or off day
  (Art. 23.E.2, Art. 6.G.9.c.iii).
- **Legacy mode** (`legacyReserve`) — reproduces the original union tool's
  behavior, including its quirks, for comparison output and regression tests.
  It is pinned to the original 31-day page layout (6 leading context days).
  Verified against 96 recorded scenarios by `npm test`.

Known divergences between the modes:

| Case | Contract mode | Legacy mode |
|---|---|---|
| Single duty day on the first or last day of the month, LCR | Allowed at the edge | Flagged (LCR does not forgive the edge single) |
| Single off day ending on day 2 | Waiver notice emitted | No waiver (legacy skips the transition) |
| "Accept Single Days Off in Reserve Lines" label | Live menu label | Legacy "Allows Single Days Off…" label |
| Days off target | Exact 12, or minimum mode | Exact 12 |

Parity fixtures are generated from the gitignored reference page with
`npm run fixtures:parity`; the fixture file is committed so CI does not need
the reference.

## Open questions (tracked, not blockers)

1. `scr` checkbox semantics in the original tool: confirm it selects the
   Reserve Line type (SCR vs LCR) and therefore the minimum sequence length.
2. Citation for LCR ≥ 3-day sequences (currently company practice only).
3. Should the planner enforce exactly 12 days off or accept ≥ 12 with a
   warning? Recommended: exactly 12 by default, setting to change.
4. Proration of days off for partial availability (Table 23-1) — implement
   after parity.
