---
name: step-04-verify
description: Post-check verification of generated HTML
model: opus
---

# Step 4: Verify Generated HTML

## YOUR TASK

Run 9 blocking validations on the generated HTML file and display the completion summary.

---

## EXECUTION SEQUENCE

### 1. Blocking Validations

**Check 1 — File size > 100KB:**
```
if [ $(stat --format=%s ba-interactive.html) -lt 100000 ]; then
  BLOCKING_ERROR("ba-interactive.html not pre-populated — file too small")
fi
```

**Check 2 — moduleSpecs present in HTML:**
```
if ! grep -q '"moduleSpecs"' ba-interactive.html; then
  BLOCKING_ERROR("moduleSpecs not found — FEATURE_DATA not serialized")
fi
```

**Check 3 — cadrage.scope uses HTML keys (inscope/outofscope, NOT inScope):**
```
if grep -q '"inScope"' ba-interactive.html; then
  BLOCKING_ERROR("cadrage.scope still has JSON keys — conversion failed")
fi
```

**Check 4 — Wireframe field names correct (format/content, NOT mockupFormat/mockup):**
```
if grep -q '"mockupFormat"' ba-interactive.html; then
  BLOCKING_ERROR("Wireframes use 'mockupFormat' — must be 'format'")
fi
```

**Check 5 — All modules have specs AND wireframes:**
```
FOR each module in FEATURE_DATA.modules:
  IF FEATURE_DATA.moduleSpecs[module.code] undefined:
    BLOCKING_ERROR("Module {module.code} not in moduleSpecs")
  IF EMBEDDED_ARTIFACTS.wireframes[module.code] undefined:
    BLOCKING_ERROR("Module {module.code} not in wireframes")
```

**Check 6 — Per-module data completeness (source vs HTML):**
```
FOR each module in FEATURE_DATA.modules:
  Read source: {docs_dir}/{appKebab}/{moduleKebab}/usecases.json
  sourceUCCount = count of useCases OR usecases in source file
  htmlUCCount = count in FEATURE_DATA.moduleSpecs[module.code].useCases
  IF sourceUCCount > 0 AND htmlUCCount === 0:
    BLOCKING_ERROR("Module {module.code}: 0 useCases in HTML but {sourceUCCount} in source")

  Read source: {docs_dir}/{appKebab}/{moduleKebab}/rules.json
  sourceBRCount = count of rules OR businessRules in source file
  htmlBRCount = count in FEATURE_DATA.moduleSpecs[module.code].businessRules
  IF sourceBRCount > 0 AND htmlBRCount === 0:
    BLOCKING_ERROR("Module {module.code}: 0 businessRules in HTML but {sourceBRCount} in source")
```

**Check 7 — Screens/mockups populated (prevents ASCII-only regression):**
```
FOR each module in FEATURE_DATA.modules:
  Read source: {docs_dir}/{appKebab}/{moduleKebab}/screens.json
  sourceScreenCount = count of "screens" array OR "sections" array in source file
  htmlScreenResources = sum of resources[].length across moduleSpecs[module.code].screens[]
  IF sourceScreenCount > 0 AND htmlScreenResources === 0:
    BLOCKING_ERROR("Module {module.code}: 0 screen resources but source has {sourceScreenCount}")
```

**Check 8 — No serialization bugs ([object Object]):**
```
Search ba-interactive.html for the literal string "[object Object]"
IF found:
  BLOCKING_ERROR("Serialization bug: [object Object] found in HTML — steps[] or other arrays contain objects instead of strings")
  Identify which module/field contains the bug and fix the mapping
```

**Check 9 — No runtime crash (CRITICAL — validates page won't be blank):**
```
Open ba-interactive.html and search for the FEATURE_DATA JSON block.
Verify these MANDATORY top-level fields exist:
  - "modules": [...]          (array, can be empty)
  - "dependencies": [...]     (array, can be empty)
  - "cadrage": {...}          (object with stakeholders[], scope{})
  - "moduleSpecs": {...}      (object, one key per module)
  - "consolidation": {...}    (object)

IF "dependencies" is missing from FEATURE_DATA:
  Add: "dependencies": [] to the FEATURE_DATA object in the HTML
  (This is the #1 cause of blank HTML pages — TypeError on data.dependencies.length crashes all JS)

IF "modules" is missing:
  BLOCKING_ERROR("FEATURE_DATA.modules missing — page will crash")
```

> **IF any check fails:** fix the issue and re-run the failing step before completing.

---

### 2. Display Completion Summary

```
══════════════════════════════════════════════════════════════
  [OK] HTML DEPLOY COMPLETE — {application_name}
══════════════════════════════════════════════════════════════

Modules: {count} ({names})

[DIR] Artifact generated:
  ba-interactive.html — Interactive document
     Path: {output_path}
     Pre-populated: {module_count} modules, {total_uc} use cases,
       {total_br} business rules, {total_wireframes} wireframes

[NEXT] Review & Validation:
  1. Open ba-interactive.html in browser
  2. Review all modules, use cases, business rules
  3. Validate wireframes and permissions
  4. If approved: /business-analyse-handoff then /business-analyse-develop to begin development
  5. If corrections needed: export ba-review.json from the HTML, then run /business-analyse-review

══════════════════════════════════════════════════════════════
```
