docs(07-01): complete VALID-01 format validation plan

- Add 07-01-SUMMARY.md (registry + Zod regex chaining)
- Update STATE.md with progress, decisions, session
- Update ROADMAP.md phase 7 plan progress
This commit is contained in:
2026-03-31 09:51:25 +02:00
parent c6d38fa0f1
commit 057ba80b68
3 changed files with 108 additions and 6 deletions
+1 -1
View File
@@ -91,4 +91,4 @@ Plans:
| 4. Review, Download & Security | v1.0 | 5/5 | Complete | 2026-03-27 |
| 5. Tech Debt | 4/4 | Complete | 2026-03-30 | - |
| 6. New Backends | 4/4 | Complete | 2026-03-31 | - |
| 7. Validation & UX Polish | 1/3 | In Progress| | - |
| 7. Validation & UX Polish | 2/3 | In Progress| | - |
+8 -5
View File
@@ -3,14 +3,14 @@ gsd_state_version: 1.0
milestone: v1.1
milestone_name: Backlog & Tech Debt
status: planning
stopped_at: Completed 07-validation-ux-polish 07-00-PLAN.md
last_updated: "2026-03-31T07:46:44.916Z"
stopped_at: Completed 07-validation-ux-polish 07-01-PLAN.md
last_updated: "2026-03-31T07:51:06.768Z"
last_activity: 2026-03-27 — v1.1 roadmap created, 11 requirements mapped across 3 phases
progress:
total_phases: 3
completed_phases: 2
total_plans: 11
completed_plans: 9
completed_plans: 10
percent: 100
---
@@ -89,6 +89,7 @@ Progress: [░░░░░░░░░░] 0% (v1.1)
| Phase 06-new-backends P02 | 4min | 2 tasks | 4 files |
| Phase 06-new-backends P03 | 10min | 2 tasks | 1 files |
| Phase 07-validation-ux-polish P00 | 10min | 1 tasks | 1 files |
| Phase 07-validation-ux-polish P01 | 5min | 2 tasks | 2 files |
## Accumulated Context
@@ -118,6 +119,8 @@ Recent decisions affecting v1.1 work:
- [Phase 06-new-backends]: Three-branch ternary in RemoteConfigStep (azureblob/sftp/else) keeps custom logic minimal; OneDrive/GCS/B2 render entirely via registry loop
- [Phase 07-validation-ux-polish]: Do not use vi.useFakeTimers() in form-submit tests — fake timers + userEvent.setup() deadlock waitFor when testing React async form submissions
- [Phase 07-validation-ux-polish]: RED acceptance tests (accepts valid X) are inherently green before implementation — they serve as regression guards, not RED indicators
- [Phase 07-validation-ux-polish]: Cast (schema as z.ZodString).regex() — ZodTypeAny does not expose .regex() at type level in Zod v4
- [Phase 07-validation-ux-polish]: tooltipText added to FieldDef in Plan 07-01 (interface-only) to avoid second interface-only edit in Plan 07-02
### Pending Todos
@@ -132,6 +135,6 @@ None yet.
## Session Continuity
Last session: 2026-03-31T07:46:44.909Z
Stopped at: Completed 07-validation-ux-polish 07-00-PLAN.md
Last session: 2026-03-31T07:51:06.765Z
Stopped at: Completed 07-validation-ux-polish 07-01-PLAN.md
Resume file: None
@@ -0,0 +1,99 @@
---
phase: 07-validation-ux-polish
plan: "01"
subsystem: validation
tags: [zod, regex, form-validation, registry, tdd]
# Dependency graph
requires:
- phase: 07-validation-ux-polish
plan: "00"
provides: VALID-01 RED test stubs (4 reject tests + 3 acceptance tests)
provides:
- FieldDef interface with validate and tooltipText properties
- 3 registry entries with validate regex rules (azureblob.account, s3.region, gcs.project_number)
- buildZodSchema() chains .regex() when field.validate is present
affects:
- src/schemas/registry.ts
- src/schemas/index.ts
- RemoteConfigStep validation (via BACKEND_SCHEMAS consumed by zodResolver)
# Tech tracking
tech-stack:
added: []
patterns:
- "Zod v4 cast pattern: (schema as z.ZodString).regex() — ZodTypeAny does not expose .regex() at type level"
- "let schema + conditional .regex() + conditional .optional() allows optional validated fields in future"
- "Registry-driven validation: validate property on FieldDef flows through buildZodSchema() automatically"
key-files:
created: []
modified:
- src/schemas/registry.ts
- src/schemas/index.ts
key-decisions:
- "Cast (schema as z.ZodString).regex() — ZodTypeAny does not expose .regex() in TypeScript but it is present at runtime in Zod v4"
- "tooltipText added to FieldDef in this plan (interface-only, no behavior) to avoid a second interface-only edit in Plan 07-02"
- "Optional field chaining order: z.string() first, then .regex() if present, then .optional() — ensures regex fires before optional short-circuit"
# Metrics
duration: 5min
completed: 2026-03-31
---
# Phase 7 Plan 01: VALID-01 Format Validation — FieldDef + Registry + Zod Chaining Summary
**Regex validation wired from BACKEND_REGISTRY through buildZodSchema() to zodResolver: azureblob account, s3 region, and gcs project_number now reject malformed values with inline error messages**
## Performance
- **Duration:** ~5 min
- **Started:** 2026-03-31T09:48:00Z
- **Completed:** 2026-03-31T09:53:00Z
- **Tasks:** 2
- **Files modified:** 2
## Accomplishments
- Extended `FieldDef` interface with `validate?: { regex: RegExp; message: string }` and `tooltipText?: string`
- Added validate rules to 3 registry entries:
- `azureblob.account`: `/^[a-z0-9]{3,24}$/` — "Must be 324 lowercase alphanumeric characters (no hyphens or uppercase)"
- `s3.region`: `/^[a-z][a-z0-9-]+[a-z0-9]$/` — "Must be a valid AWS region format (e.g. us-east-1)"
- `gcs.project_number`: `/^\d+$/` — "Must contain digits only"
- Extended `buildZodSchema()` to chain `.regex()` via `(schema as z.ZodString).regex()` when `field.validate` is present
- VALID-01 test suite: 4 reject tests GREEN, 3 acceptance tests remain GREEN
- Full suite: 154 passing, 5 failing (all UX-01 tooltip tests — Plan 07-02 scope)
## Task Commits
1. **Task 1: Extend FieldDef and add validate rules to 3 registry entries** - `3dea5c8`
2. **Task 2: Extend buildZodSchema() to chain .regex() from field.validate** - `c6d38fa`
## Files Created/Modified
- `src/schemas/registry.ts` — FieldDef interface extended with validate/tooltipText; 3 registry entries enriched with validate rules; 14 lines added
- `src/schemas/index.ts` — buildZodSchema() loop body replaced with let schema + conditional regex + conditional optional pattern; 12 lines added, 2 removed
## Decisions Made
- `(schema as z.ZodString).regex()` cast is required because `schema` is typed `ZodTypeAny` but Zod v4 exposes `.regex()` at runtime. TypeScript type cast is the correct approach here — verified working.
- `tooltipText?: string` added to `FieldDef` in this plan (interface-only, no behavior rendered yet) to avoid a second interface-only touch in Plan 07-02. This is a zero-risk addition.
- Optional fields use `z.string()` as base (not `z.string().optional()`) before regex chaining, then `.optional()` is appended last. This ensures regex validation fires for non-empty optional fields while still allowing empty strings to pass.
## Deviations from Plan
None — plan executed exactly as written.
## Issues Encountered
None — TDD cycle completed cleanly. RED confirmed (9 failing before Task 2), GREEN achieved after Task 2 (4 VALID-01 reject tests now pass, 5 UX-01 tooltip tests remain failing as expected).
## Next Phase Readiness
- Plan 07-02 (UX-01 tooltip toggle) has clear targets: all 5 UX-01 tests must turn green by adding `tooltipText?` content to sas_url/SFTP/OneDrive registry entries, adding ⓘ button to FieldRenderer, and adding SftpAuthToggle standalone tooltip
- `tooltipText` is already on `FieldDef` interface — Plan 07-02 only needs to populate values and render the UI
---
*Phase: 07-validation-ux-polish*
*Completed: 2026-03-31*