Files
motovaultpro/docs/redesign/FILE-MANIFEST.md
Eric Gullickson 046c66fc7d Redesign
2025-11-01 21:27:42 -05:00

479 lines
12 KiB
Markdown

# File Manifest - Complete File Change Inventory
## Summary
| Action | Count | Agent |
|--------|-------|-------|
| DELETE | 23 files + 1 directory | config-agent, backend-agent |
| MODIFY | 45 files | All agents |
| CREATE | 4 files | storage-agent |
| **TOTAL** | **72 file operations** | **8 agents** |
## Files to DELETE (23 files + 1 directory)
### Backend Files (Agent: backend-agent, Phase 2)
```
backend/src/core/middleware/tenant.ts
backend/src/core/config/tenant.ts
backend/src/features/tenant-management/ (entire directory)
├── index.ts
├── tenant.controller.ts
├── tenant.service.ts
├── tenant.routes.ts
├── tenant.types.ts
└── tests/
├── tenant.test.ts
└── fixtures/
```
### Configuration & Secrets (Agent: config-agent, Phase 4)
```
secrets/app/minio-access-key.txt
secrets/app/minio-secret-key.txt
secrets/app/platform-vehicles-api-key.txt
secrets/platform/ (entire directory)
├── postgres-password.txt
├── redis-password.txt
└── api-keys/
```
### Docker Services (Agent: infra-agent, Phase 1)
**Note:** These are removed from docker-compose.yml, not file deletions
```
Services removed:
- admin-minio
- mvp-platform-landing
- mvp-platform-tenants
- platform-postgres
- platform-redis
- mvp-platform-vehicles-db
- mvp-platform-vehicles-redis
- mvp-platform-vehicles-etl
```
---
## Files to CREATE (4 files)
### Storage Adapter (Agent: storage-agent, Phase 3)
```
backend/src/core/storage/adapters/filesystem.adapter.ts (NEW)
data/documents/.gitkeep (NEW - directory marker)
```
### Volume Mount
```
./data/documents/ (directory created by Docker)
```
---
## Files to MODIFY (45 files)
### Phase 1: Docker Compose (Agent: infra-agent)
#### docker-compose.yml
**Lines:** Entire file restructure
**Changes:**
- Rename all services: admin-* → mvp-*, mvp-platform-vehicles-api → mvp-platform
- Remove 8 service definitions
- Add volume mount: `./data/documents:/app/data/documents`
- Update network assignments (5 → 3 networks)
- Update service discovery labels
---
### Phase 2: Remove Tenant (Agent: backend-agent)
#### backend/src/app.ts
**Lines:** ~30-45, ~120-130
**Changes:**
- Remove tenant middleware import
- Remove tenant middleware registration
- Remove tenant-management feature registration
#### backend/src/core/plugins/auth.plugin.ts
**Lines:** ~55-75
**Changes:**
- Remove `https://motovaultpro.com/tenant_id` claim extraction
- Simplify JWT payload to only extract `sub` and `roles`
#### backend/src/features/vehicles/domain/vehicles.service.ts
**Lines:** Various
**Changes:**
- Remove tenant context from function signatures (if any)
- Ensure only user_id is used for data isolation
#### backend/src/features/vehicles/domain/platform-integration.service.ts
**Lines:** ~20-30, ~100-120
**Changes:**
- Remove tenant context
- Update platform client URL to use mvp-platform
#### backend/src/features/fuel-logs/*.ts
**Changes:**
- Remove tenant references (verify user_id only)
#### backend/src/features/maintenance/*.ts
**Changes:**
- Remove tenant references (verify user_id only)
#### backend/src/features/stations/*.ts
**Changes:**
- Remove tenant references (verify user_id only)
#### backend/src/features/documents/*.ts
**Changes:**
- Remove tenant references (verify user_id only)
---
### Phase 3: Filesystem Storage (Agent: storage-agent)
#### backend/src/core/storage/storage.service.ts
**Lines:** ~10-25
**Changes:**
- Update factory function to return FilesystemAdapter
- Remove MinIO configuration check
#### backend/src/features/documents/documents.controller.ts
**Lines:** ~176-269 (upload), ~271-319 (download), ~129-174 (delete)
**Changes:**
- No changes needed (uses StorageService interface)
- Verify file paths work with filesystem adapter
#### backend/src/features/documents/documents.service.ts
**Lines:** ~40-80
**Changes:**
- Update storage_key format for filesystem paths
- Add filesystem-specific error handling
---
### Phase 4: Config Cleanup (Agent: config-agent)
#### config/app/production.yml
**Lines:** Remove entire sections
**Changes:**
- Remove `platform_vehicles_api_url` (add internal: `http://mvp-platform:8000`)
- Remove `platform_vehicles_api_key`
- Remove `platform_tenants_api_url`
- Remove MinIO configuration section
- Remove tenant-specific database URLs
#### .env
**Lines:** Remove variables
**Changes:**
- Remove `PLATFORM_VEHICLES_API_KEY`
- Remove `MINIO_ENDPOINT`, `MINIO_ACCESS_KEY`, `MINIO_SECRET_KEY`
- Update `PLATFORM_VEHICLES_API_URL=http://mvp-platform:8000`
- Update `DATABASE_URL` to use mvp-postgres
- Update `REDIS_URL` to use mvp-redis
#### .env.development (if exists)
**Changes:** Same as .env
---
### Phase 5: Network Simplification (Agent: infra-agent)
#### docker-compose.yml
**Lines:** Networks section
**Changes:**
- Remove `platform` network
- Remove `egress` network
- Keep `frontend`, `backend`, `database`
- Update service network assignments
---
### Phase 6: Backend Updates (Agent: backend-agent)
#### backend/src/core/config/config-loader.ts
**Lines:** ~50-80
**Changes:**
- Update database URL to use mvp-postgres
- Update Redis URL to use mvp-redis
- Remove tenant-specific config loading
#### backend/src/features/vehicles/external/platform-vehicles/platform-vehicles.client.ts
**Lines:** ~15-25
**Changes:**
- Update base URL to http://mvp-platform:8000
- Remove API key authentication (same network)
#### backend/src/index.ts
**Changes:**
- Verify service startup with new config
---
### Phase 7: Database Updates (Agent: infra-agent)
#### backend/src/_system/migrations/
**Changes:**
- Review migrations for tenant references (should be none)
- Verify user_id isolation only
#### docker-compose.yml
**Lines:** mvp-postgres service
**Changes:**
- Verify connection string
- Add volumes_platform schema initialization (if needed)
---
### Phase 8: Platform Service (Agent: platform-agent)
#### mvp-platform-services/vehicles/
**Entire service restructure:**
**mvp-platform-services/vehicles/Dockerfile**
- Remove MSSQL dependencies
- Simplify to single-container deployment
**mvp-platform-services/vehicles/main.py**
- Update database connection to use mvp-postgres
- Update cache connection to use mvp-redis
- Remove ETL imports and endpoints
**mvp-platform-services/vehicles/config.py**
- Update DATABASE_URL
- Update REDIS_URL
**mvp-platform-services/vehicles/requirements.txt**
- Remove MSSQL drivers (pymssql, pyodbc)
- Keep PostgreSQL (psycopg2)
---
### Phase 9: Documentation (Agent: docs-agent)
#### README.md
**Lines:** ~1-30
**Changes:**
- Update architecture description (14 → 6 containers)
- Update service names (admin-* → mvp-*)
- Update quick start instructions
#### CLAUDE.md
**Lines:** Various
**Changes:**
- Remove multi-tenant architecture guidance
- Remove platform service development instructions
- Update container names in examples
#### AI-INDEX.md
**Lines:** ~3-24
**Changes:**
- Update architecture description
- Remove platform services section
- Update URLs and container names
#### .ai/context.json
**Lines:** Entire file
**Changes:**
- Update architecture metadata (hybrid → simplified)
- Update service list (14 → 6)
- Remove tenant-management feature
- Update platform service description
#### docs/PLATFORM-SERVICES.md
**Lines:** Entire file restructure
**Changes:**
- Document single mvp-platform service
- Remove tenant service documentation
- Remove landing service documentation
- Update architecture diagrams
#### docs/TESTING.md
**Lines:** ~24-60
**Changes:**
- Update container names (admin-* → mvp-*)
- Remove platform service test setup
- Update integration test patterns
#### docs/DATABASE-SCHEMA.md
**Changes:**
- Verify no tenant references
- Document vehicles_platform schema (if added)
#### Makefile
**Lines:** All commands
**Changes:**
```diff
- docker compose exec admin-backend
+ docker compose exec mvp-backend
- docker compose exec admin-frontend
+ docker compose exec mvp-frontend
- docker compose exec admin-postgres
+ docker compose exec mvp-postgres
```
#### backend/src/features/*/README.md (5 files)
**Changes:**
- Update container names in examples
- Remove tenant context from feature descriptions
- Update testing instructions
---
### Phase 10: Frontend Updates (Agent: frontend-agent)
#### frontend/src/App.tsx
**Changes:**
- Remove tenant selection UI (if exists)
- Remove tenant context provider (if exists)
#### frontend/src/core/auth/
**Changes:**
- Update Auth0 integration
- Remove tenant_id claim extraction
- Verify user authentication still works
#### frontend/src/core/api/
**Changes:**
- Remove tenant management API client (if exists)
- Update API base URLs (if hardcoded)
#### frontend/src/features/*/
**Changes:**
- Remove any tenant-related components
- Verify API calls work with new backend
---
### Phase 11: Testing (Agent: test-agent)
#### backend/src/features/*/tests/
**Changes:**
- Update container name references in test helpers
- Remove tenant context from test fixtures
- Update integration tests
#### frontend/src/features/*/tests/
**Changes:**
- Update component tests
- Remove tenant-related test cases
---
## File Conflict Resolution
### Potential Conflicts
| File | Agents | Resolution |
|------|--------|------------|
| docker-compose.yml | infra-agent (Phases 1, 5) | Sequential phases - no conflict |
| backend/src/app.ts | backend-agent (Phases 2, 6) | Sequential phases - no conflict |
| config/app/production.yml | config-agent (Phase 4) | Single agent - no conflict |
| Makefile | docs-agent (Phase 9) | Single agent - no conflict |
**No actual conflicts** - All multi-phase modifications are by same agent in sequence.
### Lock File Locations
If conflicts arise (they shouldn't), lock files would be created in:
```
docs/redesign/locks/
├── docker-compose.yml.lock
├── app.ts.lock
├── production.yml.lock
└── Makefile.lock
```
## File Change Statistics
### By Agent
| Agent | DELETE | MODIFY | CREATE | Total |
|-------|--------|--------|--------|-------|
| config-agent | 6 files | 3 files | 0 | 9 |
| backend-agent | 7 files + 1 dir | 12 files | 0 | 19 |
| storage-agent | 0 | 3 files | 2 files | 5 |
| infra-agent | 0 (service removal) | 8 files | 0 | 8 |
| platform-agent | 0 | 6 files | 0 | 6 |
| docs-agent | 0 | 10 files | 0 | 10 |
| frontend-agent | 0 | 8 files | 0 | 8 |
| test-agent | 0 | 7 files | 0 | 7 |
| **TOTAL** | **13 + 1 dir** | **57** | **2** | **72** |
### By File Type
| Type | DELETE | MODIFY | CREATE |
|------|--------|--------|--------|
| .ts/.tsx | 7 | 35 | 2 |
| .yml/.yaml | 0 | 2 | 0 |
| .md | 0 | 10 | 0 |
| .json | 0 | 1 | 0 |
| .txt (secrets) | 6 | 0 | 0 |
| .py | 0 | 6 | 0 |
| Makefile | 0 | 1 | 0 |
| .env | 0 | 2 | 0 |
## Version Control Strategy
### Branch Strategy
```bash
# Main branch
git checkout main
# Create feature branch
git checkout -b simplify-architecture
# Each agent works on sub-branch
git checkout -b simplify/phase-1
git checkout -b simplify/phase-2
...
# Merge phases sequentially
# Or merge all at once after validation
```
### Commit Strategy
**Option A: Per-Phase Commits**
```
git commit -m "Phase 1: Rename containers and update docker-compose"
git commit -m "Phase 2: Remove multi-tenant architecture"
...
```
**Option B: Per-Agent Commits**
```
git commit -m "config-agent: Clean up configuration and secrets"
git commit -m "backend-agent: Remove tenant code and update services"
...
```
**Recommended:** Per-Phase commits for better rollback granularity.
## Backup Strategy
Before starting:
```bash
# Create backup branch
git checkout -b backup-before-simplification
# Tag current state
git tag -a pre-simplification -m "State before architecture simplification"
# Export docker volumes
docker run --rm -v mvp_postgres_data:/data -v $(pwd):/backup \
alpine tar czf /backup/postgres-backup.tar.gz /data
```
## File Verification Checklist
After all changes:
- [ ] No references to `admin-backend` (should be `mvp-backend`)
- [ ] No references to `admin-frontend` (should be `mvp-frontend`)
- [ ] No references to `admin-postgres` (should be `mvp-postgres`)
- [ ] No references to `tenant_id` in application code
- [ ] No references to MinIO in backend code
- [ ] No platform service API keys in config
- [ ] All tests updated for new container names
- [ ] All documentation reflects 6-container architecture