Problem
insertCollectionField(..., { generateUniqueLabel: true }) normalizes a generated label through nextAvailableFieldLabel but does not reject a blank normalized base. A future caller can therefore persist an empty field label, bypassing the Collection schema invariant introduced by #205.
The current FieldMenu caller passes "New field", so this is not user-reachable in the released UI. It remains a data-layer correctness gap.
Outcome
Generated field insertion preserves the same non-blank, trimmed, case-insensitive unique-label contract as every other field write.
Acceptance criteria
- A whitespace-only label with
generateUniqueLabel: true throws ValidationError("Field label cannot be blank").
- The failed transaction leaves the Collection schema unchanged.
- Repeated non-blank generated insertion continues to produce
New field, New field 2, and so on.
Evidence
Problem
insertCollectionField(..., { generateUniqueLabel: true })normalizes a generated label throughnextAvailableFieldLabelbut does not reject a blank normalized base. A future caller can therefore persist an empty field label, bypassing the Collection schema invariant introduced by #205.The current
FieldMenucaller passes"New field", so this is not user-reachable in the released UI. It remains a data-layer correctness gap.Outcome
Generated field insertion preserves the same non-blank, trimmed, case-insensitive unique-label contract as every other field write.
Acceptance criteria
generateUniqueLabel: truethrowsValidationError("Field label cannot be blank").New field,New field 2, and so on.Evidence
src/lib/data/collection-ops.ts:nextAvailableFieldLabeltrims but does not reject an empty base.FieldMenu.svelte, which passes"New field".