Karyo
Documentation/ Decision records

ADR 0059: Location Class names the usage role

Karyo 2.1.1rendered at build time
On this page

Status: Accepted

Context

The former Area is a mandatory location reference carrying usage codes, not a physical part of a building. That name confused the usage role with the future physical hierarchy. Karyo 2.0.0 has not shipped, so the contract can change without a compatibility alias.

Decision

Rename the usage role to Location Class throughout storage, Kotlin, REST and the console. Use LocationClass, location_class and /api/v1/location-classes in their respective contracts. Keep every usage code unchanged. STORAGE does not mean bulk, nor PICKING loose; location types and Warehouse setup's storage kind continue to express that distinction.

Reserve Area for the separate physical hierarchy Area > Zone > Aisle > Bay > Level > Position. This change does not implement that hierarchy. StorageArea, WorkingArea, StorageStrategyArea and ItemDataArea still describe named sets of clusters and retain their names.

Consequences

Clients must change areaId to locationClassId, area to locationClass, setup's areas to locationClasses, areasCreated to locationClassesCreated, and occupancy's areaUsages to locationClassUsages. Old paths have no alias.

The location label template (/templates/location-label.zpl) fills in locationClassName where it filled in areaName, with no alias. A stored override of that template must replace {areaName} with {locationClassName}, or printing a Location label fails to render.

A forward migration preserves existing row identities, references and usages. Its version is 1605 because it must follow the historical reporting migrations that still create views from areas; placing it in layout's 300 band would break a fresh installation. PostgreSQL preserves view dependencies when tables and columns are renamed. The migration explicitly renames kpi_location_occupancy.area_usages to location_class_usages, deliberately breaking that previously LOCKED output contract before 2.0.0 rather than leaving a misleading alias.

No existing CSV header, MCP tool name or Loci contract field names this role. They need no rename. The MCP listLocations projection never carried a Location Class id and still does not. There is no OpenAPI document or generator in this repository; the HTTP surface owns that fact and the changed contract inventory. Existing decision records remain historical text.

Alternatives considered

  • Keeping Area would preserve the ambiguity and obstruct a distinct physical Area.
  • Keeping compatibility aliases would give one concept two names before the first release.
  • Renaming the cluster sets would conflate different concepts and change unrelated contracts.

Evidence

  • services/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/domain/model/LocationClass.kt
  • services/warehouse-layout-service/karyo-layout-core/src/main/kotlin/com/karyo/layout/api/v1/LocationClassResource.kt
  • services/karyo-app/src/main/resources/db/migration/layout/V1605__rename_usage_role_to_location_class.sql