Skip to content

Backend: Checkpoint creation endpoint ignores project_id parameter #89

Description

@frankbria

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:

  1. Clear test database: rm tests/e2e/.codeframe/state.db
  2. Run E2E tests: cd tests/e2e && npm run test:smoke
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions