Skip to content

Commit eb760ab

Browse files
authored
refactor: rename persistence -> platform_store + v1 cleanup (#599 PR3/3)
## Summary Final PR (3 of 3) for #599. Renames the slim control-plane store to its real role, refreshes CLAUDE.md, and removes the last v1 stragglers. - git mv codeframe/persistence -> codeframe/platform_store; updated all 31 imports across codeframe/, tests/, scripts/, plus CI yaml + active docs (CONTRIBUTING.md, PRD.md, TESTING.md) and the embedded Python in tests/e2e/global-setup.ts (caught by codex). - CLAUDE.md: dropped stale codeframe/server/ references (Legacy rule + repo- structure tree line); refreshed tests/agents/ note now that only dependency_resolver remains. - Stragglers: removed orphan sample_project_config fixture, deleted the 5 remaining #597-era v1 tests, un-ignored and fixed tests/api/test_health_endpoint.py (live /health coverage restored), emptied root collect_ignore. - Pre-existing PR2 leftovers caught by CodeRabbit: deleted tests/blockers/test_blocker_expiration_simple.py and tests/lib/test_metrics_tracker.py (both referenced removed Database methods / dropped tables; both deselected by -m v2, so prior CI green was misleading). ## Validation - Tests: pytest -m v2 green (2824 passed); Backend + Frontend CI green - Lint/Type: ruff + mypy clean (181 files); CI Code Quality green - Collect: pytest --collect-only clean (3424); zero active references to codeframe.persistence remain - Boot: TestClient /health -> 200 - Cross-family review: codex (1 P2 fixed) + CodeRabbit (2 inline Major fixed) - claude-bot advisory: 4 minor (3 fixed, 1 partly rebutted -- the flagged "dead" Database guard in tests/ui/conftest.py is actually used by the running_server fixture; simplified to a direct import) - Demo: all 12 PR3 + 9 cumulative #599 acceptance criteria verified ## Cumulative -- #599 fully complete across PRs #602 + #603 + #604 - [x] No legacy multi-agent classes remain (PR1) - [x] core/project.py + dead dirs removed (PR1) - [x] Database exposes only control-plane methods (PR2) - [x] persistence -> platform_store rename + CLAUDE.md (PR3) - [x] codeframe serve boots (every PR) - [x] pytest --collect-only clean; pytest -m v2 green (every PR) - [x] cf --help + golden path; ruff + mypy clean (every PR) - [x] Plan engine kept (verified live via engine_registry -> BuiltinPlanAdapter) Closes #599.
1 parent fa992f3 commit eb760ab

45 files changed

Lines changed: 56 additions & 3360 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ jobs:
331331
run: |
332332
mkdir -p .codeframe
333333
source .venv/bin/activate
334-
python -c "from codeframe.persistence.database import Database; db = Database('.codeframe/state.db'); db.initialize(); db.close()"
334+
python -c "from codeframe.platform_store.database import Database; db = Database('.codeframe/state.db'); db.initialize(); db.close()"
335335
echo "✅ Database initialized"
336336
337337
- name: Start FastAPI server in background
@@ -466,7 +466,7 @@ jobs:
466466
# # E2E tests expect database at tests/e2e/.codeframe/state.db
467467
# mkdir -p tests/e2e/.codeframe
468468
# source .venv/bin/activate
469-
# python -c "from codeframe.persistence.database import Database; db = Database('tests/e2e/.codeframe/state.db'); db.initialize(); db.close()"
469+
# python -c "from codeframe.platform_store.database import Database; db = Database('tests/e2e/.codeframe/state.db'); db.initialize(); db.close()"
470470
# echo "✅ Database initialized at tests/e2e/.codeframe/state.db"
471471
#
472472
# - name: Start backend server
@@ -621,7 +621,7 @@ jobs:
621621
# run: |
622622
# mkdir -p .codeframe
623623
# source .venv/bin/activate
624-
# python -c "from codeframe.persistence.database import Database; db = Database('.codeframe/state.db'); db.initialize(); db.close()"
624+
# python -c "from codeframe.platform_store.database import Database; db = Database('.codeframe/state.db'); db.initialize(); db.close()"
625625
# echo "✅ Database initialized"
626626
#
627627
# - name: Start backend server

CLAUDE.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ Golden Path commands must work from the CLI with **no server running**. FastAPI
7474

7575
This separation prevents duplicate state transitions (e.g., DONE→DONE errors).
7676

77-
### 4) Legacy can be read, not depended on
78-
`server/` is reference only. Do NOT import legacy UI/server modules into core.
79-
80-
### 5) Keep commits runnable
77+
### 4) Keep commits runnable
8178
At all times: `codeframe --help` works, Golden Path stubs can run, no breaking renames/moves.
8279

8380
---
@@ -89,7 +86,6 @@ At all times: `codeframe --help` works, Golden Path stubs can run, no breaking r
8986
- **CLI-first**: Golden Path works **without any running FastAPI server**
9087
- **Adapters**: LLM providers in `codeframe/adapters/llm/`
9188
- **Server/UI optional**: FastAPI and UI are thin adapters over core; web UI connects via REST/WebSocket
92-
- `server/` contains v1 code retained as reference only; do not build toward v1 patterns
9389

9490
### Phase 3 Web UI (actively developed — not legacy)
9591
Next.js 16 App Router, TypeScript, Shadcn/UI, Tailwind CSS, Hugeicons, XTerm.js, WebSocket + SSE.
@@ -128,14 +124,15 @@ codeframe/
128124
│ ├── server.py, models.py, dependencies.py
129125
│ └── routers/ # 16 v2 router modules
130126
├── auth/ # API key service + auth dependencies
131-
├── lib/ # rate_limiter.py, audit_logger.py
132-
└── server/ # Legacy v1 (reference only)
127+
├── lib/ # rate_limiter.py, audit_logger.py, metrics_tracker.py
128+
└── platform_store/ # Control-plane store: auth, api keys, audit logs,
129+
# interactive sessions, token usage (slim Database + repos)
133130
134131
web-ui/ # Phase 3 Web UI (Next.js, actively developed)
135132
tests/
136133
├── core/ # Core module tests (auto-marked v2)
137134
├── adapters/ # LLM + E2B adapter tests
138-
├── agents/ # Worker agent tests
135+
├── agents/ # dependency_resolver tests
139136
├── integration/ # Cross-module integration tests
140137
├── lifecycle/ # End-to-end lifecycle tests (CLI + API + web, uses MockProvider)
141138
└── ui/ # FastAPI router tests

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ When creating new API endpoints that access project resources:
6767

6868
```python
6969
from fastapi import HTTPException, Depends
70-
from codeframe.persistence.database import Database
70+
from codeframe.platform_store.database import Database
7171
from codeframe.ui.dependencies import get_db, get_current_user, User
7272

7373
@router.get("/api/projects/{project_id}/resource")

PRD.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ High‑level architecture is defined in [`specs/CODEFRAME_SPEC.md`](specs/CODEFR
129129
- **CLI** (`codeframe/cli.py`) – project initialization, server start, session commands.
130130
- **Backend API** (`codeframe/ui/server.py`) – projects, agents, tasks, blockers, discovery, PRD, context, session.
131131
- **Agent layer** (`codeframe/agents/*`) – lead + worker agents + pool + dependency resolver.
132-
- **Persistence** (`codeframe/persistence/database.py`) – all state with flattened v1.0 schema.
132+
- **Platform store** (`codeframe/platform_store/database.py`) – all state with flattened v1.0 schema.
133133
- **Context & session** (`codeframe/lib/context_manager.py`, `codeframe/core/session_manager.py`).
134134
- **Dashboard** (`web-ui/*`) – React/TypeScript UI with SWR and WebSocket integration.
135135

@@ -219,7 +219,7 @@ This section captures the **stepwise workflows**; the next section defines forma
219219

220220
2. DB keeps issues/tasks plus DAG dependencies; implementation lives in:
221221

222-
- `codeframe/persistence/database.py` methods for issues, tasks, `task_dependencies`.
222+
- `codeframe/platform_store/database.py` methods for issues, tasks, `task_dependencies`.
223223
- `tests/api/test_api_issues.py` verifies the contract.
224224

225225
3. API and UI:
@@ -264,7 +264,7 @@ This section captures the **stepwise workflows**; the next section defines forma
264264
1. When blocked, worker agents create blockers in DB:
265265

266266
- Schema and behavior in `specs/049-human-in-loop/spec.md`.
267-
- Implementation in `codeframe/persistence/database.py` and `codeframe/ui/server.py` endpoints:
267+
- Implementation in `codeframe/platform_store/database.py` and `codeframe/ui/server.py` endpoints:
268268
- `GET /api/projects/{id}/blockers`
269269
- `GET /api/blockers/{id}`
270270
- `POST /api/blockers/{id}/resolve`

TESTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
#### 2.2 Agent Creation
7171
- [ ] Use Python REPL or script:
7272
```python
73-
from codeframe.persistence.database import Database
73+
from codeframe.platform_store.database import Database
7474
db = Database("test-project/.codeframe/state.db")
7575
db.initialize()
7676
agent_id = db.create_agent("lead-1", "lead", "claude", "directive")
@@ -123,7 +123,7 @@
123123
- [ ] Test Lead Agent initialization:
124124
```python
125125
from codeframe.agents.lead_agent import LeadAgent
126-
from codeframe.persistence.database import Database
126+
from codeframe.platform_store.database import Database
127127

128128
db = Database("test-project/.codeframe/state.db")
129129
db.initialize()
@@ -190,7 +190,7 @@
190190
- [ ] Test agent lifecycle:
191191
```python
192192
from codeframe.agents.lead_agent import LeadAgent
193-
from codeframe.persistence.database import Database
193+
from codeframe.platform_store.database import Database
194194
from codeframe.core.models import AgentMaturity
195195

196196
db = Database("test-project/.codeframe/state.db")

codeframe/auth/api_key_router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
SCOPE_WRITE,
2424
)
2525
from codeframe.core.api_key_service import ApiKeyService
26-
from codeframe.persistence.database import Database
26+
from codeframe.platform_store.database import Database
2727

2828
logger = logging.getLogger(__name__)
2929

codeframe/auth/dependencies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ async def get_api_key_auth(
183183
# Fallback: create database connection
184184
logger.warning("No db in app.state, creating fallback connection for API key auth")
185185
import os
186-
from codeframe.persistence.database import Database
186+
from codeframe.platform_store.database import Database
187187

188188
db_path = os.getenv(
189189
"DATABASE_PATH",

codeframe/cli/auth_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
CredentialSource,
4242
)
4343
from codeframe.core.api_key_service import ApiKeyService
44-
from codeframe.persistence.database import Database
44+
from codeframe.platform_store.database import Database
4545

4646
logger = logging.getLogger(__name__)
4747

codeframe/cli/stats_commands.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def _get_db():
4545
Raises:
4646
typer.Exit: If no workspace is found.
4747
"""
48-
from codeframe.persistence.database import Database
48+
from codeframe.platform_store.database import Database
4949

5050
db_path = Path(".codeframe/state.db")
5151
if not db_path.exists():

codeframe/core/api_key_service.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
SCOPE_READ,
1616
SCOPE_WRITE,
1717
)
18-
from codeframe.persistence.database import Database
18+
from codeframe.platform_store.database import Database
1919

2020
logger = logging.getLogger(__name__)
2121

0 commit comments

Comments
 (0)