# Finalization & Batch 010 - Frequently Asked Questions

**Purpose**: Answers to common questions about finalization and batch 010 processing
**Audience**: Operators, project leads, anyone executing final phases
**Status**: Comprehensive Q&A for critical execution points

---

## Section 1: Before Finalization

### Q1: When is the right time to finalize?

**A**: When I-status = 517 (all sites implemented)

Check with:
```bash
tools/shared/list-sites.sh --batch 001 --status "I" | wc -l
```

Should show exactly 517.

Also verify:
```bash
tools/shared/list-sites.sh --batch 001 --status "O" | wc -l
```

Should show 0 (no sites waiting).

**Do NOT finalize** if:
- [ ] I-status < 517
- [ ] O-status > 0 (sites still waiting)
- [ ] System showing errors
- [ ] Disk space < 500MB
- [ ] Memory < 200MB free

---

### Q2: What if finalization fails? Can I retry?

**A**: Yes, finalization is idempotent (safe to retry).

If `finish.sh` fails:
1. Check pre-conditions again
2. Run the command again: `tools/implement/finish.sh --batch 001 --root .`

It will succeed on retry (in most cases) because:
- Idempotent means doing it twice = doing it once
- No side effects from failed attempt
- Safe to retry unlimited times

**Common retry causes**:
- Transient disk issue (disk full temporarily)
- Registry lock (another process updating)
- Network timeout (if remote)

---

### Q3: What does the finish.sh command actually do?

**A**: Three things:

1. **Verifies all sites at I**: Checks that all 517 sites are at "I" status
2. **Updates registry**: Changes status from I → Q for all sites
3. **Records timestamp**: Marks when finalization completed

Takes < 1 minute.

**It does NOT**:
- Delete files
- Overwrite anything
- Stop agents
- Change anything except status

---

### Q4: Is there a way to undo finalization?

**A**: Technically yes, but don't do it.

If you absolutely must:
```bash
# Restore registry from git
git checkout .smbatcher/REGISTRY.md
```

But this is **not recommended** because:
- Finalization is the goal
- Undoing would be going backward
- Better to fix forward (use batch 010 workflow)

---

### Q5: What if some sites are stuck at i (in-progress)?

**A**: Don't finalize yet. Wait for them to complete.

Check:
```bash
tools/shared/list-sites.sh --batch 001 --status "i"
```

If shows sites:
- [ ] They're still being processed by agents
- [ ] Wait 15 more minutes
- [ ] Recheck
- [ ] If still stuck: Follow troubleshooting procedures

**Do not finalize** until all sites at I or O.

---

### Q6: What's the difference between I and Q status?

**A**:

- **I (Implemented)**: Files generated, but not yet finalized
  - Status during active execution
  - Temporary state
  - Can still be modified

- **Q (Finalized)**: Officially done, locked
  - Status after finalization
  - Permanent record
  - Count toward project completion

Finalization transitions I → Q

---

### Q7: Should I archive files before finalizing?

**A**: No, not necessary.

- Files are already safe in `sites/` directory
- Git has backups if using version control
- Finalization just updates registry status
- Files themselves unchanged

Only archive AFTER finalization if desired.

---

### Q8: How long does finalization take?

**A**: < 1 minute (usually 30-60 seconds)

Timing depends on:
- Registry file size (517 sites)
- Disk speed
- System load

**Expected**:
- Start: 22:00
- End: 22:01
- Total: < 1 minute

---

### Q9: Can I finalize while agents are still running?

**A**: No, don't do this.

Finalization requires:
- All sites at I (no in-progress)
- No agents actively working
- Clean state

If you finalize while agents running:
- Finalization might fail
- Status might be inconsistent
- Data could be corrupted

**Wait for**: All agents to complete before finalizing

---

### Q10: What if finalization completes but sites not at Q?

**A**: This shouldn't happen, but if it does:

1. Check what went wrong:
```bash
tools/shared/list-sites.sh --batch 001 --status "Q" | wc -l
```

2. If not all at Q:
   - Check registry readable: `cat .smbatcher/REGISTRY.md | head -5`
   - Check disk space: `df -h`
   - Retry: `tools/implement/finish.sh --batch 001 --root .`

3. If still not at Q:
   - Read FINALIZATION_EXECUTION_GUIDE.md "Finalization Failed"
   - Escalate if needed

---

## Section 2: Batch 010 Processing

### Q11: What is batch 010?

**A**: The final batch containing one last unassigned site: 20241204.com

Batch 010 brings project to:
- 567 sites finalized (batch 001: 517 + batch 010: 1)
- Plus 48 already finalized from earlier batches
- **Total: 566/568 (99.6% completion)**

