295 lines
8.8 KiB
Markdown
295 lines
8.8 KiB
Markdown
# 🔄 Takeover Plan - Job-Info-Prod → Job-Info-Test
|
|
|
|
## Overview
|
|
|
|
`Job-Info-Prod` is **not a separate project** - it's a **temporary staging folder** to build the production-ready version safely. Once verified working, it will **completely replace** Job-Info-Test.
|
|
|
|
---
|
|
|
|
## Migration Strategy
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────┐
|
|
│ Current State: Job-Info-Test (working but incomplete) │
|
|
└─────────────────────────────────────────────────────────┘
|
|
↓
|
|
┌─────────────────────────────────────────────────────────┐
|
|
│ Phase 1: Build in Job-Info-Prod (separate folder) │
|
|
│ • Opus scaffolds structure │
|
|
│ • Sonnet implements functionality │
|
|
│ • Test everything thoroughly │
|
|
│ • Job-Info-Test remains untouched │
|
|
└─────────────────────────────────────────────────────────┘
|
|
↓
|
|
┌─────────────────────────────────────────────────────────┐
|
|
│ Phase 2: Verification │
|
|
│ • Both tokens work (PocketBase + Graph) │
|
|
│ • Background refresh running │
|
|
│ • API calls successful │
|
|
│ • Offline mode functional │
|
|
│ • No critical bugs │
|
|
└─────────────────────────────────────────────────────────┘
|
|
↓
|
|
┌─────────────────────────────────────────────────────────┐
|
|
│ Phase 3: Takeover │
|
|
│ • Backup Job-Info-Test (optional) │
|
|
│ • Delete Job-Info-Test contents │
|
|
│ • Move Job-Info-Prod contents to Job-Info-Test │
|
|
│ • Job-Info-Test is now the production version │
|
|
└─────────────────────────────────────────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## Why Separate Folders During Development?
|
|
|
|
### Safety
|
|
- ✅ Original working code preserved
|
|
- ✅ Can reference old implementation
|
|
- ✅ Easy rollback if something breaks
|
|
- ✅ No risk during experimentation
|
|
|
|
### Clarity
|
|
- ✅ Clear separation: old vs new
|
|
- ✅ Can compare implementations
|
|
- ✅ Test new version thoroughly
|
|
- ✅ Verify everything before replacing
|
|
|
|
### Once Verified
|
|
- ✅ Job-Info-Prod becomes Job-Info-Test
|
|
- ✅ Only one project exists
|
|
- ✅ No confusion about which is "production"
|
|
|
|
---
|
|
|
|
## Takeover Process
|
|
|
|
### Step 1: Build & Test (Job-Info-Prod)
|
|
```bash
|
|
# Opus scaffolds structure
|
|
cd /home/admin/Job-Info-Prod
|
|
|
|
# Sonnet implements functionality
|
|
# Test everything thoroughly
|
|
bun run backend/src/index.ts
|
|
# Open frontend, test all features
|
|
|
|
# Verify:
|
|
# ✅ Login works
|
|
# ✅ Both tokens obtained
|
|
# ✅ Background refresh running
|
|
# ✅ API calls work
|
|
# ✅ Offline mode works
|
|
# ✅ No critical bugs
|
|
```
|
|
|
|
### Step 2: Backup Original (Optional)
|
|
```bash
|
|
# If you want to keep a backup
|
|
cd /home/admin
|
|
mv Job-Info-Test Job-Info-Test-backup-$(date +%Y%m%d)
|
|
# Now you have: Job-Info-Test-backup-20260101/
|
|
```
|
|
|
|
### Step 3: Takeover
|
|
```bash
|
|
# Method A: Rename (simplest)
|
|
cd /home/admin
|
|
rm -rf Job-Info-Test # Delete old version
|
|
mv Job-Info-Prod Job-Info-Test # Rename new version
|
|
cd Job-Info-Test
|
|
# Done! Job-Info-Test is now the production version
|
|
|
|
# Method B: Copy contents (if you want to preserve git)
|
|
cd /home/admin
|
|
rm -rf Job-Info-Test/* # Delete contents (keep folder)
|
|
cp -r Job-Info-Prod/* Job-Info-Test/ # Copy new version
|
|
cd Job-Info-Test
|
|
git add .
|
|
git commit -m "Production-ready version with dual-token architecture"
|
|
# Done! Job-Info-Test updated in place
|
|
```
|
|
|
|
### Step 4: Cleanup
|
|
```bash
|
|
# Remove staging folder (if using Method A)
|
|
rm -rf /home/admin/Job-Info-Prod
|
|
|
|
# Or keep as backup temporarily
|
|
mv /home/admin/Job-Info-Prod /home/admin/Job-Info-Prod-verified
|
|
```
|
|
|
|
---
|
|
|
|
## Verification Checklist
|
|
|
|
Before takeover, verify in Job-Info-Prod:
|
|
|
|
### Authentication
|
|
- [ ] Login flow works end-to-end
|
|
- [ ] PocketBase token obtained
|
|
- [ ] Microsoft Graph token obtained
|
|
- [ ] Both tokens stored in localStorage
|
|
- [ ] Both tokens cached in Valkey
|
|
- [ ] Background refresh loop starts
|
|
|
|
### Token Management
|
|
- [ ] `ensureToken('pb')` returns fresh token
|
|
- [ ] `ensureToken('graph')` returns fresh token
|
|
- [ ] Backend refresh endpoint works
|
|
- [ ] Stale token fallback works (test by killing backend)
|
|
- [ ] No re-authentication prompts (except login)
|
|
|
|
### API Functionality
|
|
- [ ] Jobs list loads
|
|
- [ ] Job detail loads
|
|
- [ ] Files list loads
|
|
- [ ] Notes work
|
|
- [ ] All API calls use token injection
|
|
|
|
### Offline Mode
|
|
- [ ] App works when backend down
|
|
- [ ] Stale tokens used as fallback
|
|
- [ ] No crashes or errors
|
|
- [ ] Graceful degradation messages
|
|
|
|
### Background Services
|
|
- [ ] Token refresh loop running
|
|
- [ ] Tokens refreshed every 30 minutes
|
|
- [ ] No user-visible interruptions
|
|
- [ ] Valkey cache updates
|
|
|
|
### Code Quality
|
|
- [ ] TypeScript compiles with no errors
|
|
- [ ] All tests pass
|
|
- [ ] No console errors
|
|
- [ ] No critical warnings
|
|
- [ ] Code follows RULES.md patterns
|
|
|
|
---
|
|
|
|
## Post-Takeover
|
|
|
|
After Job-Info-Prod becomes Job-Info-Test:
|
|
|
|
### Update Documentation
|
|
- [ ] README.md updated
|
|
- [ ] Remove references to "Job-Info-Prod"
|
|
- [ ] Update deployment docs
|
|
- [ ] Update environment setup
|
|
|
|
### Git Management
|
|
```bash
|
|
cd /home/admin/Job-Info-Test
|
|
git add .
|
|
git commit -m "Production-ready architecture with dual-token system"
|
|
git tag v2.0.0-production
|
|
git push
|
|
```
|
|
|
|
### Team Communication
|
|
- Notify team: Job-Info-Test is now production-ready
|
|
- Share updated documentation
|
|
- Update deployment procedures
|
|
- Archive old version if needed
|
|
|
|
---
|
|
|
|
## Rollback Plan (If Needed)
|
|
|
|
If something goes wrong during takeover:
|
|
|
|
### If Backup Exists
|
|
```bash
|
|
cd /home/admin
|
|
rm -rf Job-Info-Test # Remove broken version
|
|
mv Job-Info-Test-backup-20260101 Job-Info-Test # Restore backup
|
|
cd Job-Info-Test
|
|
bun run backend/server.ts # Back to working state
|
|
```
|
|
|
|
### If No Backup
|
|
```bash
|
|
cd /home/admin/Job-Info-Test
|
|
git reset --hard HEAD~1 # Or specific commit
|
|
# Restore to last working state
|
|
```
|
|
|
|
---
|
|
|
|
## Timeline
|
|
|
|
### Phase 1: Build (Job-Info-Prod)
|
|
- Opus Scaffolding: 30 minutes
|
|
- Sonnet Implementation: 4-6 hours
|
|
- Testing: 2-3 hours
|
|
- **Total:** 7-10 hours
|
|
|
|
### Phase 2: Verification
|
|
- Feature testing: 1-2 hours
|
|
- Bug fixes (if any): 1-3 hours
|
|
- Final verification: 30 minutes
|
|
- **Total:** 3-6 hours
|
|
|
|
### Phase 3: Takeover
|
|
- Backup: 5 minutes
|
|
- Takeover: 5 minutes
|
|
- Verification: 15 minutes
|
|
- **Total:** 30 minutes
|
|
|
|
**Grand Total:** 10-16 hours from start to production takeover
|
|
|
|
---
|
|
|
|
## Key Points
|
|
|
|
### During Development
|
|
- ✅ Two folders exist: Job-Info-Test (old) + Job-Info-Prod (new)
|
|
- ✅ Job-Info-Test preserved and working
|
|
- ✅ Job-Info-Prod is being built and tested
|
|
- ✅ No confusion: "Prod" means "production-ready", not "separate production system"
|
|
|
|
### After Takeover
|
|
- ✅ Only one folder: Job-Info-Test
|
|
- ✅ Contains production-ready code from Job-Info-Prod
|
|
- ✅ Job-Info-Prod folder deleted/archived
|
|
- ✅ Job-Info-Test is the single source of truth
|
|
|
|
### Naming Clarity
|
|
- **Job-Info-Test** = Current project name (stays the same)
|
|
- **Job-Info-Prod** = Temporary staging folder during rebuild
|
|
- **After takeover** = Job-Info-Test contains production-ready version
|
|
|
|
---
|
|
|
|
## Why This Approach?
|
|
|
|
### Pros
|
|
✅ Safe: Original code never touched during development
|
|
✅ Testable: Can verify everything before replacing
|
|
✅ Reversible: Easy rollback if needed
|
|
✅ Clear: Separation during development
|
|
✅ Simple: One project after takeover
|
|
|
|
### Cons
|
|
❌ Temporary disk space: Two folders during development (~100MB each)
|
|
❌ Must remember to do takeover: Don't forget final step
|
|
|
|
---
|
|
|
|
## Summary
|
|
|
|
```
|
|
Job-Info-Prod is NOT a separate project.
|
|
↓
|
|
It's a temporary staging folder.
|
|
↓
|
|
Build → Test → Verify → Takeover
|
|
↓
|
|
Job-Info-Test becomes production-ready.
|
|
↓
|
|
Only one project exists: Job-Info-Test
|
|
```
|
|
|
|
**Status:** Ready to scaffold Job-Info-Prod for testing, then takeover Job-Info-Test 🚀
|