---
phase: 4
slug: script-generation
status: draft
nyquist_compliant: false
wave_0_complete: false
created: 2026-04-10
---

# Phase 4 — Validation Strategy

> Per-phase validation contract for feedback sampling during execution.

---

## Test Infrastructure

| Property | Value |
|----------|-------|
| **Framework** | pytest >= 8.0 |
| **Config file** | none — discovered automatically |
| **Quick run command** | `python -m pytest tests/test_script_generator.py -x -q` |
| **Full suite command** | `python -m pytest tests/ -x -q` |
| **Estimated runtime** | ~10 seconds |

---

## Sampling Rate

- **After every task commit:** Run `python -m pytest tests/test_script_generator.py -x -q`
- **After every plan wave:** Run `python -m pytest tests/ -x -q`
- **Before `/gsd:verify-work`:** Full suite must be green
- **Max feedback latency:** 10 seconds

---

## Per-Task Verification Map

| Task ID | Plan | Wave | Requirement | Test Type | Automated Command | File Exists | Status |
|---------|------|------|-------------|-----------|-------------------|-------------|--------|
| 4-01-01 | 01 | 1 | SCRPT-01 | unit | `python -m pytest tests/test_script_generator.py::test_render_install_contains_pnputil -x` | ❌ W0 | ⬜ pending |
| 4-01-02 | 01 | 1 | SCRPT-01 | unit | `python -m pytest tests/test_script_generator.py::test_render_install_print_config -x` | ❌ W0 | ⬜ pending |
| 4-02-01 | 02 | 1 | SCRPT-02 | unit | `python -m pytest tests/test_script_generator.py::test_render_uninstall -x` | ❌ W0 | ⬜ pending |
| 4-02-02 | 02 | 1 | SCRPT-03 | unit | `python -m pytest tests/test_script_generator.py::test_render_detect -x` | ❌ W0 | ⬜ pending |
| 4-01-03 | 01 | 1 | SCRPT-04 | unit | `python -m pytest tests/test_script_generator.py::test_render_install_uac_guard -x` | ❌ W0 | ⬜ pending |
| 4-01-04 | 01 | 1 | SCRPT-05 | unit | `python -m pytest tests/test_script_generator.py::test_render_install_wow64_guard -x` | ❌ W0 | ⬜ pending |
| 4-03-01 | 03 | 2 | SCRPT-01 | integration | `python -m pytest tests/test_script_generator.py::test_install_endpoint -x` | ❌ W0 | ⬜ pending |
| 4-03-02 | 03 | 2 | SCRPT-02 | integration | `python -m pytest tests/test_script_generator.py::test_uninstall_endpoint -x` | ❌ W0 | ⬜ pending |
| 4-03-03 | 03 | 2 | SCRPT-03 | integration | `python -m pytest tests/test_script_generator.py::test_detect_endpoint -x` | ❌ W0 | ⬜ pending |

*Status: ⬜ pending · ✅ green · ❌ red · ⚠️ flaky*

---

## Wave 0 Requirements

- [ ] `tests/test_script_generator.py` — stubs for SCRPT-01 through SCRPT-05 (unit + integration)
- [ ] `imptune/templates/scripts/install.ps1.j2` — Jinja2 template file
- [ ] `imptune/templates/scripts/uninstall.ps1.j2` — Jinja2 template file
- [ ] `imptune/templates/scripts/detect.ps1.j2` — Jinja2 template file
- [ ] `imptune/generators/script_generator.py` — render functions
- [ ] `imptune/api/scripts.py` — FastAPI router

---

## Manual-Only Verifications

| Behavior | Requirement | Why Manual | Test Instructions |
|----------|-------------|------------|-------------------|
| Install script runs on real Windows endpoint via Intune | SCRPT-01 | Requires real Intune + endpoint | Deploy .intunewin package to test device, verify printer appears |
| UAC elevation prompt appears for standard user | SCRPT-04 | Requires interactive desktop session | Run install.ps1 as standard user, verify UAC dialog |
| WOW64 relaunch works in 32-bit PS | SCRPT-05 | Requires 32-bit PowerShell host | Launch powershell.exe (x86), run install.ps1, verify relaunch |

---

## Validation Sign-Off

- [ ] All tasks have `<automated>` verify or Wave 0 dependencies
- [ ] Sampling continuity: no 3 consecutive tasks without automated verify
- [ ] Wave 0 covers all MISSING references
- [ ] No watch-mode flags
- [ ] Feedback latency < 10s
- [ ] `nyquist_compliant: true` set in frontmatter

**Approval:** pending
