Karyo
Documentation/ Decision records

ADR 0031: The console has no locked state, and Loci is the slotting engine behind Karyo's facts and constraints

Karyo 2.1.1rendered at build time
On this page

Status: Accepted. Supersedes in part ADR 0029 (the slotting advisor positioning), ADR 0030 (the console's locked states) and ADR 0016 (the console's page-level add-on gate and the floor app's licence-free menu claims). Superseded in part by ADR 0033 (the built-in reference advisor that answers without Loci, and the SlottingStrategy SPI behind it) and ADR 0034 (the advice call sent with no credentials) and ADR 0052 (navigation that reads the caller's permissions and nothing else, and the engines shown on every installation: the profile now decides which capabilities show).

Context

ADR 0029 made Karyo one Apache-2.0 product and named Loci as the canonical slotting engine, with the integration queued for a later phase. ADR 0030 retired every server-side licence gate and kept GET /api/v1/license and the KARYO_LICENSE* settings only as a compatibility bridge, while noting that the console's locked states were still in the code: the six engine pages and the admin's Document templates page asked a licence hook before they queried, navigation placed those pages in a collapsed Add-ons group with a lock glyph, the Exceptions page withheld its monitor-alert count, the Items page replaced its class chips with a "comes with the Slotting add-on" lock, and the order-strategy form showed "Requires the ... add-on" hints. Those states showed whenever the licence request failed or, in three places, while it was pending. On a product with nothing to withhold they were false, and the copy behind them - "paid add-on", "contact your account team" - described a product that no longer exists.

Slotting had the same problem in a different form. karyo-slotting-core presented a "Slotting advisor" of its own, while the product's decision was that Loci owns slotting analysis. Loci is a separate Apache-2.0 product with a neutral contract (POST /api/v1/recommend, contract 1.0.0), a read-only adapter for Karyo's REST API on its side, and a fixed division of responsibility: it analyses and advises, and the system of record owns the facts, the hard constraints, authorization, human review and the application of accepted changes. Nothing in Karyo called it.

Three constraints bind the change:

  • Nothing may become an always-enabled fiction. A permission denial, an external dependency that is not there, an optional integration that is not configured, and a backend failure must each stay visible as what they are.
  • The boundary with Loci must be exact. Karyo keeps the facts, the constraints, authorization, review, applying changes and the UI; Loci keeps analysis and advice; Loci stays optional and independently deployable; no exact-bin claim is made anywhere.
  • The compatibility bridge stays. ADR 0030's endpoint and settings keep their contract for integrations; only the console stops reading them.

Decision

  • The console carries no licence awareness. features/license/ is deleted. Navigation has five groups (Overview, Inbound, Fulfillment, Warehouse, Insights), a NavItem carries no entitlement metadata, and getGroupedNavItems(permissions) takes the caller's permissions and nothing else. The locked state kind and the withheld metric truth are removed from the shared components. Every engine page renders through its normal path; the role guard, the loading, empty, error and permission states, and the describeAction toasts are the only things between a caller and a page.
  • The Exceptions page, the Control dashboard and the Items page treat the engines as ordinary data sources. The monitors engine's firing alerts are one more check and one more card; the ABC class chips and class filters show on every installation, and an item the engine has no advice on shows a neutral No class yet dash chip. The order-strategy form names both built-in packout strategies, ONE_TO_ONE and CARTONIZATION.
  • Karyo calls Loci, when an operator names it. karyo.slotting.loci.base-url (KARYO_LOCI_BASE_URL) is an ops-controlled entry of SystemPropertyCatalog, resolved like every runtime knob and never writable by a goods owner; karyo.slotting.loci.timeout tunes the call. Karyo always asks for the auto level, so Loci itself decides how deep the evidence goes (L1, or L2 once every location a placement references has a zone). SlottingService reads Karyo's facts - pickable stock with its on-hand quantity, picks in the demand window, zones and location order, fixed-location assignments - builds Loci's neutral contract from them, POSTs it as one multipart request with no credentials and no redirects, and maps the answer to SlottingAdviceDto: the engine that answered, the advice level, the validity window, and one row per SKU with its class, rank, direction, target zone, review ask, reason and severity.
  • Karyo enforces its hard constraints whatever the engine said. A SKU with a fix assignment is shown as HOLD with every fixed location named on the row, wherever the engine found the SKU and for Loci's advice and the reference advisor's alike. Nothing on the Slotting page moves stock; an accepted move is applied through Karyo's own workflows.
  • Without Loci, the built-in reference advisor answers, labelled as such. It is the built-in abc-proximity reference advisor, which ranks ABC velocity against location order index, lists only the SKUs whose class and location disagree, and offers no zone or slot-class advice; the envelope says engine.kind = reference, configured = false, and the page tells the reader which setting connects Loci. It is a fallback, not a competing product, and the SPI is the seam behind that path only, never the way Loci is integrated. A goods owner with no pickable stock or no picks in the window has nothing any engine can rank: Loci is not asked, and the envelope says level = none.
  • A zone name Loci's contract cannot carry is refused before the request. Karyo allows zone names up to 100 characters, Loci's contract caps locations[].zone at 64, and Karyo never truncates, omits or hashes the evidence into a lie: the contract builder detects the incompatibility before Loci is called, and the advice is a 502 problem (slotting-engine-unavailable) telling the operator to rename the zone.
  • A configured Loci that does not answer is an error, never a silent fallback. An unreachable engine, a timeout, a non-200 answer or an unreadable body is a 502 problem of type slotting-engine-unavailable; a 422 from Loci is slotting-snapshot-rejected with Loci's findings in the detail. The page shows the detail and a retry named for the action.
  • No exact-bin claim. Karyo asks Loci for the auto level only, so Loci itself decides L1 or L2 from the evidence and L3 exact-bin advice is never requested; the console's copy and the documentation never promise a target bin.
  • Documentation says what the product does. The locks, the "paid add-on" copy and the "Slotting advisor" positioning leave every guide; docs/commercial/ becomes docs/capabilities/ and the engine-boundaries document carries the Loci boundary. ADRs 0020, 0021, 0029 and 0030 are kept as history, and ADR 0016's superseded parts are marked: apart from the targets of links to documents this record moved and the status annotations naming the superseded parts, their historical text is unchanged; this record completes the work the last two deferred.

