docs(09): create phase 9 plans - Trip Planner Modes TDD
Phase 09: Trip Planner Modes TDD - 3 plans created (09-01, 09-02, 09-03) - 29 total tests planned across all scenarios - TDD approach: Write tests first, fix code if tests fail Plan 09-01: Scenario A Timezone & Conflict TDD (8 tests) - Feature 1: Timezone boundary handling for date range (4 tests) - Feature 2: Same-day multi-city conflict detection (4 tests) Plan 09-02: Scenario B Filler Conflict TDD (9 tests) - Feature 1: Filler game timing conflict prevention (4 tests) - Feature 2: Impossible geographic combination detection (5 tests) Plan 09-03: Scenario C Corridor Efficiency TDD (12 tests) - Feature 1: Travel corridor game inclusion (5 tests) - Feature 2: Geographic efficiency validation / anti-backtracking (7 tests) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
199
.planning/phases/09-trip-planner-modes-tdd/09-01-PLAN.md
Normal file
199
.planning/phases/09-trip-planner-modes-tdd/09-01-PLAN.md
Normal file
@@ -0,0 +1,199 @@
|
||||
---
|
||||
phase: 09-trip-planner-modes-tdd
|
||||
plan: 01
|
||||
type: tdd
|
||||
---
|
||||
|
||||
<objective>
|
||||
Test-driven validation of Scenario A (date range planning) timezone boundary handling and same-day multi-city conflict detection.
|
||||
|
||||
Purpose: Ensure date range boundaries respect timezone context and detect impossible same-day games in different cities. Tests define correctness - code must match.
|
||||
Output: Working timezone boundary handling and conflict detection with passing TDD tests.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
~/.claude/get-shit-done/workflows/execute-phase.md
|
||||
./summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@.planning/PROJECT.md
|
||||
@.planning/ROADMAP.md
|
||||
@.planning/STATE.md
|
||||
@.planning/phases/08-dag-system-tdd/08-01-SUMMARY.md
|
||||
@.planning/phases/08-dag-system-tdd/08-02-SUMMARY.md
|
||||
@SportsTime/Planning/Engine/ScenarioAPlanner.swift
|
||||
@SportsTimeTests/ScenarioAPlannerSwiftTests.swift
|
||||
@SportsTimeTests/GameDAGRouterTests.swift
|
||||
|
||||
**Tech stack available:** Swift Testing framework, GameDAGRouter with dynamic beam scaling
|
||||
**Established patterns:** Swift Testing @Test/@Suite, TDD RED-GREEN-REFACTOR, makeStadium/makeGame/date helpers
|
||||
**Constraining decisions:**
|
||||
- Phase 08-01: Tests validate behavior via findRoutes() rather than testing internal methods directly
|
||||
- Phase 08-02: Dynamic beam width scaling for performance (800+ games use width 50)
|
||||
|
||||
**Issues being addressed:** None (new test coverage)
|
||||
</context>
|
||||
|
||||
<feature>
|
||||
<name>Feature 1: Timezone boundary handling for date range</name>
|
||||
<files>
|
||||
SportsTimeTests/ScenarioAPlannerSwiftTests.swift
|
||||
SportsTime/Planning/Engine/ScenarioAPlanner.swift
|
||||
</files>
|
||||
<behavior>
|
||||
Test cases for date range timezone boundary correctness:
|
||||
|
||||
**Case 1: Game at range start in different timezone (included)**
|
||||
- Date range: Jan 5 00:00 PST to Jan 10 23:59 PST
|
||||
- Game: Jan 5 19:00 EST (New York) = Jan 5 16:00 PST
|
||||
- Expected: Game included (within PST range)
|
||||
|
||||
**Case 2: Game just before range start in different timezone (excluded)**
|
||||
- Date range: Jan 5 00:00 PST to Jan 10 23:59 PST
|
||||
- Game: Jan 4 22:00 EST (New York) = Jan 4 19:00 PST
|
||||
- Expected: Game excluded (before PST range start)
|
||||
|
||||
**Case 3: Game at range end in different timezone (included)**
|
||||
- Date range: Jan 5 00:00 PST to Jan 10 23:59 PST
|
||||
- Game: Jan 10 21:00 EST (New York) = Jan 10 18:00 PST
|
||||
- Expected: Game included (within PST range)
|
||||
|
||||
**Case 4: Game just after range end in different timezone (excluded)**
|
||||
- Date range: Jan 5 00:00 PST to Jan 10 23:59 PST
|
||||
- Game: Jan 11 02:00 EST (New York) = Jan 10 23:00 PST
|
||||
- Expected: Game excluded (after PST range end when converted)
|
||||
|
||||
Note: DateInterval.contains() handles Date correctly across timezones - verify it works as expected.
|
||||
</behavior>
|
||||
<implementation>
|
||||
If tests fail due to timezone conversion issues:
|
||||
1. Verify DateInterval uses absolute Date comparison (it should)
|
||||
2. Check game.startTime is constructed in correct timezone
|
||||
3. Ensure date range boundaries are interpreted in user's timezone (not UTC)
|
||||
4. Fix ScenarioAPlanner filtering logic if needed
|
||||
</implementation>
|
||||
</feature>
|
||||
|
||||
<feature>
|
||||
<name>Feature 2: Same-day multi-city conflict detection</name>
|
||||
<files>
|
||||
SportsTimeTests/ScenarioAPlannerSwiftTests.swift
|
||||
SportsTime/Planning/Engine/ScenarioAPlanner.swift
|
||||
</files>
|
||||
<behavior>
|
||||
Test cases for impossible same-day game scheduling:
|
||||
|
||||
**Case 1: Same-day games in cities <4 hours apart (feasible)**
|
||||
- LA game at 1pm, San Diego game at 7pm (120 miles, 2hr drive)
|
||||
- Expected: Both games in route (enough time to drive between)
|
||||
|
||||
**Case 2: Same-day games in distant cities (infeasible)**
|
||||
- LA game at 1pm, San Francisco game at 7pm (380 miles, 6hr drive)
|
||||
- Expected: Route picks ONE game (cannot attend both same day)
|
||||
|
||||
**Case 3: Same-day games in opposite coasts (obviously infeasible)**
|
||||
- LA game at 1pm, New York game at 7pm EST (2800 miles)
|
||||
- Expected: Route picks ONE game (impossible same day)
|
||||
|
||||
**Case 4: Three same-day games, two feasible combinations**
|
||||
- LA 1pm, Anaheim 4pm (30mi), San Diego 7pm (90mi from Anaheim)
|
||||
- Expected: Route includes LA→Anaheim→SD OR picks best option
|
||||
- Constraint: Cannot include NY game on same day
|
||||
|
||||
Current behavior: GameDAGRouter.canTransition() checks time/distance feasibility.
|
||||
Tests verify routes respect these constraints when multiple same-day options exist.
|
||||
</behavior>
|
||||
<implementation>
|
||||
If tests fail:
|
||||
1. GameDAGRouter.canTransition() may need to check calendar day conflicts
|
||||
2. ScenarioAPlanner may need to pre-filter impossible same-day combinations
|
||||
3. RouteFilters may need same-day conflict detection
|
||||
4. Fix the appropriate layer (likely GameDAGRouter or ScenarioAPlanner)
|
||||
|
||||
Do NOT weaken test assertions - fix the code to match expected behavior.
|
||||
</implementation>
|
||||
</feature>
|
||||
|
||||
<verification>
|
||||
All tests pass:
|
||||
```bash
|
||||
xcodebuild -project SportsTime.xcodeproj -scheme SportsTime \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' \
|
||||
-only-testing:SportsTimeTests/ScenarioAPlannerSwiftTests test
|
||||
```
|
||||
|
||||
Specific tests to verify:
|
||||
- Timezone boundary tests: 4 new tests (range start/end, before/after, cross-timezone)
|
||||
- Same-day conflict tests: 4 new tests (feasible close, infeasible far, opposite coasts, three-game selection)
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
- 8 new tests added to ScenarioAPlannerSwiftTests.swift
|
||||
- All tests follow TDD pattern (RED → GREEN → REFACTOR)
|
||||
- Each feature produces 2-3 commits (test, feat, optional refactor)
|
||||
- No test assertions weakened
|
||||
- All existing tests continue to pass
|
||||
- Tests use existing helper patterns (makeStadium, makeGame, date)
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `.planning/phases/09-trip-planner-modes-tdd/09-01-SUMMARY.md`:
|
||||
|
||||
# Phase 09 Plan 01: Scenario A Timezone & Conflict TDD Summary
|
||||
|
||||
**[Substantive one-liner - what shipped, not "phase complete"]**
|
||||
|
||||
## Performance
|
||||
|
||||
- **Duration:** [actual time]
|
||||
- **Started:** [timestamp]
|
||||
- **Completed:** [timestamp]
|
||||
|
||||
## Accomplishments
|
||||
|
||||
### Feature 1: Timezone Boundary Handling
|
||||
- **RED:** [What tests were written, expected failures]
|
||||
- **GREEN:** [What code changes made tests pass, or "tests passed on first run"]
|
||||
- **REFACTOR:** [Cleanup done, or "no refactor needed"]
|
||||
|
||||
### Feature 2: Same-Day Multi-City Conflicts
|
||||
- **RED:** [What tests were written, expected failures]
|
||||
- **GREEN:** [What code changes made tests pass, or "tests passed on first run"]
|
||||
- **REFACTOR:** [Cleanup done, or "no refactor needed"]
|
||||
|
||||
## Task Commits
|
||||
|
||||
List of commits produced (2-3 per feature):
|
||||
1. test(09-01): add timezone boundary tests for date range filtering
|
||||
2. feat(09-01): fix timezone handling in ScenarioAPlanner (if needed)
|
||||
3. test(09-01): add same-day multi-city conflict tests
|
||||
4. feat(09-01): add conflict detection to ScenarioAPlanner (if needed)
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
- `SportsTimeTests/ScenarioAPlannerSwiftTests.swift` - Added 8 tests
|
||||
- `SportsTime/Planning/Engine/ScenarioAPlanner.swift` - [describe changes, or "no changes - tests passed"]
|
||||
|
||||
## Decisions Made
|
||||
|
||||
[Key decisions and rationale, or "None - tests validated existing behavior"]
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### Auto-fixed Issues
|
||||
[Any blocking issues fixed during execution, or "None"]
|
||||
|
||||
### Deferred Enhancements
|
||||
[Any issues logged to ISSUES.md, or "None"]
|
||||
|
||||
## Issues Encountered
|
||||
|
||||
[Problems and resolutions, or "None"]
|
||||
|
||||
## Next Phase Readiness
|
||||
|
||||
- Scenario A timezone and conflict handling validated
|
||||
- Ready for Plan 09-02: Scenario B Filler Conflict TDD
|
||||
- No blockers
|
||||
</output>
|
||||
206
.planning/phases/09-trip-planner-modes-tdd/09-02-PLAN.md
Normal file
206
.planning/phases/09-trip-planner-modes-tdd/09-02-PLAN.md
Normal file
@@ -0,0 +1,206 @@
|
||||
---
|
||||
phase: 09-trip-planner-modes-tdd
|
||||
plan: 02
|
||||
type: tdd
|
||||
---
|
||||
|
||||
<objective>
|
||||
Test-driven validation of Scenario B (must-see games planning) filler game timing conflict prevention and impossible geographic combination detection.
|
||||
|
||||
Purpose: Ensure filler games don't conflict with anchored must-see games, and detect when selected games cannot be combined into a valid route. Tests define correctness - code must match.
|
||||
Output: Working filler conflict prevention and impossible combination detection with passing TDD tests.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
~/.claude/get-shit-done/workflows/execute-phase.md
|
||||
./summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@.planning/PROJECT.md
|
||||
@.planning/ROADMAP.md
|
||||
@.planning/STATE.md
|
||||
@.planning/phases/09-trip-planner-modes-tdd/09-01-SUMMARY.md
|
||||
@SportsTime/Planning/Engine/ScenarioBPlanner.swift
|
||||
@SportsTimeTests/ScenarioBPlannerTests.swift
|
||||
@SportsTimeTests/GameDAGRouterTests.swift
|
||||
|
||||
**Tech stack available:** Swift Testing framework, GameDAGRouter with anchor filtering, sliding window logic
|
||||
**Established patterns:** Swift Testing @Test/@Suite, TDD RED-GREEN-REFACTOR, anchor game validation
|
||||
**Constraining decisions:**
|
||||
- Phase 08-01: GameDAGRouter validates anchor games appear in all routes
|
||||
- Phase 08-02: Dynamic beam scaling prevents performance degradation
|
||||
- Phase 09-01: Timezone boundary handling and same-day conflict detection patterns
|
||||
|
||||
**Issues being addressed:** None (new test coverage)
|
||||
</context>
|
||||
|
||||
<feature>
|
||||
<name>Feature 1: Filler game timing conflict prevention</name>
|
||||
<files>
|
||||
SportsTimeTests/ScenarioBPlannerTests.swift
|
||||
SportsTime/Planning/Engine/ScenarioBPlanner.swift
|
||||
</files>
|
||||
<behavior>
|
||||
Test cases for filler games not conflicting with must-see games:
|
||||
|
||||
**Case 1: Filler game between two must-see games (feasible timing)**
|
||||
- Must-see: LA Jan 5 1pm, SF Jan 7 7pm
|
||||
- Filler available: San Jose Jan 6 7pm (between LA and SF, feasible)
|
||||
- Expected: Filler included in route (LA → SJ → SF)
|
||||
|
||||
**Case 2: Filler game same-day as must-see (infeasible timing)**
|
||||
- Must-see: LA Jan 5 7pm
|
||||
- Filler available: Anaheim Jan 5 7pm (same time, different city)
|
||||
- Expected: Filler excluded (cannot attend both at same time)
|
||||
|
||||
**Case 3: Filler game requires backtracking**
|
||||
- Must-see: LA Jan 5 7pm, SF Jan 7 7pm (north-bound route)
|
||||
- Filler available: San Diego Jan 6 7pm (south of LA, requires backtrack)
|
||||
- Expected: Filler excluded or route reordered if feasible
|
||||
|
||||
**Case 4: Multiple filler options, only one feasible**
|
||||
- Must-see: LA Jan 5 1pm, Phoenix Jan 7 7pm
|
||||
- Filler A: SF Jan 6 7pm (300mi north, wrong direction)
|
||||
- Filler B: Tucson Jan 6 7pm (100mi east toward Phoenix)
|
||||
- Expected: Route includes Filler B, excludes Filler A
|
||||
|
||||
Anchors are fixed - filler games must not create conflicts or geographic inefficiency.
|
||||
</behavior>
|
||||
<implementation>
|
||||
If tests fail:
|
||||
1. ScenarioBPlanner may not be filtering filler games by geographic feasibility
|
||||
2. GameDAGRouter may not be checking same-day timing conflicts for non-anchors
|
||||
3. Sliding window logic may include infeasible date ranges
|
||||
4. Fix ScenarioBPlanner's filler game selection logic
|
||||
|
||||
Do NOT weaken test assertions - fix the code to match expected behavior.
|
||||
</implementation>
|
||||
</feature>
|
||||
|
||||
<feature>
|
||||
<name>Feature 2: Impossible geographic combination detection</name>
|
||||
<files>
|
||||
SportsTimeTests/ScenarioBPlannerTests.swift
|
||||
SportsTime/Planning/Engine/ScenarioBPlanner.swift
|
||||
</files>
|
||||
<behavior>
|
||||
Test cases for detecting impossible must-see game combinations:
|
||||
|
||||
**Case 1: Must-see games too far apart for date span**
|
||||
- Must-see: LA Jan 5 7pm, New York Jan 6 7pm (2800 miles, 42hr drive)
|
||||
- Date range: Jan 5-6 (24 hours available)
|
||||
- Expected: .failure(.constraintsUnsatisfiable) - cannot drive 2800mi in 24hr
|
||||
|
||||
**Case 2: Must-see games in reverse chronological order geographically**
|
||||
- Must-see: SF Jan 5, LA Jan 4 (SF is after LA chronologically but north)
|
||||
- Expected: .failure(.dateRangeViolation) - SF game is before LA game but would require backtracking
|
||||
|
||||
**Case 3: Three must-see games forming triangle (inefficient)**
|
||||
- Must-see: LA Jan 5, SF Jan 6, San Diego Jan 7
|
||||
- Expected: Route attempts LA→SF→SD (but SD is south of LA) OR returns failure if too inefficient
|
||||
|
||||
**Case 4: Must-see games exceed driving constraints**
|
||||
- Must-see: LA Jan 5 1pm, Phoenix Jan 5 7pm (380 miles, 6hr drive)
|
||||
- Constraints: 1 driver, 4hr/day max
|
||||
- Expected: .failure(.drivingExceedsLimit) - 6hr drive exceeds 4hr limit
|
||||
|
||||
**Case 5: Feasible must-see combination (sanity check)**
|
||||
- Must-see: LA Jan 5 7pm, Anaheim Jan 7 7pm (30 miles)
|
||||
- Expected: .success([...]) with both games in route
|
||||
|
||||
Tests verify ScenarioBPlanner detects impossible combinations early and returns explicit failures.
|
||||
</behavior>
|
||||
<implementation>
|
||||
If tests fail:
|
||||
1. ScenarioBPlanner may not validate geographic feasibility before routing
|
||||
2. GameDAGRouter may not enforce driving constraints for anchor games
|
||||
3. Failure reasons may not be specific enough (.constraintsUnsatisfiable vs .drivingExceedsLimit)
|
||||
4. Fix ScenarioBPlanner's validation logic and failure reporting
|
||||
|
||||
Do NOT weaken test assertions - fix the code to match expected behavior.
|
||||
</implementation>
|
||||
</feature>
|
||||
|
||||
<verification>
|
||||
All tests pass:
|
||||
```bash
|
||||
xcodebuild -project SportsTime.xcodeproj -scheme SportsTime \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' \
|
||||
-only-testing:SportsTimeTests/ScenarioBPlannerTests test
|
||||
```
|
||||
|
||||
Specific tests to verify:
|
||||
- Filler conflict tests: 4 new tests (between anchors, same-day, backtracking, multiple options)
|
||||
- Impossible combination tests: 5 new tests (distance, reverse order, triangle, driving limit, feasible sanity)
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
- 9 new tests added to ScenarioBPlannerTests.swift
|
||||
- All tests follow TDD pattern (RED → GREEN → REFACTOR)
|
||||
- Each feature produces 2-3 commits (test, feat, optional refactor)
|
||||
- No test assertions weakened
|
||||
- All existing tests continue to pass
|
||||
- Tests use existing helper patterns (makeStadium, makeGame, makeRequest)
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `.planning/phases/09-trip-planner-modes-tdd/09-02-SUMMARY.md`:
|
||||
|
||||
# Phase 09 Plan 02: Scenario B Filler Conflict TDD Summary
|
||||
|
||||
**[Substantive one-liner - what shipped, not "phase complete"]**
|
||||
|
||||
## Performance
|
||||
|
||||
- **Duration:** [actual time]
|
||||
- **Started:** [timestamp]
|
||||
- **Completed:** [timestamp]
|
||||
|
||||
## Accomplishments
|
||||
|
||||
### Feature 1: Filler Game Timing Conflict Prevention
|
||||
- **RED:** [What tests were written, expected failures]
|
||||
- **GREEN:** [What code changes made tests pass, or "tests passed on first run"]
|
||||
- **REFACTOR:** [Cleanup done, or "no refactor needed"]
|
||||
|
||||
### Feature 2: Impossible Geographic Combination Detection
|
||||
- **RED:** [What tests were written, expected failures]
|
||||
- **GREEN:** [What code changes made tests pass, or "tests passed on first run"]
|
||||
- **REFACTOR:** [Cleanup done, or "no refactor needed"]
|
||||
|
||||
## Task Commits
|
||||
|
||||
List of commits produced (2-3 per feature):
|
||||
1. test(09-02): add filler game timing conflict tests
|
||||
2. feat(09-02): improve filler game filtering in ScenarioBPlanner (if needed)
|
||||
3. test(09-02): add impossible geographic combination tests
|
||||
4. feat(09-02): add early validation to ScenarioBPlanner (if needed)
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
- `SportsTimeTests/ScenarioBPlannerTests.swift` - Added 9 tests
|
||||
- `SportsTime/Planning/Engine/ScenarioBPlanner.swift` - [describe changes, or "no changes - tests passed"]
|
||||
|
||||
## Decisions Made
|
||||
|
||||
[Key decisions and rationale, or "None - tests validated existing behavior"]
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### Auto-fixed Issues
|
||||
[Any blocking issues fixed during execution, or "None"]
|
||||
|
||||
### Deferred Enhancements
|
||||
[Any issues logged to ISSUES.md, or "None"]
|
||||
|
||||
## Issues Encountered
|
||||
|
||||
[Problems and resolutions, or "None"]
|
||||
|
||||
## Next Phase Readiness
|
||||
|
||||
- Scenario B filler conflict prevention and impossible combinations validated
|
||||
- Ready for Plan 09-03: Scenario C Corridor Efficiency TDD
|
||||
- No blockers
|
||||
</output>
|
||||
227
.planning/phases/09-trip-planner-modes-tdd/09-03-PLAN.md
Normal file
227
.planning/phases/09-trip-planner-modes-tdd/09-03-PLAN.md
Normal file
@@ -0,0 +1,227 @@
|
||||
---
|
||||
phase: 09-trip-planner-modes-tdd
|
||||
plan: 03
|
||||
type: tdd
|
||||
---
|
||||
|
||||
<objective>
|
||||
Test-driven validation of Scenario C (start/end cities routing) travel corridor game inclusion and geographic efficiency validation.
|
||||
|
||||
Purpose: Ensure routes start at the specified city, end at the specified city, and only include games along the efficient travel corridor (no backtracking). Tests define correctness - code must match.
|
||||
Output: Working corridor-based routing with anti-backtracking validation and passing TDD tests.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
~/.claude/get-shit-done/workflows/execute-phase.md
|
||||
./summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@.planning/PROJECT.md
|
||||
@.planning/ROADMAP.md
|
||||
@.planning/STATE.md
|
||||
@.planning/phases/09-trip-planner-modes-tdd/09-01-SUMMARY.md
|
||||
@.planning/phases/09-trip-planner-modes-tdd/09-02-SUMMARY.md
|
||||
@SportsTime/Planning/Engine/ScenarioCPlanner.swift
|
||||
@SportsTimeTests/ScenarioCPlannerTests.swift
|
||||
@SportsTimeTests/GameDAGRouterTests.swift
|
||||
|
||||
**Tech stack available:** Swift Testing framework, GameDAGRouter with directional filtering, corridor-based routing
|
||||
**Established patterns:** Swift Testing @Test/@Suite, TDD RED-GREEN-REFACTOR, geographic efficiency validation
|
||||
**Constraining decisions:**
|
||||
- Phase 08-01: GameDAGRouter validates routes don't include excessive backtracking
|
||||
- Phase 08-02: Dynamic beam scaling for performance
|
||||
- Phase 09-01: Timezone and same-day conflict patterns
|
||||
- Phase 09-02: Impossible combination detection patterns
|
||||
|
||||
**Issues being addressed:** None (new test coverage)
|
||||
</context>
|
||||
|
||||
<feature>
|
||||
<name>Feature 1: Travel corridor game inclusion</name>
|
||||
<files>
|
||||
SportsTimeTests/ScenarioCPlannerTests.swift
|
||||
SportsTime/Planning/Engine/ScenarioCPlanner.swift
|
||||
</files>
|
||||
<behavior>
|
||||
Test cases for games along the travel corridor:
|
||||
|
||||
**Case 1: Direct route with games along path**
|
||||
- Start: Los Angeles, End: San Francisco
|
||||
- Games available: LA Jan 5, San Jose Jan 6 (midpoint), SF Jan 7
|
||||
- Expected: Route includes all 3 games (LA → SJ → SF)
|
||||
|
||||
**Case 2: Game slightly off corridor (within tolerance)**
|
||||
- Start: LA, End: SF (straight north on I-5)
|
||||
- Games available: LA Jan 5, Sacramento Jan 6 (20mi east of I-5), SF Jan 7
|
||||
- Expected: Route includes Sacramento (within corridor tolerance)
|
||||
|
||||
**Case 3: Game far from corridor (excluded)**
|
||||
- Start: LA, End: SF (north-bound)
|
||||
- Games available: LA Jan 5, Phoenix Jan 6 (300mi east), SF Jan 7
|
||||
- Expected: Route excludes Phoenix (too far from LA→SF corridor)
|
||||
|
||||
**Case 4: Multiple games, some on corridor, some off**
|
||||
- Start: LA, End: Portland
|
||||
- Games: LA Jan 5, San Diego Jan 6 (south), SF Jan 7 (on path), Seattle Jan 8 (beyond end)
|
||||
- Expected: LA → SF → Portland (excludes SD south, excludes Seattle beyond)
|
||||
|
||||
**Case 5: No games along corridor**
|
||||
- Start: LA, End: Seattle
|
||||
- Games available: Phoenix Jan 5, Denver Jan 6 (both far from LA→Seattle I-5 route)
|
||||
- Expected: Route has start/end waypoints only, no games OR .failure(.noGamesInRange)
|
||||
|
||||
Corridor tolerance: Games within ~50-100 miles of direct path should be included.
|
||||
</behavior>
|
||||
<implementation>
|
||||
If tests fail:
|
||||
1. ScenarioCPlanner may not be calculating corridor boundaries correctly
|
||||
2. Geographic proximity threshold may be too strict or too loose
|
||||
3. Directional filtering may exclude valid corridor games
|
||||
4. Fix ScenarioCPlanner's corridor calculation and game filtering logic
|
||||
|
||||
Do NOT weaken test assertions - fix the code to match expected behavior.
|
||||
</implementation>
|
||||
</feature>
|
||||
|
||||
<feature>
|
||||
<name>Feature 2: Geographic efficiency validation (anti-backtracking)</name>
|
||||
<files>
|
||||
SportsTimeTests/ScenarioCPlannerTests.swift
|
||||
SportsTime/Planning/Engine/ScenarioCPlanner.swift
|
||||
</files>
|
||||
<behavior>
|
||||
Test cases for preventing geographic backtracking:
|
||||
|
||||
**Case 1: Route must start at specified start city**
|
||||
- Start: San Francisco, End: Los Angeles
|
||||
- Games available: LA Jan 5, SF Jan 7
|
||||
- Expected: Route begins at SF waypoint → LA game (not LA → SF)
|
||||
|
||||
**Case 2: Route must end at specified end city**
|
||||
- Start: LA, End: Seattle
|
||||
- Games available: LA Jan 5, SF Jan 6
|
||||
- Expected: Route ends at Seattle waypoint (LA → SF → Seattle)
|
||||
|
||||
**Case 3: Intermediate games in wrong order (backtracking)**
|
||||
- Start: LA, End: Portland
|
||||
- Games available: SF Jan 5, LA Jan 6 (south of SF), Portland Jan 7
|
||||
- Expected: Route rejects LA Jan 6 (requires backtrack south) OR reorders to LA→SF→Portland
|
||||
|
||||
**Case 4: Multiple options, least backtracking preferred**
|
||||
- Start: LA, End: SF
|
||||
- Option A: LA → San Diego (south) → SF (major backtrack)
|
||||
- Option B: LA → San Jose → SF (direct north)
|
||||
- Expected: Rank Option B higher (less backtracking)
|
||||
|
||||
**Case 5: Backtracking within tolerance (acceptable)**
|
||||
- Start: LA, End: SF
|
||||
- Games: LA Jan 5, Anaheim Jan 6 (30mi south), San Jose Jan 7, SF Jan 8
|
||||
- Expected: Route includes Anaheim if time permits (minor backtrack acceptable)
|
||||
|
||||
**Case 6: Excessive backtracking rejected**
|
||||
- Start: LA, End: Seattle (north-bound)
|
||||
- Games: LA Jan 5, San Diego Jan 6 (120mi south), SF Jan 7, Seattle Jan 8
|
||||
- Expected: Excludes San Diego (excessive backtrack) OR returns failure if must include
|
||||
|
||||
**Case 7: Correct directional classification**
|
||||
- Start: Boston, End: Miami (north to south)
|
||||
- Games: Boston Jan 5, NYC Jan 6, DC Jan 7, Miami Jan 8
|
||||
- Expected: Route follows north→south direction (Boston→NYC→DC→Miami)
|
||||
|
||||
Backtracking tolerance: Minor detours (<50mi off path) acceptable, major backtracking (>100mi) rejected.
|
||||
</behavior>
|
||||
<implementation>
|
||||
If tests fail:
|
||||
1. ScenarioCPlanner may not be validating route direction matches start→end vector
|
||||
2. GameDAGRouter may not be penalizing backtracking routes
|
||||
3. Route ranking may not prioritize directional efficiency
|
||||
4. Fix ScenarioCPlanner's directional validation and GameDAGRouter's scoring
|
||||
|
||||
Do NOT weaken test assertions - fix the code to match expected behavior.
|
||||
</implementation>
|
||||
</feature>
|
||||
|
||||
<verification>
|
||||
All tests pass:
|
||||
```bash
|
||||
xcodebuild -project SportsTime.xcodeproj -scheme SportsTime \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' \
|
||||
-only-testing:SportsTimeTests/ScenarioCPlannerTests test
|
||||
```
|
||||
|
||||
Specific tests to verify:
|
||||
- Corridor inclusion tests: 5 new tests (direct path, slightly off, far off, mixed, no games)
|
||||
- Anti-backtracking tests: 7 new tests (start city, end city, wrong order, least backtrack, tolerance, excessive, directional)
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
- 12 new tests added to ScenarioCPlannerTests.swift
|
||||
- All tests follow TDD pattern (RED → GREEN → REFACTOR)
|
||||
- Each feature produces 2-3 commits (test, feat, optional refactor)
|
||||
- No test assertions weakened
|
||||
- All existing tests continue to pass
|
||||
- Tests use existing helper patterns (makeStadium, makeGame, makeRequest)
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `.planning/phases/09-trip-planner-modes-tdd/09-03-SUMMARY.md`:
|
||||
|
||||
# Phase 09 Plan 03: Scenario C Corridor Efficiency TDD Summary
|
||||
|
||||
**[Substantive one-liner - what shipped, not "phase complete"]**
|
||||
|
||||
## Performance
|
||||
|
||||
- **Duration:** [actual time]
|
||||
- **Started:** [timestamp]
|
||||
- **Completed:** [timestamp]
|
||||
|
||||
## Accomplishments
|
||||
|
||||
### Feature 1: Travel Corridor Game Inclusion
|
||||
- **RED:** [What tests were written, expected failures]
|
||||
- **GREEN:** [What code changes made tests pass, or "tests passed on first run"]
|
||||
- **REFACTOR:** [Cleanup done, or "no refactor needed"]
|
||||
|
||||
### Feature 2: Geographic Efficiency Validation (Anti-Backtracking)
|
||||
- **RED:** [What tests were written, expected failures]
|
||||
- **GREEN:** [What code changes made tests pass, or "tests passed on first run"]
|
||||
- **REFACTOR:** [Cleanup done, or "no refactor needed"]
|
||||
|
||||
## Task Commits
|
||||
|
||||
List of commits produced (2-3 per feature):
|
||||
1. test(09-03): add travel corridor game inclusion tests
|
||||
2. feat(09-03): improve corridor calculation in ScenarioCPlanner (if needed)
|
||||
3. test(09-03): add anti-backtracking validation tests
|
||||
4. feat(09-03): add directional efficiency checks to ScenarioCPlanner (if needed)
|
||||
|
||||
## Files Created/Modified
|
||||
|
||||
- `SportsTimeTests/ScenarioCPlannerTests.swift` - Added 12 tests
|
||||
- `SportsTime/Planning/Engine/ScenarioCPlanner.swift` - [describe changes, or "no changes - tests passed"]
|
||||
|
||||
## Decisions Made
|
||||
|
||||
[Key decisions and rationale, or "None - tests validated existing behavior"]
|
||||
|
||||
## Deviations from Plan
|
||||
|
||||
### Auto-fixed Issues
|
||||
[Any blocking issues fixed during execution, or "None"]
|
||||
|
||||
### Deferred Enhancements
|
||||
[Any issues logged to ISSUES.md, or "None"]
|
||||
|
||||
## Issues Encountered
|
||||
|
||||
[Problems and resolutions, or "None"]
|
||||
|
||||
## Next Phase Readiness
|
||||
|
||||
- Scenario C corridor routing and anti-backtracking validated
|
||||
- Phase 9 complete: All three trip planner modes tested
|
||||
- Ready for Phase 10: Trip Builder Options TDD
|
||||
- No blockers
|
||||
</output>
|
||||
Reference in New Issue
Block a user