@@ -14,14 +14,15 @@ As a maintainer, I want a DB model with a unique checksum index and exercise_che
1414## Tasks / Subtasks
1515
1616- [x] Implement SQLModel models: Exercise, ExerciseChecksumHistory (AC: 1)
17- - [ ] Add unique index on (checksum, checksum_algorithm)
18- - [ ] Create migration to add exercise_checksum_history table
19- - [ ] Implement DB upsert logic for apply (AC: 2)
20- - [ ] On checksum match and different file_path → update existing record and append history row
21- - [ ] Ensure transactional semantics and tests for rollback on error
22- - [ ] Add tests and fixtures (in-memory SQLite) to validate schema and upsert behavior
23- - [ ] Unit tests for model definitions and index existence
24- - [ ] Integration test for apply flow that appends to history
17+ - [x] Add unique index on (checksum, checksum_algorithm)
18+ - [x] Create migration to add exercise_checksum_history table
19+ - [x] Implement DB upsert logic for apply (AC: 2)
20+ - [x] On checksum match and different file_path → update existing record and append history row
21+ - [x] Ensure transactional semantics and tests for rollback on error
22+ - [x] Add tests and fixtures (in-memory SQLite) to validate schema and upsert behavior
23+ - [x] Unit tests for model definitions and index existence
24+ - [x] Integration test for apply flow that appends to history
25+
2526
2627## Dev Notes
2728
@@ -68,9 +69,20 @@ Amelia (dev agent)
6869### Completion Notes List
6970
7071- ✅ Ultimate context engine analysis completed - comprehensive developer guide created
72+ - ✅ Implemented SQLModel models and composite unique index
73+ - ✅ Implemented transactional upsert logic with history append
74+ - ✅ Added unit and integration tests; all tests passing locally (11/11)
7175
7276### File List
7377
78+ - src/to_exercises/models.py
79+ - src/to_exercises/crud.py
80+ - src/to_exercises/database.py
81+ - src/to_exercises/db_migrations/0001_create_exercise_tables.sql
82+ - tests/test_db_schema.py
83+ - tests/test_apply_upsert.py
84+ - tests/test_apply_upsert_transactional.py
85+ - tests/test_api.py
7486- docs/sprint-artifacts/1-2-db-schema-checksum-uniqueness.md
7587- docs/sprint-artifacts/sprint-status.yaml
7688
0 commit comments