diff --git a/.planning/phases/01-semantic-position-model/01-01-PLAN.md b/.planning/phases/01-semantic-position-model/01-01-PLAN.md index 863af5b..f16261d 100644 --- a/.planning/phases/01-semantic-position-model/01-01-PLAN.md +++ b/.planning/phases/01-semantic-position-model/01-01-PLAN.md @@ -11,9 +11,9 @@ autonomous: true must_haves: truths: - - "Games get sortOrder derived from game time (minutes since midnight + offset)" - - "Inserting between two items produces midpoint sortOrder" - - "Day number can be calculated from any date given trip start date" + - "Games sort by schedule time within each day" + - "Items can be inserted at any position (before, between, after existing items)" + - "Items can be assigned to any trip day by date calculation" artifacts: - path: "SportsTime/Core/Models/Domain/SortOrderProvider.swift" provides: "sortOrder calculation utilities" @@ -21,11 +21,7 @@ must_haves: - path: "SportsTime/Core/Models/Domain/Trip.swift" provides: "Day derivation methods" contains: "func dayNumber(for date: Date) -> Int" - key_links: - - from: "SortOrderProvider" - to: "ItineraryItem.sortOrder" - via: "Utilities compute values assigned to sortOrder property" - pattern: "sortOrder.*=.*SortOrderProvider" + key_links: [] --- diff --git a/.planning/phases/01-semantic-position-model/01-02-PLAN.md b/.planning/phases/01-semantic-position-model/01-02-PLAN.md index b972b48..410b11a 100644 --- a/.planning/phases/01-semantic-position-model/01-02-PLAN.md +++ b/.planning/phases/01-semantic-position-model/01-02-PLAN.md @@ -15,6 +15,7 @@ must_haves: - "Moving travel segment to different day updates its day property" - "Inserting between two items gets sortOrder between their values (e.g., 1.0 and 2.0 -> 1.5)" - "Games remain fixed at their schedule-determined positions" + - "Custom items can be placed at any sortOrder value (negative, zero, positive)" artifacts: - path: "SportsTimeTests/SortOrderProviderTests.swift" provides: "Unit tests for SortOrderProvider" @@ -115,7 +116,7 @@ xcodebuild -project SportsTime.xcodeproj -scheme SportsTime -destination 'platfo Create a new test file `SemanticPositionPersistenceTests.swift` with integration tests for semantic position persistence. -These tests verify PERS-01, PERS-02, PERS-03 requirements. +These tests verify PERS-01, PERS-02, PERS-03, and DATA-04 requirements. Test cases to include: @@ -137,7 +138,10 @@ Test cases to include: **Game immutability (DATA-03):** - `test_gameItem_sortOrderDerivedFromTime`: Create game item for 7pm game, verify sortOrder is ~1240.0 (100 + 19*60) -Use in-memory SwiftData ModelContainer for tests: +**Custom item flexibility (DATA-04):** +- `test_customItem_canBePlacedAtAnyPosition`: Create custom items with sortOrder values at negative (-5.0, before all games), between games (500.0), and after all games (2000.0). Verify all three persist correctly and can coexist on the same day sorted correctly. + +Use in-memory SwiftData ModelContainer for tests. Note: LocalItineraryItem is standalone with no relationships - it can be registered alone: ```swift let config = ModelConfiguration(isStoredInMemoryOnly: true) let container = try ModelContainer(for: LocalItineraryItem.self, configurations: config) @@ -151,7 +155,7 @@ Tests compile and pass: xcodebuild -project SportsTime.xcodeproj -scheme SportsTime -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' -only-testing:SportsTimeTests/SemanticPositionPersistenceTests test 2>&1 | grep -E "(Test Case|passed|failed)" ``` - SemanticPositionPersistenceTests.swift exists with 8+ test cases, all tests pass + SemanticPositionPersistenceTests.swift exists with 9+ test cases, all tests pass @@ -178,17 +182,18 @@ Look for "** TEST SUCCEEDED **" at the end. 1. SortOrderProviderTests.swift exists with 16+ test methods covering all SortOrderProvider functions -2. SemanticPositionPersistenceTests.swift exists with 8+ test methods covering persistence requirements +2. SemanticPositionPersistenceTests.swift exists with 9+ test methods covering persistence requirements 3. All tests pass when run individually and as part of full suite 4. Tests verify the success criteria from ROADMAP.md Phase 1: - Position survives reload (tested via encode/decode and SwiftData) - Travel day update works (tested via day property mutation) - Midpoint insertion works (tested via 50-iteration precision test) - Games use time-based sortOrder (tested via initialSortOrder) + - Custom items can be placed anywhere (tested via negative/between/after positions) -- 24+ new test cases across 2 test files +- 25+ new test cases across 2 test files - All tests pass - Tests directly verify Phase 1 requirements DATA-01 through DATA-05 and PERS-01 through PERS-03 - No regression in existing tests