SR-024 — Category Master: Administration System Requirements
| Metadata | Details |
|---|---|
| System Name | product-catalog — Category Master |
| Document ID | SR-2026-PCT-002 |
| Author | Engineering Team |
| Status | Approved |
Traces back to BRD-023.
See it first: Admin UI Walkthrough — Category Master Console
This document covers product-catalog’s MongoDB categories collection and its Go REST/gRPC surface (/product/admin/api/v1/category), plus the ui-admin-application’s features/category/ admin UI that drives it. It does not restate how a product is assigned to a leaf category during product setup, or how shop-service consumes the category tree for storefront display — both are separate consumers of this data, not this document’s concern.
Functional Requirements
Category Console Page (CategoryPage.tsx / CategoryController.ts, route /category)
FR-01 (Cascading Three-Panel Layout): The console renders three stacked LevelSection panels — root categories, the selected root’s sub-categories, and the selected sub-category’s leaf categories. Selecting a node in one panel populates the panel below it; there is no search, filter, pagination, or sort on any panel. (Gap — tracked as Technical Debt — TD-00018.)
FR-02 (Inspector Panel): Selecting any node at any level shows a breadcrumb (its full ancestor lineage) and Edit/Delete actions in an Inspector Panel.
FR-03 (Add/Edit Drawer, Per-Level Sub-Forms): Adding or editing a node opens a right-side Drawer hosting one of three level-specific sub-forms: pages/CategoryRootLeafPage.tsx (level 0), pages/CategorySubcatsLeafPage.tsx (level 1), or pages/CategoryLeafNodesPage.tsx (level 2), selected by the node’s nodeLevel.
FR-04 (Root Category Fields, Level 0): A root category’s form captures name (required), slug (required, auto-derived from name, unique per tenant, editable), and specTemplate (required, non-empty list of specification field names every product-specification form beneath this root must include).
FR-05 (Sub-Category Fields, Level 1): A sub-category’s form captures name, slug, displayOrder, and variantAttributes (required, non-empty list of {attributeId, name, type: 'select' | 'swatch', standardValues} — the shared product attributes every leaf category and product beneath this sub-category inherits). mainDisplayCategory is always true for a level-1 node, set deterministically by the server, not an editable form field.
FR-06 (Leaf Category Fields, Level 2): A leaf category’s form captures name, slug, and displayOrder. mainDisplayCategory is always false for a level-2 node (deterministic, not editable); featured mirrors the same deterministic value.
FR-07 (Slug Uniqueness): slug is validated unique per tenant server-side, regardless of level.
FR-08 (Tree Position Is Immutable After Creation): PUT /product/admin/api/v1/category/:id only accepts name, slug, spec_template, display_order, main_display_category, and variant_attributes — parent_id and nodeLevel are never accepted on update. Re-parenting a category, or changing its level, is not a supported operation, per ADR-00038.
FR-09 (Server-Computed Ancestors): ancestors (the full chain of ancestor IDs) is computed by product-catalog once, at insert time only, from the parent’s own ancestors plus the parent’s ID — it is never accepted from the client on create or update, and never recomputed afterward.
FR-10 (Delete, Blocked by Existing Children): The Inspector Panel’s Delete action, after a confirmation Dialog, calls DELETE /product/admin/api/v1/category/:id (204 on success). The call is rejected if the category still has any sub-category or leaf category beneath it, per BRD-023 BR-03.
FR-11 (No Lifecycle/Status Model): Every category’s active field is hardcoded true server-side with no toggle — unlike Warehouse Master and Package Master, Category Master has no DRAFT/PUBLISHED/ARCHIVED lifecycle; a category is either fully present or hard-deleted (subject to FR-10’s guard). This is a deliberate scope difference, not an oversight — BRD-023 never asked for a staged-publish workflow for categories.
FR-12 (Reads Powering the Console): GET /product/admin/api/v1/category returns the flat, minimal field set that powers all three LevelSection panels; GET /product/admin/api/v1/category/:id returns the full record, used to prefill the Edit drawer’s per-level sub-form.
FR-13 (Separate Consumer — Product Wizard Category Picker): GET /product/admin/api/v1/category/product-categories returns every leaf category together with its parent sub-category’s variantAttributes, for the product-setup wizard’s category-picker step — a different UI, not CategoryPage.tsx itself, consuming the same collection this document administers.
FR-14 (gRPC Read Access — shop-service): category.proto’s CategoryQueryService.GetCategoriesByIDs is a read-only gRPC method shop-service calls to resolve category details for storefront display; it is not involved in anything this console writes.
Non-Functional Requirements
Composition & Reuse
ui-admin-application’s features/category/CategoryRepository.ts is the only file in the feature that imports apiClient, per the Feature Triad convention. features/category/categoryService.ts is named in lowercase, diverging from every other feature’s <Feature>Service.ts PascalCase convention. (Gap — tracked as Technical Debt — TD-00018.)
Multi-Tenancy & Auth Propagation
Every REST call carries the caller’s tenant/user/role via the standard AuthClaims header contract; tenant_id on a categories document is sourced from the auth context, never the request body.
Client-Side DEV_MOCK Fallback — Absent Here, Unlike Other Features
CategoryRepository.ts has no DEV_MOCK_* fallback, despite being the admin app’s own documented canonical reference feature for the Feature Triad pattern. (Gap — tracked as Technical Debt — TD-00018.)
Dead Audit Fields in API Response
categories documents in MongoDB carry description, createdAt, and updatedAt, but CategoryResponse never surfaces them to any caller. (Gap — tracked as Technical Debt — TD-00018.)
Related Documents
- BRD-023 — Category Master: Maintaining the Product Category Hierarchy
- ADR-00038 — Adjacency List with Denormalized Ancestors, and Immutable Tree Position, for Category Master
- Architecture — Category Master: Three-Level Hierarchy Administration
- Technical Debt — Category Master Gaps
- Admin UI Walkthrough — Category Master Console
- Microservices: product-catalog, shop-service