FTDT Rest Rules: USA Part 117 §117.25 + CARs 705 Division III — Test-Driven Development plan (tests written before implementation).
| Phase | Hours | Notes |
|---|---|---|
| Phase 0 — USA Rest (§117.25) | 48 | Highest regulatory density; no existing code |
| Phase 1 — CARs Rest (§§700.40–700.70) | 56 | Complex time-zone logic; most test cases |
| Phase 2 — Data Model | 24 | Foundation — must complete first |
| Phase 3 — Validation Logic | 40 | TDD core; two validator classes |
| Phase 4 — UI Integration | 32 | MAUI controls; multi-platform testing |
| Phase 5 — Calculator Integration | 24 | Wire validators into existing calculators |
| Phase 6 — Database Schema | 16 | SQLite migrations |
| Phase 7 — Testing & Legal Review | 48 | Plus 4–6 weeks elapsed legal review |
| TOTAL | 288 | ~7.2 weeks / 2 developers · 14–16 weeks elapsed |
Critical path:
Phase 2 (Data Model)
↓
Phase 3 (Validation Logic) ←→ Phase 0 (USA specs, in parallel)
←→ Phase 1 (CARs specs, in parallel)
↓
Phase 5 (Calculator Integration)
↓
Phase 6 (Database Schema)
↓
Phase 4 (UI Integration)
↓
Phase 7 (Testing + Legal Review)
§117.25 is entirely absent from the current implementation. This phase defines and tests all seven subsections.
| Subsection | Requirement | Test IDs |
|---|---|---|
| §117.25(b) | 30 consecutive hours free from duty in past 168 hours | TEST-117-B-01 to B-06 (6 tests) |
| §117.25(c) | 36-hr rest in new theater = acclimated + satisfies (b) | TEST-117-C-01 to C-03 (3 tests) |
| §117.25(d) | 56-hr home base rest (trans-theater, >60°, >168h away), 3 physiological nights | TEST-117-D-01 to D-08 (8 tests) |
| §117.25(e) | 10-hr pre-FDP rest; minimum 8-hr sleep opportunity | TEST-117-E-01 to E-05 (5 tests) |
| §117.25(f) | FCM self-declaration if sleep opportunity < 8 hrs | TEST-117-F-01 to F-03 (3 tests) |
| §117.25(g) | Deadhead overage → rest ≥ deadhead duration, min 10 hrs | TEST-117-G-01 to G-04 (4 tests) |
Total Phase 0 tests: 24 unit tests + 4 integration scenario tests = 28 tests
| Task | Description | Hrs |
|---|---|---|
| 0B-1 | Define RestPeriod_USA record/class (Start, End, Duration, SleepOpportunityHours, SelfDeclaredInsufficientRest, IsDeadheadRest) | 4 |
| 0B-2 | Define RestRequirement_USA value object (RequiredMinimum, RequiredSleepOpportunity, regulation citation, ViolationMessage) | 3 |
| 0B-3 | Implement §117.25(b) weekly rest checker (scan prior DPs for 30h gap in 168h; handle DST) | 5 |
| 0B-4 | Implement §117.25(c) acclimation credit | 3 |
| 0B-5 | Implement §117.25(d) trans-theater home base rest (longitude distance calc, 168h away check, physiological nights checker) | 8 |
| 0B-6 | Implement §117.25(e)/(f) pre-FDP rest (10h minimum, 8h sleep opportunity, self-declaration flag) | 5 |
| 0B-7 | Implement §117.25(g) deadhead overage rest | 4 |
| 0B-8 | Implement PhysiologicalNightChecker helper (given timezone + rest window, count physiological nights 0100–0700) | 5 |
| 0B-9 | Implement LongitudeDifferenceCalculator helper (ICAO airport code → coordinates → longitude delta) | 4 |
| 0B-10 | Write/run all Phase 0 tests; TDD red→green | 7 |
| Section | Status |
|---|---|
| §700.40(1) baseline rest calculation | ❌ Missing — only exceeded case handled |
| §700.40(2) exceeded by 1h+ | ✅ Implemented — ExceededReason.Duty branch |
| §700.41 disruptive schedules | ❌ Missing |
| §700.42 time zone difference rest | ❌ Missing |
| §700.43 positioning rest | ⚠️ Stub only — ExceededReason.Positioning branch is empty |
| §700.50 split duty extension | ❌ Missing |
| §700.51 consecutive FDP limits | ❌ Missing |
| §700.60(7) post-augmented rest | ❌ Missing |
| §700.63(3) post-extension rest | ✅ Implemented — ExceededReason.UOC branch |
| §700.70 reserve rest | ❌ Missing — RAP/RDP durations exist, rest calc missing |
§700.40 tests (6): Home base rest (12h), away rest (10h), suitable accommodation option (10h), exceeded rest calculation at 1h+, 2h30m+, and <1h threshold.
§700.41 tests (6): Late-to-early transition, early-to-late transition, 4h TZ exemption, non-triggered case, local night's rest boundary (≥9h in 22:30–09:30).
§700.42 tests (9): Away with 4h TZ diff (11h), >4h TZ diff (14h), returning home in 7 combinations of TZ diff × away duration × WOCL. Canadian TZ recognition (incl. NL).
§700.43 tests (5): No trigger, ≤3h overage, >3h overage, floor check, consent requirement.
§700.50 tests (6): 06:00–23:59 break credit, 00:00–05:59 break credit, <60min break, night duty 3-night limit, 4-night violation, reserve split duty +2h.
§700.70 tests (17): Advance notice (12h / 32h WOCL), RAP duration boundaries (14h), inter-RAP rest (10h), RDP max by start time (5 rows), augmented extensions (3 rows), WOCL extension credit, start time change violations.
Total Phase 1 tests: 43 unit tests + 6 integration scenario tests = 49 tests
| Task | Description | Hrs |
|---|---|---|
| 1B-1 | Define RestPeriod_CAN record | 4 |
| 1B-2 | §700.40(1) baseline rest (home/away; accommodation modifier) | 4 |
| 1B-3 | §700.40(2) exceeded rest (complete existing stub) | 2 |
| 1B-4 | §700.41 disruptive schedule rest | 5 |
| 1B-5 | §700.42 TZ-difference rest (full branching logic) | 10 |
| 1B-6 | §700.43 positioning rest (complete stub) | 4 |
| 1B-7 | §700.50 split duty credit formula (100%/50% with 45-min deduction; night duty count) | 4 |
| 1B-8 | §700.51 consecutive FDP checker | 4 |
| 1B-9 | §700.70 reserve rest rules (advance notice, RAP cap, inter-RAP rest, RDP max, augmented extensions, WOCL extension) | 10 |
| 1B-10 | Implement LocalNightRestChecker_CAN helper (≥9h within 22:30–09:30 acclimatized) | 3 |
| 1B-11 | Write/run all Phase 1 tests; TDD red→green | 6 |
| Class | New Properties |
|---|---|
DutyPeriod base | PreDutyRestStart, PreDutyRestEnd, IsAtHomeBase, HasSuitableAccommodation |
DutyPeriod_USA | HomeBase, SleepOpportunityHours, InsufficientSleepSelfDeclared, IsDeadheadFDP, TotalDeadheadDuration, WeeklyRestWindowStart, LongitudeTraveledInCurrentTrip, HoursAwayFromHomeBase |
DutyPeriod_CAN | HasFRMSExemption, FRMSExemptionNumber, TZDifferenceFromHomeHours, TimeAwayFromHomeBaseHours, HoursAwayFromHomeConsecutive |
Results | MinimumRestRequired, MinimumRestEnd, RestViolations (List<string>), WeeklyRestCompliant, PreDutyRestCompliant, TransTheaterRestRequired, NightsRequiredAfterReturn |
20 data model tests. All new properties must raise INotifyPropertyChanged and have XML doc comments citing the relevant regulation. New columns are nullable or have safe defaults — no breaking SQLite changes.
FTDTRestValidator_USA — entry point: ValidateRestRules(DutyPeriod dp), calls Phase 0 rules, populates Results.RestViolationsFTDTRestValidator_CAN — same pattern; includes FRMS exemption bypassEach violation message includes the specific regulation citation (e.g., "§117.25(e): Pre-FDP rest is 9h20m; minimum required is 10h"). 20 validator tests.
New Views: RestPeriodInputView_USA.xaml, RestPeriodInputView_CAN.xaml, WeeklyRestTracker30h component, HomeBaseRestTracker56h component, WOCL warning banner.
10 ViewModel tests. No dialog alerts or DisplayAlertAsync in Services or Validators (MVVM compliance). Tested on iOS simulator and Android emulator (light + dark mode).
Call FTDTRestValidator_USA.ValidateRestRules(dp) from FTDTCalculator_USA and FTDTRestValidator_CAN.ValidateRestRules(dp) from FTDTCalculator_CAN. CalculatorRest_CAN.CalculateMinimumRestWhenExceedingFDP() must be called before the new validator. 10 integration tests. Zero regressions in existing test suite.
New tables: RestPeriod_USA, RestPeriod_CAN. New columns: rest period inputs on DutyPeriod, USA-specific, CAN-specific. Schema version increment. 8 migration tests. All new columns are nullable with safe defaults. Migration is idempotent.
| Step | Owner | Elapsed |
|---|---|---|
| Prepare USA legal review package | Dev | 4 hrs |
| ALPA Legal reviews §117.25 implementation | ALPA Legal | 2–3 weeks |
| Prepare CARs review package | Dev | 4 hrs |
| ALPA Canada legal reviews §§700.40–700.70 | ALPA Canada | 2–3 weeks |
| Developer remediation of findings | Dev | 8 hrs |
| Legal sign-off and release approval | ALPA Legal | 1 week |
| Regulation | Test IDs | Phase |
|---|---|---|
| §117.25(b) 30h weekly rest in 168h | TEST-117-B-01–06 | 0 |
| §117.25(c) Theater acclimation credit | TEST-117-C-01–03 | 0 |
| §117.25(d) 56h trans-theater home base rest | TEST-117-D-01–08 | 0 |
| §117.25(e) 10h pre-FDP, 8h sleep opp | TEST-117-E-01–05 | 0 |
| §117.25(f) Self-declaration | TEST-117-F-01–03, TEST-UI-07–08 | 0/4 |
| §117.25(g) Deadhead overage rest | TEST-117-G-01–04 | 0 |
| §700.40(1)/(2) Baseline + exceeded FDP rest | TEST-700-40-01–06 | 1 |
| §700.41 Disruptive schedule local night | TEST-700-41-01–06 | 1 |
| §700.42 TZ difference rest | TEST-700-42-01–09 | 1 |
| §700.43 Positioning rest | TEST-700-43-01–05 | 1 |
| §700.50 Split duty credit formula | TEST-700-50-01–06 | 1 |
| §700.51 Consecutive WOCL FDPs | TEST-700-51-01–03 | 1 |
| §700.63(3) Post-UOC extension rest | (existing in CalculatorRest_CAN.cs) | Existing ✅ |
| §700.70(1)/(5)/(6)/(7)/(8)/(9)/(10) Reserve operations | TEST-700-70-01–17 | 1 |
| §700.200 FRMS exemption | TEST-VAL-CAN-08, E2E-CAN-08 | 3/7 |
Total unique test cases: 160 (28+49+20+20+10+10+8+15)
| Sprint | Weeks | Dev A | Dev B | Total |
|---|---|---|---|---|
| 1 | 1–2 | Phase 2: Data Model (24h) | Phase 0: Tests + 0B-1 to 0B-4 (20h) | 44 |
| 2 | 3–4 | Phase 0: Complete 0B-5 to 0B-10 (24h) | Phase 1: Tests + §700.40–700.41 (26h) | 50 |
| 3 | 5–6 | Phase 3: FTDTRestValidator_USA (20h) | Phase 1: Complete §700.42–700.70 (37h) | 57 |
| 4 | 7–8 | Phase 3: FTDTRestValidator_CAN (20h) | Phase 5: Calculator Integration (24h) | 44 |
| 5 | 9–10 | Phase 6: Database + Phase 4 ViewModel tests (26h) | Phase 4: UI controls (32h) | 58 |
| 6 | 11–12 | Phase 7: E2E tests (24h) | Phase 7: Legal packages (8h); E2E fixes (8h) | 40 |
| 7 | 13+ | Legal remediation, regression, release prep (legal review turnaround: 2–4 weeks elapsed) | 20 | |
| # | Risk | P | Impact | Mitigation |
|---|---|---|---|---|
| R-01 | FAA §117.25(d) "168h away" interpretation ambiguous | Med | High | File ALPA legal clarification early; implement conservative interpretation pending reply |
| R-02 | CARs TZ difference calculations require Transport Canada interpretation | High | Med | Flag in code comments; legal review in Phase 7 |
| R-03 | FTDTDataBase.cs path unknown (not in model folder) | Med | Med | Verify early in Sprint 1 (ALPAMobile/Services/) |
| R-04 | ALPA API sync doesn't support new rest fields | High | Med | Conditional serialization; mark [JsonIgnore] until API updated |
| R-05 | Legal review finds implementation error requiring redesign | Med | High | Share spec documents from Phases 0/1 with legal before Phase 7 |
| R-06 | DST-aware physiological night counting is buggy | High | High | Dedicated PhysiologicalNightChecker with 8+ unit tests including DST boundaries |
| R-07 | MAUI DateTimePicker TZ behavior inconsistent iOS vs Android | High | Med | Use existing RestOpportunity.SetStartDateOffset pattern as model |
| R-08 | §700.50 split duty credit formula ambiguity (when does "break" count?) | Med | Med | Test 60-min boundary explicitly; add §700.50(2) comment in code |
| R-09 | Parallel USA + CARs development creates merge conflicts | Med | Low | Feature branches: feature/1908-phase0-usa, feature/1908-phase1-can |
| R-10 | Test project doesn't exist or requires setup | Low | Med | Check for ALPAMobile.Tests before Sprint 1; create if needed (1 day setup) |
| Topic | USA §117.25 | CARs §700.40 |
|---|---|---|
| Pre-duty rest minimum | 10h + 8h sleep opp | 12h home / 10h away (or 10h suitable accommodation) |
| Weekly rest | 30h in 168h | 1 "single day free from duty" in 168h (§700.29(1)(c)) |
| Trans-timezone rest | 56h + 3 physiological nights | Up to 3 local nights (§700.42, TZ diff dependent) |
| Night definition | Physiological night: 0100–0700 home/acclimated | Local night's rest: ≥9h within 22:30–09:30 acclimatized |
| WOCL | 0200–0559 | 02:00–05:59 (same) |
| Acclimation | 72h in theater OR 36h free from duty | <4h TZ diff: 72h in same zone; ≥4h: 96h in same zone |
| Deadhead rest | Rest ≥ deadhead duration, min 10h | No equivalent; deadhead = positioning (§700.43) |
| Reserve rest | §117.25(e) applies to reserve FDP | §700.70(6): 10h between RAPs; RDP limits by start time |
| FRMS | Not in Part 117 | §700.200 FRMS exemptions available |
ALPAMobile/Data/Models/FlightTimeDutyTime/RestPeriod_USA.cs ALPAMobile/Data/Models/FlightTimeDutyTime/RestPeriod_CAN.cs ALPAMobile/BusinessLogic/FlightTimeDutyTime/FTDTRestValidator_USA.cs ALPAMobile/BusinessLogic/FlightTimeDutyTime/FTDTRestValidator_CAN.cs ALPAMobile/BusinessLogic/FlightTimeDutyTime/Helpers/PhysiologicalNightChecker.cs ALPAMobile/BusinessLogic/FlightTimeDutyTime/Helpers/LongitudeDifferenceCalculator.cs ALPAMobile/BusinessLogic/FlightTimeDutyTime/Helpers/LocalNightRestChecker_CAN.cs ALPAMobile/Views/FTDT/RestPeriodInputView_USA.xaml (.cs) ALPAMobile/Views/FTDT/RestPeriodInputView_CAN.xaml (.cs) ALPAMobile/Views/FTDT/Components/WeeklyRestTracker30h.xaml (.cs) ALPAMobile/Views/FTDT/Components/HomeBaseRestTracker56h.xaml (.cs) ALPAMobile.Tests/FTDT/RestRules_USA_117_25_Tests.cs ALPAMobile.Tests/FTDT/RestRules_CAN_700_Tests.cs ALPAMobile.Tests/FTDT/DataModel_RestProperties_Tests.cs ALPAMobile.Tests/FTDT/FTDTRestValidator_USA_Tests.cs ALPAMobile.Tests/FTDT/FTDTRestValidator_CAN_Tests.cs ALPAMobile.Tests/FTDT/RestPeriodViewModel_Tests.cs ALPAMobile.Tests/FTDT/Calculator_RestIntegration_Tests.cs ALPAMobile.Tests/Database/Database_RestMigration_Tests.cs ALPAMobile.Tests/FTDT/E2E/FTDT_E2E_ComplianceTests.cs
ALPAMobile/Data/Models/FlightTimeDutyTime/DutyPeriod.cs ALPAMobile/Data/Models/FlightTimeDutyTime/Results.cs ALPAMobile/Data/Models/FlightTimeDutyTime/CalculatorRest_CAN.cs ALPAMobile/BusinessLogic/FlightTimeDutyTime/FTDTCalculator_USA.cs ALPAMobile/BusinessLogic/FlightTimeDutyTime/FTDTCalculator_CAN.cs ALPAMobile/Services/FTDTDataBase.cs (verify path) ALPAMobile/Interfaces/FlightTimeDutyTime/IDutyPeriod_USA.cs ALPAMobile/Interfaces/FlightTimeDutyTime/IDutyPeriod_CAN.cs