Each rule now has one owning contract; others point to it: validation and multi-step rules live in forms-validation (modal-workflows references them), pagination metadata lives in go-api (table-management references it), the async task flow lives in go-background-tasks (go-api references it), backup git-safety checks live in backup-management (go-database references it). Remove the leftover Vapor/Aqua baseline mention and stale kit/patterns paths, compress the batch-file-upload ADR narrative, and drop content-free pattern READMEs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
Contract: Forms + Validation + Suggestions
Version: 1.1
This contract owns validation UX and multi-step flow rules for all form surfaces,
including modals (modal-workflows adds only modal-specific mechanics).
Form Structure
- Group fields semantically and keep labels explicit.
- Inputs requiring suggestions may use
datalistor equivalent autocomplete UI. - Suggestion sources must represent the full relevant scope (not only visible rows from paginated tables).
Validation
- Validate on submit server-side. Client-side validation is optional progressive enhancement only.
- Surface validation errors inline near fields and in a form-level summary when helpful.
- Validation messages must be human-readable and action-oriented: "Serial number is required" — not "serial_number: cannot be null".
- Do not hide required-field errors behind generic submit failures.
Multi-Step Flow
Recommended stages:
editreviewconfirm/submitresult
Rules:
- Users must be able to return from review to edit without losing entered values.
- The confirm step must summarise what will happen before a destructive or irreversible action.
- Destructive or irreversible actions require explicit confirmation.
- Query- or state-driven step transitions should be deterministic and testable.
File Inputs in Forms
- If a workflow includes upload, the file control should be clearly labeled and the supported formats explicit.
- Import parsing/preview may be delegated to a dedicated import/export pattern, but the form contract must remain clear.