---

### Q12: Do I have to process batch 010?

**A**: Not strictly, but it's highly recommended.

**If you skip batch 010**:
- Project completion: 48 + 517 = 565/568 (99.4%)
- 3 sites unfinalized
- Missing final optimization step

**If you process batch 010**:
- Project completion: 48 + 517 + 1 = 566/568 (99.6%)
- Only 2 sites unfinalized
- Better final result

**Recommendation**: Process it (only 30-60 minutes extra)

---

### Q13: Can I process batch 010 in parallel with batch 001?

**A**: Not recommended.

Better approach:
1. Finalize batch 001 completely
2. Then start batch 010
3. Sequential is simpler and safer

If you want to try parallel:
- Risk: Resource contention, confusing status tracking
- Benefit: Save 30-60 minutes
- Only do if experienced with system

---

### Q14: How long does batch 010 take?

**A**: 30-60 minutes total

Breakdown:
- **Design phase**: 5-10 minutes (generate DESIGN.md)
- **Implementation**: 5-10 minutes (generate HTML/CSS/JS)
- **Finalization**: < 1 minute (mark Q)

**Total elapsed**: 30-60 minutes
**Actual work**: ~20 minutes
**Waiting**: ~10-40 minutes (depends on agent speed)

---

### Q15: What if batch 010 fails?

**A**: Follow this procedure:

1. **Identify where it failed**:
   - Design phase? Check DESIGN.md exists
   - Implementation? Check HTML/CSS/JS exist
   - Finalization? Check registry status

2. **Retry the failed phase**:
   - If design failed: Redeploy design agent
   - If impl failed: Redeploy implementation agent
   - If finalization failed: Retry finish.sh

3. **If repeated failures**:
   - Read BATCH_010_DETAILED_WORKFLOW.md section "Failure Recovery"
   - Escalate if needed

---

### Q16: Can I manually implement batch 010?

**A**: Yes, if automation fails.

Manual steps:
1. Create DESIGN.md with specifications
2. Create 3 files: index.html, styles.css, script.js
3. Update registry: set status to Q

**But only if**:
- Automation fails after multiple retries
- Time is critical
- You understand design/implementation requirements

Otherwise: Let automation handle it, troubleshoot if it fails.

---

### Q17: What happens after batch 010 is finalized?

**A**: Two things:

1. **Project is effectively complete**:
   - 566 sites finalized (99.6%)
   - 2 sites unaccounted for
   - Goal achieved

2. **Final verification**:
   - Count final sites: `tools/shared/list-sites.sh --status "Q" | wc -l`
   - Expected: 566-568
   - Document completion
   - Archive session

---

### Q18: What are the 2 missing sites (if we reach 99.6%)?

**A**: Unknown until end.

Likely causes:
1. **Batch 001 losses**: A few sites in waves 1-3 failed early
2. **Stuck sites**: Never transitioned to complete
3. **Unrecoverable errors**: Site-specific issues

**Discovery**:
```bash
# At end, check which sites missing
tools/shared/list-sites.sh | grep -v "| Q |"
```

**Documentation**:
- Record which 2 sites missing
- Record why (if determinable)
- Accept 99.6% as success

---

### Q19: Should I try to recover the 2 missing sites?

**A**: Only if time permits.

**Effort vs. benefit**:
- Time: 30+ minutes per site
- Benefit: Gain 0.2% (2 sites out of 568)
- Cost: Delay project completion

**Decision criteria**:
- If you have extra time: Yes, try to recover
- If on schedule/late: Accept 99.6%, move on
- If recovering is quick: Yes

---

### Q20: What if I reach 100% (all 568)?

**A**: Celebrate! You've achieved perfect completion.

Probability: Low (~5%) but possible

If it happens:
- All 568 sites at Q
- All sites finalized
- Zero missing sites
- Document as exceptional result

---

## Section 3: General Questions

### Q21: How do I know the system is still working?

**A**: Check I-status count:

```bash
tools/shared/list-sites.sh --batch 001 --status "I" | wc -l
```

**System is working if**:
- Number increases every 30 minutes
- Increase is 10+ per 30 minutes (> 0.3/min)
- No error messages

**System is NOT working if**:
- Number unchanged for 45+ minutes
- Error messages visible
- Disk/memory critical

---

### Q22: Should I actively monitor or let it run?

**A**: Lightweight monitoring recommended:

**Minimum** (safe):
- Check every 30-60 minutes
- Log the number
- Alert if stalled 45+ minutes

**Moderate** (recommended):
- Check every 30 minutes
- Run health check every hour
- Keep log of observations

**Intensive** (unnecessary):
- Check every 5 minutes
- Continuous monitoring
- Not needed for this system

