←
APLANE-14
Created: 2025-12-25
•
Updated: 2025-12-25
Relationships
Loading...
Attachments
Loading...
Comments (4)
agent
·
2025-12-25
## Fix Applied: Path Validation Bug
### Root Cause
The path validator in `backend/database/schemas.py:49` was hardcoding:
```python
allowed_base = os.path.expanduser('~/gitea')
```
Inside the Docker container, this expands to `/root/gitea`, but docker-compose mounts projects at `/projects` and sets `PROJECTS_DIRECTORY=/projects`.
### Fix Applied
Updated `backend/database/schemas.py` to import and use `PROJECTS_DIRECTORY` from config:
```python
from config import PROJECTS_DIRECTORY
# ...
allowed_base = os.path.realpath(PROJECTS_DIRECTORY)
```
### Files Changed
- `backend/database/schemas.py` - Lines 11, 50-51
### Verification
- Backend health check: ✅ 200 OK
- `/api/projects` endpoint: ✅ Returns 13 projects
- All paths use `/projects/*` format correctly
- Both containers healthy
Commit: 9df1122 (merged to master)
qa-agent
·
2025-12-25
## QA PASSED
See QA report document: b981f05e-ea42-4736-ae8c-1aadc4138628
**Test Results:**
- Backend health: OK
- /api/projects endpoint: Returns 200 OK with 13 projects
- Path validation fix: Working correctly (paths use /projects/*)
- Containers: Both aplane-backend and aplane-frontend running healthy
The path validation bug has been fixed. Projects API now works correctly with the container mount path /projects instead of the hardcoded ~/gitea.
Fix verified working.
qa-agent
·
2025-12-25
# QA Report: APLANE-14
**Issue:** Create ~/setup/aplane/ deployment directory
**Status:** FAILED ❌
**Date:** 2025-12-25
**QA Agent:** code-verification-qa
## Summary
The deployment structure was successfully created and containers are running, but there is a **critical bug** that prevents the API from functioning correctly.
## Verification Results
### ✅ PASSED - Deployment Structure
- **~/setup/aplane/** directory created with correct structure:
- `docker-compose.yml` ✓
- `.env` (mode 600) ✓
- `README.md` ✓
### ✅ PASSED - Data Directory
- **/var/aplane/data/** created successfully
- Database migrated: `/var/aplane/data/aplane.db` (86KB, 13 projects)
### ✅ PASSED - Container Naming
- Backend container: `aplane-backend` (was `agent-plane-backend`) ✓
- Frontend container: `aplane-frontend` (was `agent-plane-frontend`) ✓
- Network: `aplane` (was `agent-plane`) ✓
### ✅ PASSED - Old Structure Cleanup
- `~/setup/agent-plane/` removed ✓
- `/var/agent-plane/` removed ✓
- Old Docker images removed (only `aplane-*` images exist) ✓
### ✅ PASSED - Container Health
- Backend: Running, healthy ✓
- Frontend: Running, healthy ✓
- Backend health endpoint: `http://127.0.0.1:8096/api/health` returns status=ok ✓
- Frontend: Returns HTTP 200 on port 3096 ✓
- HTTPS: `https://aplane.roboalch.com/api/health` working ✓
### ✅ PASSED - Configuration
- `.env` file has correct permissions (600) ✓
- Caddy config at `/etc/caddy/aplane.caddy` exists ✓
- Environment variables correctly set ✓
### ❌ FAILED - API Functionality
**Critical Bug Found:**
```
GET http://127.0.0.1:8096/api/projects
Response: Internal Server Error
```
**Error from logs:**
```
pydantic_core._pydantic_core.ValidationError: 1 validation error for ProjectWithAgents
path
Value error, Path must be within /root/gitea [type=value_error, input_value='/projects/agent-plane', input_type=str]
```
**Root Cause:**
The backend schema (`backend/database/schemas.py:49`) hardcodes path validation to `~/gitea` (which expands to `/root/gitea` inside the container), but the docker-compose.yml mounts projects at `/projects`.
**Location:** `backend/database/schemas.py`, line 49:
```python
allowed_base = os.path.expanduser('~/gitea')
```
**Expected:** Should use environment variable or container path `/projects`
## Impact
**HIGH SEVERITY** - The deployment structure is correct, but the application is non-functional:
- ✅ Containers run and pass health checks
- ❌ Projects API endpoint fails with 500 error
- ❌ Frontend will not be able to load projects
- ❌ Core functionality broken
## What Works
1. Container deployment structure ✓
2. Database migration ✓
3. Health checks ✓
4. Caddy reverse proxy ✓
5. HTTPS access ✓
## What Doesn't Work
1. `/api/projects` endpoint (500 Internal Server Error)
2. Projects list in frontend (blocked by backend error)
3. Agent management (blocked by projects not loading)
## Required Fix
Update `backend/database/schemas.py` to use environment variable for projects path:
```python
# Line 49 should be:
allowed_base = os.getenv('PROJECTS_DIRECTORY', '/projects')
# Instead of:
allowed_base = os.path.expanduser('~/gitea')
```
Alternatively, update to use the mounted path directly since it's read from an environment variable at runtime.
## Test Evidence
```bash
# Health check works
$ curl http://127.0.0.1:8096/api/health
{"status":"ok","version":"1.0.0","uptime":268.35,"agents_active":0,"projects":13}
# Projects endpoint fails
$ curl http://127.0.0.1:8096/api/projects
Internal Server Error
# Container status
$ sudo docker ps --filter name=aplane
CONTAINER ID IMAGE STATUS
f2aeba96e969 aplane-frontend Up 3 minutes (healthy)
91615cfdf67d aplane-backend Up 3 minutes (healthy)
# Database has projects
$ sqlite3 /var/aplane/data/aplane.db "SELECT COUNT(*) FROM projects;"
13
```
## Recommendation
**Status:** QA FAILED - Critical bug prevents API functionality
**Action Required:**
1. Update `backend/database/schemas.py` path validation
2. Rebuild backend container
3. Re-run QA verification
**Priority:** HIGH - Application is deployed but non-functional
agent
·
2025-12-25
## Completed Migration to ~/setup/aplane/
### Changes Made:
1. **Created new deployment directory structure:**
- `~/setup/aplane/` - Configuration directory with:
- `docker-compose.yml` - Container definitions (renamed containers from agent-plane-* to aplane-*)
- `.env` - Environment configuration (mode 600)
- `README.md` - Deployment documentation
2. **Created new data directory:**
- `/var/aplane/data/` - SQLite database storage
- Migrated database from `/var/agent-plane/data/agent-plane.db` to `/var/aplane/data/aplane.db`
3. **Container updates:**
- Backend container: `aplane-backend` (was agent-plane-backend)
- Frontend container: `aplane-frontend` (was agent-plane-frontend)
- Network: `aplane` (was agent-plane)
- Database path: `/data/aplane.db` (was agent-plane.db)
4. **Cleaned up old structure:**
- Removed `~/setup/agent-plane/`
- Removed `/var/agent-plane/`
- Removed old Docker images
### Verification:
- Backend health check: `curl http://127.0.0.1:8096/api/health` returns status=ok
- Frontend: HTTP 200 on port 3096
- HTTPS via Caddy: https://aplane.roboalch.com working (Authelia protected)
- Database migrated successfully: 13 projects detected
### Service Management:
```bash
cd ~/setup/aplane
sudo docker compose ps
sudo docker compose logs -f
sudo docker compose restart
```