# Phase 5: Tech Debt - Context
**Gathered:** 2026-03-30
**Status:** Ready for planning
## Phase Boundary
Fix all deferred v1.0 issues: filter ReviewStep output blocks and ZIP by scriptTargets selection, add a Back button to ReviewStep, wire BackendSelectionStep to BACKEND_REGISTRY keys, enrich registry with display metadata, remove the dead `BackendFormValues` export, and eliminate `act()` warnings from the BackendSelectionStep test suite.
## Implementation Decisions
### scriptTargets filtering (TECH-01)
- ReviewStep conditionally renders output blocks based on `state.deployment.scriptTargets` — blocks are unmounted entirely when their target is deselected (not CSS-hidden)
- Intune maps to: intuneInstall + intuneDetection blocks
- RMM maps to: rmmScript block
- rclone.conf OutputBlock is always shown regardless of scriptTargets
- **ZIP bundle also respects scriptTargets** — only files for selected targets are included (not always 4)
- Edge case: if both targets are deselected, only rclone.conf is shown and ZIP contains only rclone.conf (no blocking or warning needed)
### Back button (TECH-02)
- Claude's Discretion — placement and styling left to planner
- Must preserve all form data (wizard state is in the store — navigation does not clear it)
- Back dispatches `SET_STEP(2)` to return to DeploymentStep
### Registry structure (TECH-03)
- Enrich `BACKEND_REGISTRY` to `Record`
- All consumers of `BACKEND_REGISTRY[type]` that access field arrays must update to `BACKEND_REGISTRY[type].fields`
- `BackendSelectionStep` derives the card list from `Object.entries(BACKEND_REGISTRY)` — no hardcoded `BACKENDS` array
- Display metadata stays in the registry entry so Phase 6 additions auto-surface with zero additional code
- Existing test assertions on card text ('Azure Blob Storage', etc.) remain valid — source of truth just moves
### Dead export removal (TECH-04)
- Remove `BackendFormValues` export from `src/schemas/index.ts` (lines 27-28)
- Verify no TypeScript errors arise after removal (no consumers expected)
### act() warnings (TECH-05)
- Claude's Discretion — fix the act() warnings in `BackendSelectionStep.test.tsx` using appropriate testing-library patterns
## Existing Code Insights
### Reusable Assets
- `useWizard()` / `dispatch`: Already provides `SET_STEP` action — Back button uses `dispatch({ type: 'SET_STEP', payload: 2 })`
- `OutputBlock` component: Already accepts `content`, `filename`, `disabled` — wrapping in conditional render is trivial
- `downloadZip()`: Takes a files array — filter the array by scriptTargets before passing
### Established Patterns
- AzureAuthToggle uses CSS hidden for field toggle (preserving state) — OutputBlocks use conditional render instead (no state to preserve between show/hide)
- DeploymentStep uses bottom nav bar pattern: Back + Next buttons side-by-side at bottom — ReviewStep Back button should follow same layout
- Wave 0 TDD stubs before implementation — continue pattern in v1.1
### Integration Points
- `src/schemas/registry.ts`: `BACKEND_REGISTRY` type and shape change — update `FieldDef[]` access to `.fields` in `src/schemas/index.ts` (buildZodSchema) and `src/components/wizard/RemoteConfigStep.tsx` (FieldRenderer iteration)
- `src/components/wizard/ReviewStep.tsx`: scriptTargets filtering + Back button
- `src/components/wizard/BackendSelectionStep.tsx`: replace hardcoded BACKENDS with registry-derived entries
- `src/schemas/index.ts`: remove BackendFormValues export + update registry field access
## Specific Ideas
- ZIP filtering: pass only the relevant files to `downloadZip()` based on `scriptTargets` — e.g., `['rclone.conf always', ...intune files if 'intune' in targets, ...rmm file if 'rmm' in targets]`
- Registry enrichment: `BACKEND_REGISTRY` shape becomes `{ displayName: string; description: string; fields: FieldDef[] }` — existing registry entries get their current hardcoded card strings promoted into the registry
## Deferred Ideas
None — discussion stayed within phase scope.
---
*Phase: 05-tech-debt*
*Context gathered: 2026-03-30*