Consequences

  • Every capability appears as an ordinary part of the product, at desktop and phone widths, with the same navigation, states, typography and focus order as every other page.
  • The console makes one request fewer on every load, and a failing licence endpoint can no longer lock a screen.
  • The demo warehouse gets slot-class advice when Loci is connected: every demo location has a zone, so Loci grants L2. The demo's storage zones carry the tiers of Loci's reference policy (FORWARD, MID, RESERVE) and each SKU but one sits in one bin, so Loci can advise Promote, Demote or Hold. The exception is the below-min SKU, which also has a reserve load so a replenishment scan has stock to move; it is pinned by a fixed-location assignment and reads Hold, as does a SKU on a dock, which has no tier. Because Karyo always asks for the auto level, Loci reports what the evidence grants and never refuses a level.
  • Loci is a network dependency only when configured. An installation without it is served by the built-in reference advisor through the same advice envelope: fixed-location holds, review and zone fields, holds sorted last, and an honest label.
  • The response of GET /api/v1/slotting/recommendations changed shape, from a bare array to the advice envelope. The route is in no consumer contract; the console and its tests moved with it.
  • The SlottingStrategy SPI is narrower in meaning. It still exists and lists in the admin's SPI catalogue, but it now names the built-in reference advisor only and serves the path without Loci; a custom advisor is not how Loci is integrated.

Alternatives considered

  • Hide the locked states behind a constant true. Rejected: the components, the copy and the entitlement metadata would stay in the code as dead paths that any refactor could revive, and the navigation tests would keep asserting a product that does not exist.
  • Fall back to the reference advisor when a configured Loci is down. Rejected: an outage of the engine an operator chose is a fact the screen must show; a silent fallback would present the reference advisor's ranking as Loci's.
  • Integrate Loci as a SlottingStrategy implementation. Rejected: the SPI's input is Karyo's velocity and slot lists, not Loci's contract, and its output has no level or validity window; Loci's envelope would have been flattened into a shape that cannot say what it is.
  • Let Karyo call Loci's read-only Karyo adapter instead of sending the contract. Rejected: Loci would then hold Karyo credentials and read Karyo's API on its own schedule; sending the contract keeps Karyo as the only side that holds the facts and the credentials.
  • Remove karyo-slotting-core and its strategy. Rejected: the reference advisor is the behaviour an installation without Loci gets, and removing it would make slotting a capability that silently does nothing until a second product is deployed.
  • Delete the GET /api/v1/license bridge with the console's use of it. Rejected: ADR 0030's reasons stand; integrations may still read it.

Evidence

  • frontend/web/src/config/navigation.ts - five groups, no entitlement metadata, getGroupedNavItems(permissions)
  • frontend/web/src/components/state/state-panel.tsx, frontend/web/src/components/metric/metric.tsx - no locked kind, no withheld truth
  • frontend/web/src/pages/__tests__/engine-pages.test.tsx - every engine page renders live and the console never requests /api/v1/license
  • frontend/web/src/config/__tests__/navigation.test.ts - the sidebar groups
  • frontend/web/src/pages/insights/slotting-page.tsx, slotting-engine-strip.tsx, slotting-detail.tsx - the page, the engine strip, the constraints Karyo enforces
  • services/slotting-service/karyo-slotting-core/src/main/kotlin/com/karyo/slotting/service/SlottingService.kt
    • the Loci path, the reference path, holdFixed
  • services/slotting-service/karyo-slotting-core/src/main/kotlin/com/karyo/slotting/loci/ - the contract, its builder, the client
  • services/slotting-service/karyo-slotting-core/src/main/kotlin/com/karyo/slotting/exception/SlottingExceptionMapper.kt
    • the two 502 problems
  • services/auth-service/karyo-auth-core/src/main/kotlin/com/karyo/auth/config/SystemPropertyCatalog.kt
    • karyo.slotting.loci.base-url, ops-controlled
  • services/karyo-app/src/test/kotlin/com/karyo/slotting/SlottingLociApiTest.kt - Loci configured over HTTP, and a Loci that is down as a 502
  • tests/e2e/tests/profiles.spec.ts - the engine screens open with no licence request while the bridge still answers