docs(02): create phase 2 constraint validation plans
Phase 2: Constraint Validation - 2 plans in 1 wave (parallel) - Both plans autonomous (no checkpoints) Plan 02-01: Migrate 13 XCTest tests to Swift Testing Plan 02-02: Add edge case tests and document constraint API Note: ItineraryConstraints is already fully implemented. This phase verifies and standardizes tests. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
189
.planning/phases/02-constraint-validation/02-01-PLAN.md
Normal file
189
.planning/phases/02-constraint-validation/02-01-PLAN.md
Normal file
@@ -0,0 +1,189 @@
|
||||
---
|
||||
phase: 02-constraint-validation
|
||||
plan: 01
|
||||
type: execute
|
||||
wave: 1
|
||||
depends_on: []
|
||||
files_modified:
|
||||
- SportsTimeTests/ItineraryConstraintsTests.swift
|
||||
autonomous: true
|
||||
user_setup: []
|
||||
|
||||
must_haves:
|
||||
truths:
|
||||
- "All CONS-01 through CONS-04 requirements have corresponding passing tests"
|
||||
- "Tests use Swift Testing framework (@Test, @Suite) matching Phase 1 patterns"
|
||||
- "ItineraryConstraints API is fully tested with no coverage gaps"
|
||||
artifacts:
|
||||
- path: "SportsTimeTests/Domain/ItineraryConstraintsTests.swift"
|
||||
provides: "Migrated constraint validation tests"
|
||||
contains: "@Suite"
|
||||
min_lines: 200
|
||||
key_links:
|
||||
- from: "SportsTimeTests/Domain/ItineraryConstraintsTests.swift"
|
||||
to: "SportsTime/Core/Models/Domain/ItineraryConstraints.swift"
|
||||
via: "import @testable SportsTime"
|
||||
pattern: "@testable import SportsTime"
|
||||
---
|
||||
|
||||
<objective>
|
||||
Migrate the 13 existing XCTest constraint tests to Swift Testing and move them to the Domain test folder.
|
||||
|
||||
Purpose: Standardize test patterns across the project. Phase 1 established Swift Testing as the project standard; constraint tests should follow.
|
||||
Output: `SportsTimeTests/Domain/ItineraryConstraintsTests.swift` with all tests passing using @Test/@Suite syntax.
|
||||
</objective>
|
||||
|
||||
<execution_context>
|
||||
@~/.claude/get-shit-done/workflows/execute-plan.md
|
||||
@~/.claude/get-shit-done/templates/summary.md
|
||||
</execution_context>
|
||||
|
||||
<context>
|
||||
@.planning/PROJECT.md
|
||||
@.planning/ROADMAP.md
|
||||
@.planning/STATE.md
|
||||
@.planning/phases/02-constraint-validation/02-RESEARCH.md
|
||||
|
||||
# Pattern reference from Phase 1
|
||||
@SportsTimeTests/Domain/SortOrderProviderTests.swift
|
||||
@SportsTimeTests/Domain/SemanticPositionPersistenceTests.swift
|
||||
|
||||
# Source test file to migrate
|
||||
@SportsTimeTests/ItineraryConstraintsTests.swift
|
||||
|
||||
# Implementation being tested
|
||||
@SportsTime/Core/Models/Domain/ItineraryConstraints.swift
|
||||
</context>
|
||||
|
||||
<tasks>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 1: Verify requirements coverage in existing tests</name>
|
||||
<files>SportsTimeTests/ItineraryConstraintsTests.swift</files>
|
||||
<action>
|
||||
Read the existing 13 XCTest tests and map them to requirements:
|
||||
|
||||
| Requirement | Test(s) | Coverage |
|
||||
|-------------|---------|----------|
|
||||
| CONS-01 (games cannot move) | test_gameItem_cannotBeMoved | Verify complete |
|
||||
| CONS-02 (travel day range) | test_travel_validDayRange_simpleCase, test_travel_cannotGoOutsideValidDayRange | Verify complete |
|
||||
| CONS-03 (travel sortOrder on game days) | test_travel_mustBeAfterDepartureGames, test_travel_mustBeBeforeArrivalGames, test_travel_mustBeAfterAllDepartureGamesOnSameDay, test_travel_mustBeBeforeAllArrivalGamesOnSameDay, test_travel_canBeAnywhereOnRestDays | Verify complete |
|
||||
| CONS-04 (custom no constraints) | test_customItem_canGoOnAnyDay, test_customItem_canGoBeforeOrAfterGames | Verify complete |
|
||||
|
||||
Document any gaps found. If all requirements are covered, proceed to migration.
|
||||
</action>
|
||||
<verify>Requirements coverage table is complete with no gaps</verify>
|
||||
<done>All CONS-01 through CONS-04 requirements map to at least one existing test</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 2: Migrate tests to Swift Testing</name>
|
||||
<files>SportsTimeTests/Domain/ItineraryConstraintsTests.swift, SportsTimeTests/ItineraryConstraintsTests.swift</files>
|
||||
<action>
|
||||
1. Create new file at `SportsTimeTests/Domain/ItineraryConstraintsTests.swift`
|
||||
|
||||
2. Convert XCTest syntax to Swift Testing:
|
||||
- `final class ItineraryConstraintsTests: XCTestCase` -> `@Suite("ItineraryConstraints") struct ItineraryConstraintsTests`
|
||||
- `func test_*()` -> `@Test("description") func *()` (preserve test names, add descriptive strings)
|
||||
- `XCTAssertTrue(x)` -> `#expect(x == true)` or `#expect(x)`
|
||||
- `XCTAssertFalse(x)` -> `#expect(x == false)` or `#expect(!x)`
|
||||
- `XCTAssertEqual(a, b)` -> `#expect(a == b)`
|
||||
- `XCTAssertNil(x)` -> `#expect(x == nil)`
|
||||
- `import XCTest` -> `import Testing`
|
||||
|
||||
3. Organize tests into logical groups using MARK comments:
|
||||
- `// MARK: - Custom Item Tests (CONS-04)`
|
||||
- `// MARK: - Travel Day Range Tests (CONS-02)`
|
||||
- `// MARK: - Travel SortOrder Tests (CONS-03)`
|
||||
- `// MARK: - Game Immutability Tests (CONS-01)`
|
||||
- `// MARK: - Edge Cases`
|
||||
- `// MARK: - Barrier Games`
|
||||
- `// MARK: - Helpers`
|
||||
|
||||
4. Preserve all helper methods (makeConstraints, makeGameItem, makeTravelItem, makeCustomItem)
|
||||
|
||||
5. Delete the old file at `SportsTimeTests/ItineraryConstraintsTests.swift`
|
||||
|
||||
Pattern reference - follow SortOrderProviderTests.swift style:
|
||||
```swift
|
||||
import Testing
|
||||
import Foundation
|
||||
@testable import SportsTime
|
||||
|
||||
@Suite("ItineraryConstraints")
|
||||
struct ItineraryConstraintsTests {
|
||||
|
||||
// MARK: - Custom Item Tests (CONS-04)
|
||||
|
||||
@Test("custom: can go on any day")
|
||||
func custom_canGoOnAnyDay() {
|
||||
let constraints = makeConstraints(tripDays: 5, gameDays: [1, 5])
|
||||
let customItem = makeCustomItem(day: 1, sortOrder: 50)
|
||||
|
||||
for day in 1...5 {
|
||||
#expect(constraints.isValidPosition(for: customItem, day: day, sortOrder: 50))
|
||||
}
|
||||
}
|
||||
// ...
|
||||
}
|
||||
```
|
||||
</action>
|
||||
<verify>
|
||||
Run tests:
|
||||
```
|
||||
xcodebuild -project SportsTime.xcodeproj -scheme SportsTime -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' -only-testing:SportsTimeTests/ItineraryConstraintsTests test 2>&1 | grep -E "(Test Suite|Executed|passed|failed)"
|
||||
```
|
||||
All 13 tests pass.
|
||||
</verify>
|
||||
<done>New file at Domain/ItineraryConstraintsTests.swift passes all 13 tests, old file deleted</done>
|
||||
</task>
|
||||
|
||||
<task type="auto">
|
||||
<name>Task 3: Run full test suite and commit</name>
|
||||
<files>None (verification only)</files>
|
||||
<action>
|
||||
1. Run full test suite to verify no regressions:
|
||||
```
|
||||
xcodebuild -project SportsTime.xcodeproj -scheme SportsTime -destination 'platform=iOS Simulator,name=iPhone 17,OS=26.2' test 2>&1 | grep -E "(Test Suite|Executed|passed|failed)"
|
||||
```
|
||||
|
||||
2. Commit the migration:
|
||||
```
|
||||
git add SportsTimeTests/Domain/ItineraryConstraintsTests.swift
|
||||
git rm SportsTimeTests/ItineraryConstraintsTests.swift
|
||||
git commit -m "test(02-01): migrate ItineraryConstraints tests to Swift Testing
|
||||
|
||||
Migrate 13 XCTest tests to Swift Testing framework:
|
||||
- Move to Domain/ folder to match project structure
|
||||
- Convert XCTestCase to @Suite/@Test syntax
|
||||
- Update assertions to #expect macros
|
||||
- Verify all CONS-01 through CONS-04 requirements covered
|
||||
|
||||
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
|
||||
```
|
||||
</action>
|
||||
<verify>Full test suite passes with no regressions</verify>
|
||||
<done>Migration committed, all tests pass including existing 34 Phase 1 tests</done>
|
||||
</task>
|
||||
|
||||
</tasks>
|
||||
|
||||
<verification>
|
||||
After all tasks:
|
||||
1. `SportsTimeTests/Domain/ItineraryConstraintsTests.swift` exists with @Suite/@Test syntax
|
||||
2. Old `SportsTimeTests/ItineraryConstraintsTests.swift` is deleted
|
||||
3. All 13 constraint tests pass
|
||||
4. Full test suite passes (no regressions)
|
||||
5. Tests organized by requirement (CONS-01 through CONS-04)
|
||||
</verification>
|
||||
|
||||
<success_criteria>
|
||||
- 13 tests migrated from XCTest to Swift Testing
|
||||
- Tests use @Test/@Suite syntax matching Phase 1 patterns
|
||||
- All CONS-01 through CONS-04 requirements have corresponding tests
|
||||
- Full test suite passes
|
||||
</success_criteria>
|
||||
|
||||
<output>
|
||||
After completion, create `.planning/phases/02-constraint-validation/02-01-SUMMARY.md`
|
||||
</output>
|
||||
Reference in New Issue
Block a user