←
APC-32
Created: 2025-12-22
•
Updated: 2025-12-23
Relationships
Loading...
Attachments
Loading...
Comments (5)
agent
·
2025-12-23
## Implementation Complete
### Changes Made
**Repository Configuration Files:**
- .env.example: Replaced API_KEY with new auth env vars (ADMIN_USER, ADMIN_PASSWORD, SESSION_EXPIRY_DAYS)
- docker-compose.yml: Updated backend environment to pass auth vars instead of API_KEY
- frontend/.env.example: Removed NEXT_PUBLIC_API_KEY reference
**Frontend Code Fixes:**
- frontend/Dockerfile: Changed default NEXT_PUBLIC_API_URL to empty string (relative URLs)
- frontend/src/lib/api.ts: Changed to use ?? so empty string works for production
- frontend/src/contexts/auth-context.tsx: Same fix for auth context API calls
- frontend/src/components/rack-diagram-section.tsx: Updated to use Bearer token auth
- frontend/src/app/settings/page.tsx: Updated to show session-based auth
**Production Deployment:**
- ~/setup/apc/.env: Added auth vars, removed API_KEY
- ~/setup/apc/docker-compose.yml: Removed NEXT_PUBLIC_API_KEY build arg
- ~/setup/apc/README.md: Updated documentation with auth section
- /etc/caddy/apc.caddy: Added /auth/* route
### Verification
- All 272 pytest tests pass
- Backend creates admin user on startup
- Web QA verified login flow works end-to-end
- Dashboard loads after authentication
qa-agent
·
2025-12-23
## QA PASSED
See QA report document: 0d0e7599-3709-4a65-9491-c5390f455701
**All hypotheses tested - authentication flow verified working:**
1. Unauthenticated users redirected to /login - PASS
2. Login form renders correctly - PASS
3. No network errors (localhost:8000 issue resolved) - PASS
4. Credentials accepted, login successful - PASS
5. Dashboard loads with full content after login - PASS
**Screenshots captured:**
- /tmp/APC-32-step1-initial.png (login redirect)
- /tmp/APC-32-step3-filled-form.png (credentials entered)
- /tmp/APC-32-step5-dashboard.png (dashboard after login)
The fix for the frontend API URL configuration is verified. End-to-end authentication works on https://apc.roboalch.com
qa-agent
·
2025-12-23
## QA FAILED
See QA report document: 948f7c6c-c76d-4ace-8086-c62f7caa11d6
**Critical Issue Found:** Frontend is configured to make API requests to `http://localhost:8000` instead of the production backend.
**Evidence:**
- Network request: `POST http://localhost:8000/auth/login` -> `net::ERR_CONNECTION_REFUSED`
- Error displayed: "Failed to fetch"
**Root Cause:**
Production `~/setup/apc/docker-compose.yml` has empty `NEXT_PUBLIC_API_URL=` build arg, causing frontend to fall back to default localhost URL.
**Backend is working correctly** - direct curl to `https://apc.roboalch.com/auth/login` returns valid auth token.
**Required Fix:**
1. Set `NEXT_PUBLIC_API_URL=https://apc.roboalch.com` in ~/setup/apc/docker-compose.yml build args
2. Rebuild frontend: `docker compose build --no-cache frontend`
3. Restart: `docker compose up -d frontend`
Returning to in-progress for configuration fix.
triage-agent
·
2025-12-23
## Feature Triage Re-assessed (2025-12-23)
**Status:** PARTIALLY IMPLEMENTED - Ready for implementation
**Progress Since Last Triage:**
- ✅ `app/main.py` now correctly calls `create_user_from_env()` during lifespan startup
- ❌ All configuration/deployment files still reference legacy API_KEY
**Remaining Work (Configuration Only - No Code Changes):**
| File | Action Required |
|------|-----------------|
| `.env.example` | Replace API_KEY with ADMIN_USER, ADMIN_PASSWORD, SESSION_EXPIRY_DAYS |
| `docker-compose.yml` | Update backend env vars, remove API_KEY |
| `frontend/.env.example` | Remove NEXT_PUBLIC_API_KEY reference |
| `~/setup/apc/.env` | Replace API_KEY with auth credentials |
| `~/setup/apc/docker-compose.yml` | Remove NEXT_PUBLIC_API_KEY from frontend build args |
| `~/setup/apc/README.md` | Document new session-based auth |
**Complexity:** LOW - Pure configuration changes, no code needed
**Auth Code Status:** 100% complete (backend + frontend)
See detailed triage report: `/tmp/triage-APC-32.md`
triage-agent
·
2025-12-23
## Feature Triage Complete
**Status:** PARTIALLY IMPLEMENTED
**Summary:** The authentication system code is fully implemented (APC-25/26/27/29), but deployment configuration has not been updated to use it. The main gap is:
1. create_user_from_env() is never called during app startup - no admin user gets created
2. Environment files still reference old API_KEY instead of new auth vars
3. Docker compose files don't pass auth env vars
4. README documents API key auth instead of session-based auth
**Implementation Location:**
- app/main.py - Add create_user_from_env() call in lifespan
- .env.example / docker-compose.yml - Update env vars
- ~/setup/apc/* - Production deployment files
- ~/setup/apc/README.md - Documentation
**Complexity:** LOW - Configuration changes only, no new feature code needed
**Critical:** The lifespan startup must call create_user_from_env() after init_db() for auth to work.
See triage report: /tmp/triage-APC-32.md