移除示例项目初始化并修复前后端稳定性问题

This commit is contained in:
Cheng Zhou
2026-03-30 15:35:22 +08:00
parent a67991740e
commit 8c5d03f1cb
24 changed files with 581 additions and 102 deletions
@@ -0,0 +1,48 @@
# Remove Demo Study Seed Implementation Plan
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
**Goal:** Stop development initialization from auto-creating any demo study or fee data.
**Architecture:** Remove the application startup hook that seeds demo fee data, while keeping schema setup and protected admin initialization intact. Add a regression test that proves the lifespan startup no longer calls the demo seed helper.
**Tech Stack:** FastAPI, pytest, unittest.mock
---
### Task 1: Lock the startup behavior with a failing test
**Files:**
- Create: `backend/tests/test_app_startup.py`
- Modify: `backend/app/main.py`
**Step 1: Write the failing test**
```python
async def test_development_startup_does_not_seed_demo_fees():
...
```
**Step 2: Run test to verify it fails**
Run: `pytest backend/tests/test_app_startup.py -q`
Expected: FAIL because startup still calls `seed_demo_fees`.
**Step 3: Write minimal implementation**
Remove the `seed_demo_fees` import and startup call from `backend/app/main.py`.
**Step 4: Run test to verify it passes**
Run: `pytest backend/tests/test_app_startup.py -q`
Expected: PASS.
### Task 2: Verify no regression in admin bootstrap
**Files:**
- Test: `backend/tests/test_protected_admin.py`
**Step 1: Run targeted regression tests**
Run: `pytest backend/tests/test_app_startup.py backend/tests/test_protected_admin.py -q`
Expected: PASS.