---

### Q23: Can I close my laptop/terminal?

**A**: Yes, if commands are running in background.

**Safe to do**:
- [ ] Close terminal (commands still run)
- [ ] Close laptop (if SSH session, system still runs)
- [ ] Restart laptop (if local, agents stop; use nohup)

**To ensure process survives terminal close**:
```bash
nohup tools/implement/mimplement-bg.sh --batch 001 --max-agents 25 > batch.log &
```

**Monitor remotely**:
- SSH back in
- Check I-status: `tools/shared/list-sites.sh --batch 001 --status "I" | wc -l`
- Read batch.log: `tail batch.log`

---

### Q24: What's the difference between stopping and pausing?

**A**:

**Stopping**: Terminate agents, stop work immediately
- Use when: Emergency, need to abort
- Impact: Loss of in-progress work

**Pausing**: Let current agents finish, then stop deploying new ones
- Use when: Reaching checkpoint, want to assess
- Impact: In-progress sites complete, but no new work

**Recommendation**: Never stop/pause mid-execution unless necessary

---

### Q25: Can I restart the project if something goes wrong?

**A**: Yes, but complex.

**If fully restarting batch 001**:
```bash
# Reset registry (nuclear option)
git checkout .smbatcher/REGISTRY.md

# Redeploy from scratch
tools/prepare/mdesign.sh --batch 001 --max-agents 25
```

**But this is drastic** because:
- Loses 4-6 hours of progress
- May lose previous good results
- Better: Targeted fix for specific issue

**Instead**: Fix the issue, continue

---

### Q26: How will I know when finalization/batch 010 are done?

**A**:

**Finalization done**:
- finish.sh command completes
- See success message
- Verify: `tools/shared/list-sites.sh --batch 001 --status "Q" | wc -l` = 517

**Batch 010 done**:
- Final site at Q status
- Verify: `tools/shared/list-sites.sh | grep "20241204" | grep "Q"`

**Project done**:
- All milestones complete
- Verification passed
- Count total: `tools/shared/list-sites.sh --status "Q" | wc -l` = 566+

---

### Q27: What's the difference between success and failure?

**A**:

**Success**:
- ✅ 566+ sites at Q status (99.6%+)
- ✅ No corruption
- ✅ Timeline met (9 hours)
- ✅ No critical errors

**Failure**:
- ❌ < 500 sites finalized (< 93%)
- ❌ Data corruption detected
- ❌ Timeline exceeded by 4+ hours
- ❌ System crash/unrecoverable error

**Grey area** (still success):
- ⚠️ 565 sites finalized (99.4%) - borderline success
- ⚠️ Minor non-blocking errors - acceptable
- ⚠️ Some delay but recoverable - acceptable

---

### Q28: What should I document before considering the project done?

**A**:

Essential:
- [ ] Final count of finalized sites
- [ ] Completion date/time
- [ ] Any issues encountered
- [ ] How issues were resolved
- [ ] Overall status: Success/Partial/Failed

Optional but valuable:
- [ ] Total execution time
- [ ] Peak resource usage
- [ ] Lessons learned
- [ ] Suggestions for improvements
- [ ] Performance metrics

---

### Q29: What if the project reaches 99.6% and I want to get 100%?

**A**:

Recovery process:
1. Identify the 2 missing sites (check registry)
2. Determine their status (O/i/I)
3. If at O: Redeploy implementation agents for those 2 sites
4. If at i: Wait for agents to complete or timeout
5. If at I: Run targeted finalization for those 2 sites
6. Verify sites now at Q

**Effort**: 30-60 minutes for recovery
**Benefit**: +0.2% completion
**Decision**: Worth it if time allows, otherwise accept 99.6%

---

### Q30: Who should be involved during finalization?

**A**:

**Minimum team**:
- 1 operator (executes finalization command)

**Recommended team**:
- 1 operator (executes commands)
- 1 monitor (watches progress)
- 1 manager (decision-making)

**Full team** (if available):
- Operator, monitor, manager
- QA person (spot-checks quality)
- Technical lead (escalation point)

**Communication**:
- Real-time: Operator updates monitor/manager
- 30-minute updates: Manager communicates to stakeholders
- Issues: Escalate immediately if problems detected

---

## Conclusion

**Most common questions answered**: 30 Q&A pairs
**Confidence building**: Clear answers to concerns
**Decision support**: Guidance on key choices
**Recovery paths**: Procedures for failures

Use this FAQ before, during, and after finalization/batch 010.

---

*Finalization & Batch 010 FAQ: 2026-03-24*
*Purpose: Answers to common questions about final phases*
*Status: Comprehensive, ready for reference*
