# 🏗️ Progress Tracker: Core Query Optimization

**Status**: 🔄 IN PROGRESS
**Branch**: `core_query_optimization`
**Owner**: @bug-inspector

## 1. Context & Objectives 🎯

### Overview
Resolve performance bottlenecks (N+1 queries) and architectural bugs identified in the `core_query_optimization` branch before merging to staging.

## 2. Progress Log 📝

| ID | Phase | Task / Bug | Status | Notes |
|----|-------|------------|--------|-------|
| 01 | **Fix** | **Cache Race Condition** | ✅ Done | Wrapped `invalidateKanbanCache` inside `DB::afterCommit(...)` for `ProjectTask` and `Subtask` models to prevent cache purges before transaction commits. |
| 02 | **Fix** | **ProjectObserver Cache Race Condition** | ✅ Done | Added `public $afterCommit = true;` to `ProjectObserver` to prevent cache purges before transaction commits. Regression test added. |

## 3. Final Status ✅

*   **Tests**: 
    *   38/38 Kanban Suite PASS.
    *   1/1 ProjectObserver Regression Test PASS.
*   **PHPStan level 5**: No errors.
*   **Total bugs resolved**: 2/2.
*   **Pending commit**: `fix(ProjectObserver): add afterCommit to prevent cache race condition`
