--- phase: 02-generators plan: 01 subsystem: testing tags: [vitest, tdd, rclone, powershell, generators] # Dependency graph requires: - phase: 01-foundation provides: WizardState type, INITIAL_STATE, BackendType — imported by all four test files provides: - Failing unit tests (RED) for buildRcloneConf covering azureblob, s3, s3-compatible backends - Failing unit tests (RED) for buildIntuneInstall covering configPath, includeInstall, UTF-8 write, credential safety - Failing unit tests (RED) for buildIntuneDetection covering configPath, exit codes, stdout-only constraint - Failing unit tests (RED) for buildRmmScript covering configPath, includeInstall, ErrorActionPreference=Stop - Barrel index.ts defining the public generators API for Phase 4 imports affects: - 02-02 (rclone-conf implementation must satisfy rclone-conf.test.ts) - 02-03 (intune-install and intune-detection implementations must satisfy their test files) - 02-04 (rmm-script implementation must satisfy rmm-script.test.ts) - 04-ui (imports generators from src/generators/index.ts barrel) # Tech tracking tech-stack: added: [] patterns: - "Nyquist TDD: all four generator test files written before any implementation exists" - "Fixture pattern: spread INITIAL_STATE then override only changed fields for typed WizardState fixtures" - "No Vitest imports needed — globals: true in vitest.config.ts provides describe/it/expect globally" key-files: created: - src/generators/rclone-conf.test.ts - src/generators/intune-install.test.ts - src/generators/intune-detection.test.ts - src/generators/rmm-script.test.ts - src/generators/index.ts modified: [] key-decisions: - "s3-compatible uses type = s3 (not type = s3-compatible) — rclone uses the s3 backend with provider = Other for S3-compatible endpoints" - "Empty string params omitted from rclone conf output — sas_url and region omitted when blank" - "buildIntuneDetection must NOT use $ErrorActionPreference — avoids STDERR contamination in Intune detection scripts" - "buildRmmScript MUST use $ErrorActionPreference = 'Stop' — RMM scripts should halt on error unlike detection scripts" - "All credential values embedded as literals in generated scripts — no PS variable interpolation inside config content" - "Barrel index.ts exports all four generators — Phase 4 uses this single entry point" patterns-established: - "Fixture pattern: { ...INITIAL_STATE, remote: { name, backendType, params } } for typed WizardState test fixtures" - "Generator test structure: describe per backend/scenario, it() per substring assertion — granular and readable" requirements-completed: [CONF-01, DEPL-01, DEPL-02, DEPL-03, DEPL-04, DEPL-05] # Metrics duration: 2min completed: 2026-03-26 --- # Phase 02 Plan 01: Generator Test Stubs Summary **Five files defining the full generators public API and all RED test assertions before any implementation: four Vitest test suites and one re-export barrel** ## Performance - **Duration:** 2 min - **Started:** 2026-03-26T09:52:19Z - **Completed:** 2026-03-26T09:54:08Z - **Tasks:** 2 - **Files modified:** 5 ## Accomplishments - Created four generator test files in RED state — each imports from a sibling module that does not yet exist, establishing the exact API contract Plans 02-04 must satisfy - Defined 38 granular test assertions spanning rclone INI config format, PowerShell script structure, Intune detection STDOUT constraints, and RMM script error handling - Created src/generators/index.ts barrel with four named re-exports — defines the public API Phase 4 will import from ## Task Commits Each task was committed atomically: 1. **Task 1: Write test stubs for all four generators** - `964022b` (test) 2. **Task 2: Create index.ts barrel** - `cc53bc0` (feat) **Plan metadata:** (docs commit follows) ## Files Created/Modified - `src/generators/rclone-conf.test.ts` - RED tests for buildRcloneConf (azureblob/s3/s3-compatible backends, error cases) - `src/generators/intune-install.test.ts` - RED tests for buildIntuneInstall (configPath, includeInstall, UTF-8 write, credential safety) - `src/generators/intune-detection.test.ts` - RED tests for buildIntuneDetection (configPath, exit codes, stdout-only, no STDERR contamination) - `src/generators/rmm-script.test.ts` - RED tests for buildRmmScript (configPath, includeInstall, ErrorActionPreference=Stop) - `src/generators/index.ts` - Re-export barrel for all four generator functions ## Decisions Made - s3-compatible backend uses `type = s3` (not `type = s3-compatible`) in rclone.conf — rclone uses the s3 backend type with `provider = Other` for compatible endpoints - Empty string params (e.g. sas_url, region) must be omitted from generated rclone config — tests assert via `not.toContain` - Intune detection scripts must NOT use `$ErrorActionPreference` — would contaminate stderr which Intune reads as a failure signal - RMM scripts MUST use `$ErrorActionPreference = 'Stop'` — unlike detection scripts, RMM agent environments expect halt-on-error - Credentials embedded as literal strings in generated PowerShell — no variable interpolation inside config content blocks ## Deviations from Plan None - plan executed exactly as written. ## Issues Encountered None. ## User Setup Required None - no external service configuration required. ## Next Phase Readiness - Wave 1 test stubs complete — Plans 02-02, 02-03, 02-04 can now implement generators against these assertions - All test assertions are importable and TypeScript-valid; only the implementation modules are missing - The barrel (index.ts) is structurally correct — will resolve once implementations exist --- *Phase: 02-generators* *Completed: 2026-03-26*