--- phase: 06-new-backends plan: "02" subsystem: ui tags: [sftp, rclone, react, typescript, react-hook-form, css-hidden-toggle] # Dependency graph requires: - phase: 06-00 provides: BackendType union with sftp, BACKEND_REGISTRY stub with sftp placeholder comment provides: - sftp entry in BACKEND_REGISTRY with host, user, pass, key_pem fields - sftp in BACKEND_SCHEMAS and RCLONE_TYPE_MAP - SftpAuthToggle.tsx component following AzureAuthToggle CSS-hidden pattern - onedrive, gcs, b2 entries added to BACKEND_SCHEMAS and RCLONE_TYPE_MAP affects: [06-03, 06-04] # Tech tracking tech-stack: added: [] patterns: - "SftpAuthToggle CSS-hidden tab toggle: both fields always registered with react-hook-form, visibility controlled via div.block/div.hidden" - "RCLONE_TYPE_MAP maps gcs to 'google cloud storage' (with spaces) — rclone native type string" key-files: created: - src/components/wizard/SftpAuthToggle.tsx modified: - src/schemas/registry.ts - src/schemas/index.ts - src/generators/rclone-conf.ts key-decisions: - "sftp key_pem field name matches rclone SFTP config key (not key_file) — verified against registry" - "SftpAuthToggle follows AzureAuthToggle CSS-hidden pattern exactly (div.block/div.hidden, both fields always registered)" - "BACKEND_SCHEMAS extended with all 7 backends in this plan (not just sftp) — avoids partial state" - "RCLONE_TYPE_MAP also extended with onedrive, gcs, b2 in this plan — all 7 backends now complete" patterns-established: - "Auth toggle pattern: CSS-hidden (not conditional render) preserves field values across tab switches" - "SftpAuthToggle tab labels: 'Password' and 'Private Key' (exact text required by RemoteConfigStep tests)" requirements-completed: [BACK-02] # Metrics duration: 4min completed: 2026-03-30 --- # Phase 06 Plan 02: SFTP Data Layer and SftpAuthToggle Summary **SFTP registry entry with host/user/pass/key_pem added to all three data layers plus SftpAuthToggle.tsx component using CSS-hidden tab pattern matching AzureAuthToggle** ## Performance - **Duration:** ~4 min - **Started:** 2026-03-30T16:11:00Z - **Completed:** 2026-03-30T16:14:20Z - **Tasks:** 2 - **Files modified:** 4 ## Accomplishments - Added sftp entry to BACKEND_REGISTRY with all four rclone field keys (host, user, pass, key_pem) - Extended BACKEND_SCHEMAS and RCLONE_TYPE_MAP to cover all 7 backends (sftp, onedrive, gcs, b2 added) - Created SftpAuthToggle.tsx with CSS-hidden Password/Private Key tab toggle, both fields always registered with react-hook-form - All 55 registry and rclone-conf tests pass; zero TypeScript errors ## Task Commits Each task was committed atomically: 1. **Task 1: Add sftp entry to registry.ts, index.ts, and rclone-conf.ts** - `c1d61d3` (feat) 2. **Task 2: Create SftpAuthToggle.tsx** - `dde2a1f` (feat) ## Files Created/Modified - `src/schemas/registry.ts` - Added sftp entry with host, user, pass, key_pem fields; removed placeholder NOTE comment - `src/schemas/index.ts` - Added sftp, onedrive, gcs, b2 to BACKEND_SCHEMAS - `src/generators/rclone-conf.ts` - Added sftp, onedrive, gcs (google cloud storage), b2 to RCLONE_TYPE_MAP - `src/components/wizard/SftpAuthToggle.tsx` - New component: Password/Private Key tab toggle following AzureAuthToggle CSS-hidden pattern ## Decisions Made - BACKEND_SCHEMAS and RCLONE_TYPE_MAP were extended for all 7 backends in this plan (not just sftp) — the test stubs for onedrive, gcs, b2 were already failing and all 3 required the same data layer wiring - SftpAuthToggle button text: "Password" (exact) and "Private Key" — matches RemoteConfigStep test assertions for `{ selector: 'button' }` pattern matching ## Deviations from Plan **1. [Rule 1 - Bug] Extended BACKEND_SCHEMAS and RCLONE_TYPE_MAP for all 7 backends, not just sftp** - **Found during:** Task 1 (running rclone-conf.test.ts) - **Issue:** Tests for onedrive, gcs, b2 were failing (type = undefined) because RCLONE_TYPE_MAP and BACKEND_SCHEMAS only had 3 entries. These backends were added to BACKEND_REGISTRY in the same phase (06-01) but their downstream entries were missing. - **Fix:** Added onedrive, gcs (google cloud storage), b2 to both RCLONE_TYPE_MAP and BACKEND_SCHEMAS in the same task - **Files modified:** src/schemas/index.ts, src/generators/rclone-conf.ts - **Verification:** All 55 registry and rclone-conf tests pass - **Committed in:** c1d61d3 (Task 1 commit) --- **Total deviations:** 1 auto-fixed (Rule 1 - Bug) **Impact on plan:** Required for test correctness. No scope creep — these entries were already needed by Plan 01's backends. ## Issues Encountered - RemoteConfigStep.test.tsx SFTP toggle tests (4 tests) remain failing — expected per plan (Plan 03 wires SftpAuthToggle into RemoteConfigStep). The component exists and is importable; wiring is deferred to 06-03. ## Next Phase Readiness - SftpAuthToggle.tsx ready to be imported by RemoteConfigStep in Plan 03 - All 7 backend data layers complete (registry, schemas, rclone type map) - Plan 03 (06-03) can wire SftpAuthToggle into RemoteConfigStep and add remaining backend forms --- *Phase: 06-new-backends* *Completed: 2026-03-30*