Variant options are clearly defined and enumerated
Why it matters
Variant options stored as free-form strings ('medium', 'Med', 'M') for the same logical value produce duplicate facets in filters, inconsistent add-to-cart payloads, and inventory mismatches when orders reference 'M' but the stock record uses 'Medium'. ISO 25010:2011 functional-correctness requires consistent behavior across the same logical input. Without an enum or lookup table, every new developer who touches the product creation form can introduce a new spelling, and there's no schema-level enforcement to catch it. Filter UIs built on free-form strings show three separate size options when there should be one.
Severity rationale
High because uncontrolled variant option strings produce inventory mismatches, broken filters, and add-to-cart failures when the selected string doesn't exactly match a database record.
Remediation
Define variant options as enum types or a reference table in prisma/schema.prisma so the database rejects any value not in the allowed set.
enum Size {
XS
S
M
L
XL
}
model ProductVariant {
id String @id @default(cuid())
productId String
product Product @relation(fields: [productId], references: [id])
size Size
color String
}
For more flexible option systems, use a separate OptionValue reference table and foreign key instead of a Prisma enum — this allows adding new values via migration rather than code change.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Catalog & Product Logic Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- iso-25010:2011 · functional-correctness — Functional Correctness (Functional Suitability)
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ecommerce-catalog·automated