Summary
Category writes accept empty/whitespace names, missing parents, self-parenting, and cycles. Deletion does not define child handling and can reassign products to the category being deleted. COALESCE-based updates also prevent explicit clearing of nullable catalog fields.
Current behavior
main/routes/categories.ts:59-107,135-148 accepts invalid parent relationships and empty names.
- Category deletion does not reject
reassign_to equal to the category being deleted.
COALESCE update expressions in category/product/add-on routes treat explicit null as “preserve existing value”.
Expected behavior
The category hierarchy should remain valid, deletion/reassignment behavior should be explicit and transactional, and omitted fields should be distinguishable from explicit null-clears.
Acceptance criteria
- Trim and require non-empty category names.
- Require existing active parents and reject self/ancestor cycles.
- Reject reassignment to the category being deleted.
- Define and test child-category handling on parent deletion.
- Use presence-aware update semantics so explicit null can clear nullable catalog fields.
Relevant files
main/routes/categories.ts, main/routes/products.ts, main/routes/addon-groups.ts
Summary
Category writes accept empty/whitespace names, missing parents, self-parenting, and cycles. Deletion does not define child handling and can reassign products to the category being deleted. COALESCE-based updates also prevent explicit clearing of nullable catalog fields.
Current behavior
main/routes/categories.ts:59-107,135-148accepts invalid parent relationships and empty names.reassign_toequal to the category being deleted.COALESCEupdate expressions in category/product/add-on routes treat explicitnullas “preserve existing value”.Expected behavior
The category hierarchy should remain valid, deletion/reassignment behavior should be explicit and transactional, and omitted fields should be distinguishable from explicit null-clears.
Acceptance criteria
Relevant files
main/routes/categories.ts,main/routes/products.ts,main/routes/addon-groups.ts