Technical Debt — Package Master Gaps
| Metadata | Details |
|---|---|
| System | inventory-service — Package Master |
| Document ID | TD-2026-INV-004 |
| Author | Engineering Team |
| Status | Open |
Gap referenced from SR-023 and Architecture-00018.
TD-01 — package_material_type Not Enforced by a Database CHECK Constraint
Status: Open
Severity: Low
Affected component: "inventory-service".package_master schema; domain/packagemaster_validation.go
Evidence: The column accepting package_material_type has no CHECK (package_material_type IN ('BOX','FLYER','POLY_BAG','WRAPPER')) constraint at the schema level — the only guard against an invalid value is domain/packagemaster_validation.go’s application-level check, run inside service/packagemaster/Create/Update.
Impact: Any write path that doesn’t go through service/packagemaster/ — a direct database write, a future bulk-import job, a migration script — can insert or update a row with a package_material_type value outside the four intended enum members, and nothing at the database layer will reject it. Any consumer that switches on this field (the product wizard’s Package Map step, checkout’s volumetric-weight calculation) would then encounter an unrecognized value with undefined behavior.
Remediation direction: Add a CHECK constraint (or a native Postgres ENUM type) for package_material_type in a migration, so the invariant holds regardless of which code path writes the row.
Related requirement: SR-023 FR-06