Problem
The checkpoint creation endpoint POST /api/projects/{id}/checkpoints is ignoring the project_id parameter and creating all checkpoints with hardcoded project_id=2, causing E2E test failures.
Evidence
Test Database Analysis
All 99 checkpoints in test database have project_id=2, but tests expect project_id=1.
Project in database: ID=1, name='e2e-test-project'
Checkpoints: 0 for project_id=1, 99 for project_id=2 (WRONG!)
Frontend Code (Correct)
File: tests/e2e/global-setup.ts:609
Frontend correctly sends project_id=1 in both URL path and request body.
Backend Behavior (Bug)
Despite receiving project_id=1, backend creates checkpoints with project_id=2.
Impact
Blocks 8/12 E2E test failures (checkpoint UI tests)
Tests query /api/projects/1/checkpoints expecting seeded checkpoint data, but database has 0 checkpoints for project_id=1.
Expected Fix
Ensure checkpoint creation uses project_id from URL parameter, not from request body or hardcoded value.
Test Verification
After fix:
- Clear test database: rm tests/e2e/.codeframe/state.db
- Run E2E tests: cd tests/e2e && npm run test:smoke
- Verify: python3 -c "import sqlite3; conn = sqlite3.connect('tests/e2e/.codeframe/state.db'); cursor = conn.cursor(); cursor.execute('SELECT project_id, COUNT(*) FROM checkpoints GROUP BY project_id'); print(cursor.fetchall())"
Expected: [(1, 3)] - 3 checkpoints for project_id=1
Current: [(2, 99)] - All checkpoints wrongly assigned to project_id=2
Acceptance Criteria
- Checkpoint creation endpoint uses project_id from URL parameter
- Test database seeding creates checkpoints with correct project_id
- Query for project_id=1 returns 3 checkpoints
- E2E checkpoint tests pass (8 tests in test_checkpoint_ui.spec.ts)
Related Issues
Files to Check
- codeframe/ui/server.py - Checkpoint POST endpoint
- codeframe/persistence/database.py - save_checkpoint() method
- tests/e2e/global-setup.ts:536-631 - Checkpoint seeding logic
Problem
The checkpoint creation endpoint POST /api/projects/{id}/checkpoints is ignoring the project_id parameter and creating all checkpoints with hardcoded project_id=2, causing E2E test failures.
Evidence
Test Database Analysis
All 99 checkpoints in test database have project_id=2, but tests expect project_id=1.
Project in database: ID=1, name='e2e-test-project'
Checkpoints: 0 for project_id=1, 99 for project_id=2 (WRONG!)
Frontend Code (Correct)
File: tests/e2e/global-setup.ts:609
Frontend correctly sends project_id=1 in both URL path and request body.
Backend Behavior (Bug)
Despite receiving project_id=1, backend creates checkpoints with project_id=2.
Impact
Blocks 8/12 E2E test failures (checkpoint UI tests)
Tests query /api/projects/1/checkpoints expecting seeded checkpoint data, but database has 0 checkpoints for project_id=1.
Expected Fix
Ensure checkpoint creation uses project_id from URL parameter, not from request body or hardcoded value.
Test Verification
After fix:
Expected: [(1, 3)] - 3 checkpoints for project_id=1
Current: [(2, 99)] - All checkpoints wrongly assigned to project_id=2
Acceptance Criteria
Related Issues
Files to Check