←
APC-39
Created: 2026-01-03
•
Updated: 2026-01-03
Relationships
Loading...
Attachments
Loading...
Comments (3)
qa-agent
·
2026-01-03
[QA] ✅ VERIFIED - All tests pass (68 backend, 106 frontend), migration successful, production build clean. Implementation exceeds requirements by using database-backed config instead of YAML. No issues found. See /tmp/qa-APC-39.md for detailed report.
agent
·
2026-01-03
## Implementation Complete
### Changes Made
1. **Backend - Added device_type field**
- Added `device_type` field to Device model in `app/db/models.py:82` with default "server"
- Updated API schemas in `app/api/schemas.py:109-113` with pattern validation for valid types
- Added device_type handling in `app/api/config_router.py:227` for create and update operations
- Created alembic migration `a1b2c3d4e5f6_add_device_type_column_to_devices.py`
2. **Frontend - API-based device configuration**
- Added `DeviceType` type and `DeviceWithOutlets` interface in `frontend/src/lib/api.ts:39,373`
- Added `getDevicesWithOutlets()` method that combines device data with outlet mappings
- Added `getUnassignedOutletIds()` helper function
- Updated `device-quick-controls.tsx` to fetch devices from API
- Updated `rack-view.tsx` to fetch devices from API
- Updated `device-control-modal.tsx` to use new types
- Removed static `frontend/src/lib/devices.ts` configuration file
3. **Testing**
- Updated `rack-view.test.tsx` to mock the new API methods
- All 106 frontend tests pass
- All 68 config API backend tests pass
- Frontend builds successfully with no TypeScript errors
### Verification
- `npm run test` passes (106 tests)
- `npm run build` succeeds
- `python -m pytest tests/test_config_api.py` passes (68 tests)
### Notes
- Existing devices in the database will get the default device_type "server"
- Device types are validated: "server", "network", "storage", or "other"
- The frontend now dynamically loads device configuration from the backend API
triage-agent
·
2026-01-03
## Feature Triage Complete
**Status:** PARTIALLY IMPLEMENTED (via different approach)
### Summary
The project already has a **database-backed device configuration system** with full CRUD API at `/api/devices`, `/api/rack`, and `/api/devices/{id}/outlets`. This provides MORE functionality than YAML would offer (runtime editing, persistence, validation).
However, two frontend components still use the legacy static TypeScript configuration (`devices.ts`):
- `device-quick-controls.tsx`
- `rack-view.tsx`
### Recommended Approach
Instead of adding YAML, complete the database migration by updating these legacy components to fetch from the existing API (matching the pattern in `rack-diagram-section.tsx`).
**Complexity:** LOW - Pattern already exists, just needs replication.
### Decision Point
Clarify with user:
1. **Option A (Recommended):** Complete database migration - remove `devices.ts`, update legacy components to use API
2. **Option B:** Add YAML seed file that syncs to database on startup for version-controlled config
See attached triage report (doc ed7cf23e) for full analysis.