# Readiness Gate โ€” Step 4 ## Write Artifacts โ›” **You MUST read [`prereq-artifacts.md`](prereq-artifacts.md)** for complete artifact write procedures and phase exit checklist. --- ## Severity Tiers | Verdict | Icon | Meaning | |---------|------|---------| | Hard Halt | ๐Ÿ›‘ | App is intentionally vulnerable โ€” pipeline stops, no fix possible | | Major Migration | ๐Ÿ”ถ | Large-scope change (EOL runtime, cloud SDK migration, >5 files) โ€” redirect or warn | | Critical | โŒ FAIL | Deployment will fail โ€” agent can fix (โ‰ค5 files, config-level) | | Recommended Fix | ๐Ÿ”ง | App deploys but has quality/security issues โ€” agent offers fix | | Warning | โš ๏ธ WARN | Informational, non-blocking โ€” can proceed with caveats | | Pass | โœ… PASS | No issues | --- ## Overall Health Gate **Compute `overallHealth`:** ALL โœ… PASS โ†’ `"ready"` | Any โš ๏ธ WARN no โŒ FAIL โ†’ `"readyWithCaveats"` | ANY โŒ FAIL โ†’ `"blocked"` **Component `readiness.status` alignment:** - `"ready"` โ†’ `readiness.status: "ready"` - `"readyWithCaveats"` โ†’ `readiness.status: "ready"` (WARNs aren't "needs fixes") - `"blocked"` โ†’ `readiness.status: "needsFixes"` - After remediation โ†’ `readiness.status: "fixesApplied"` โ›” `readiness.status: "needsFixes"` requires at least one โŒ FAIL. If all โš ๏ธ/โœ…, use `"ready"`. --- ## Critical Readiness Gate โ›” **Verdict propagation cross-check** before computing `overallHealth`: 1. Any finding with `verdict: "FAIL"` โ†’ axis verdict MUST be `"FAIL"`. 2. Any finding with `verdict: "WARN"` + `fixPhase: "prereq"` โ†’ escalate to `"FAIL"` (prevents wasting a deploy cycle). โ›” Escalate only WARNs that would actually break THIS deploy (build/startup failure, or a health probe wired to a route the app lacks). Issues that deploy and run fine โ€” missing trust proxy, README, in-memory sessions โ€” stay `fixPhase: "postdeploy"`/`"scaffold"`; `engines`/health-endpoint escalate only on a real version/probe mismatch (see [completeness-check.md](completeness-check.md) ยง Stack-Specific Checks). | Tiers | Reference file | |-------|---------------| | ๐Ÿ›‘ ๐Ÿ”ถ ๐Ÿ”ง โš ๏ธ | [`dependency-compatibility.md`](dependency-compatibility.md) | | โŒ ๐Ÿ”ง | [`completeness-check.md`](completeness-check.md) | | โŒ | [`build-check.md`](build-check.md) | **Post-evaluation HALT cross-check:** Intentionally vulnerable apps (โ‰ฅ2 code signals from dependency-compatibility.md) โ†’ `overallHealth: "blocked"` MUST be written to `prereq-output.json` on disk (Step 4) BEFORE any halt message. If the artifact is not on disk when you reach the halt, write it NOW via the `create` tool and read it back โ€” do NOT present the halt until it exists. --- ## Batch-Then-Approve Flow โ›” **Artifacts before message.** Write AND read back all 3 artifacts (`prereq-output.json`, `context.json`, `readiness-report.md`) to confirm they exist on disk BEFORE presenting any findings, cloud-SDK stop prompt, or ๐Ÿ›‘ hard-halt message. Those messages can end the turn, so every artifact MUST already be persisted โ€” NEVER batch artifact writes after the message. 1. **Detect ALL issues first** โ€” full 3-axis scan, all components. 2. **Present ALL findings at once** โ€” summary: "๐Ÿ” Readiness: 2 critical, 1 recommended fix, 3 warnings". Group: ๐Ÿ›‘ โ†’ ๐Ÿ”ถ โ†’ โŒ โ†’ ๐Ÿ”ง โ†’ โš ๏ธ. 3. **Fix plan** โ€” for โŒ, ๐Ÿ”ง, ๐Ÿ”ถ, โš ๏ธ with `fixPhase: "prereq"`: describe WHAT and WHY. โ›” Exclude ๐Ÿ”ถ with `routeToSkill` set. Never include ๐Ÿ›‘. 4. **User choice** (based on highest severity): - **๐Ÿ›‘:** Pipeline stops. No formal gate. - **๐Ÿ”ถ + others:** "Fix {N} issues including {M} migration(s) โ€” scope warning" / "Fix blockers only" / "Continue with risks" / "Cancel" - **๐Ÿ”ถ only:** "Attempt migration" / "Continue as-is" / "Cancel" - **โŒ/๐Ÿ”ง/โš ๏ธ with fixPhase prereq:** "Fix {N} deployment issues" / "Continue with risks" / "Cancel" 5. **After approval** โ†’ apply fixes per [remediation-protocol.md](remediation-protocol.md). > โ›” **Two-gate rule:** Intent approval โ‰  fix execution approval. Present the fix prompt here even if user agreed earlier. --- ## Fast-Track Single-component + no DB + no auth + **no Dockerfile** โ†’ `fastTrackEligible: true`. --- ## Present Findings (Step 5) โ›” Do NOT skip โ€” user must see scan results before pipeline continues. **Part 1 โ€” Summary:** "๐Ÿ” Readiness: {N} critical, {M} fixes, {K} warnings" (or "โœ… Ready"). **Part 2 โ€” Per-axis reasoning:** Verdict icon + 1โ€“2 sentence summary per axis. **Part 3 โ€” Findings table:** Grouped by severity. Include warning ID and actionable detail. **Data-loss warnings** (SQLite, in-memory sessions, local file storage) require explicit acknowledgment. Other โš ๏ธ are informational. End with: "๐Ÿ“„ Full evaluation saved to `readiness-report.md`." ### Remediation Decision Gate โ›” **STOP after presenting findings.** Options: 1. **"Fix deployment issues"** โ€” fix all actionable items (โŒ, ๐Ÿ”ง, โš ๏ธ with `fixPhase: "prereq"`). Re-evaluate after. 2. **"I have context โ€” let me guide the fixes"** 3. **"Continue without fixing โ€” I accept the risks"** Wait for explicit choice. Generic "Yes"/"Go ahead" โ‰  remediation consent โ€” clarify if ambiguous. > โ›” **Remediation budget:** Max 3 cycles. See [remediation-protocol.md](remediation-protocol.md) step 7. > โ›” **ARTIFACT CHECKPOINT.** After presenting findings, verify all 3 artifacts exist: `context.json`, `prereq-output.json`, `readiness-report.md`. Write any missing ones NOW.