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>
228 lines
8.4 KiB
Markdown
228 lines
8.4 KiB
Markdown
---
|
|
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>
|