Strategies and runtime configuration
The different places Karyo's behaviour is configured from, what each is authoritative for, and which knobs an integrator or implementer can actually reach.
1. Five mechanisms, deliberately distinct
Karyo's behaviour is set in five places, and they should not be confused with one another: typed
strategy-entity columns, strategy JSONB keys, the runtime system_properties store, MicroProfile
configuration from application.yaml and the environment (which is also the third rung of the
system_properties ladder), and CDI strategy beans
(ADR 0018).
| Mechanism | Scope | Changed by | Validated |
|---|---|---|---|
OrderStrategy columns |
instance-wide (no businessUnitId) |
PUT /api/v1/order-strategies/{id} |
Typed columns, bean validation |
StorageStrategy columns |
per Facility (FacilityEntity) |
PUT /api/v1/storage-strategies/{id} |
Typed columns |
OrderStrategy.extensionProperties |
instance-wide | same PUT | Fourteen product-owned keys checked on write; every other key must start with ext. |
system_properties |
per client, with a client-0 fallback | PUT /api/v1/system-properties/{key} |
Catalogued keys type-checked; non-catalogued keys require ext. |
karyo.* MicroProfile config |
instance-wide | environment variable at deploy | none beyond type coercion |
| CDI strategy beans | instance-wide | rebuild (extension SPIs) | boot-time name validation, for the name-selected seams |
2. OrderStrategy is instance-wide; StorageStrategy is per owner
OrderStrategy carries fourteen typed columns - the reservation flags (useLockedStock,
preferComplete, preferMatching, completeHandling, enforceLot), the four named-strategy
selectors (shortPickMode, shortfallStrategy, pickDifferenceStrategy, packoutStrategy), the
four progression flags (sendToPacking, sendToShipping, createShippingOrder,
createTypeOrders) and defaultDestinationLocationId - plus the JSONB column. It extends
BaseEntity, not TenantEntity, and its KDoc gives the reason: "System-level order configuration (no clientId - silo tenancy makes the company
implicit)" (OrderStrategy).
StorageStrategy extends FacilityEntity and is therefore per Facility
(StorageStrategy). So does FixAssignment, and so does ItemDataArea.
The consequence: one holder of orders.write at the Company node, which the order-strategy writes
require
(services/order-service/karyo-orders-core/src/main/kotlin/com/karyo/orders/service/OrderStrategyService.kt, OrderStrategyService.requireCompanyWrite), tunes allocation and packout for every goods owner in the
silo, and the KDoc's "silo tenancy makes the company implicit" is true of the company and silent
about the goods owner (Strategies and policies covers
it from the administrator's side). Seen from an integration, GET /api/v1/order-strategies and
GET /api/v1/storage-strategies return collections with opposite tenancy semantics and nothing on
the wire distinguishes them. Neither OrderStrategyResponse (in services/order-service/karyo-orders-api/src/main/kotlin/com/karyo/orders/dto/OrderStrategyDtos.kt) nor
StorageStrategyResponse (StorageStrategyResponse) carries a businessUnitId, so a caller
reading the two collections cannot tell that editing one changes every goods owner's behaviour while
editing the other changes one Facility's. Only CreateOrderStrategyRequest says so, in a KDoc.
3. The JSONB "relief valve" is where Karyo keeps engine configuration
order_strategies.extension_properties is a JSONB NOT NULL DEFAULT '{}'
(V401__create_order_strategies.sql, order_strategies). Its entity KDoc describes it as "the relief valve for
extension config instead of new columns" (OrderStrategy).
Karyo itself stores fourteen un-namespaced keys in that same map. They are declared in
karyo-orders-api and parsed in karyo-orders-core, and they are read by the two
engines that release orders - wave fulfilment and order streaming:
- Wave (
OrderReleasePort, parsed atDefaultOrderReleasePort.parseConfig):waveAutoRelease,waveMaxOrders,wavePickMode,waveShortageAction,waveSelectionStrategy,waveDueWithinDays,waveMinPrio,waveIncludeUndated,waveSelectionRuleId - Streaming (
OrderReleasePort, parsed atStreamingConfigParser):releaseMode,streamBatchSize,streamMaxWaitSeconds,streamAbandonSeconds,streamTimingStrategy
These fourteen keys are reserved and validated on create and on an update that sends extensionProperties. Every other key must start
with ext.; an extension should use a key such as ext.partner.option. The
configuration reference
lists accepted values and defaults. Invalid input returns 422 order-strategy-invalid-extension
with the offending field path in detail. Existing stored maps keep their runtime behaviour until
a request sends a replacement; an update that omits the map neither validates nor changes it.
StorageStrategy has no equivalent. storage_strategies carries no JSONB extension column - not in
V306__create_storage_strategies.sql, not in V312__storage_strategy_flags.sql, and not on the
entity - so putaway configuration an extension needs has nowhere to live but system_properties.
4. The system_properties ladder is the only per-tenant runtime knob
SystemPropertyService states the resolution ladder per key: stored row for the exact
client, then the stored client-0 row, then the MicroProfile config value for the same key, then the
catalogue default. A stored row whose value is null does not satisfy a rung; DELETE is how a
key is unset. There is no caching, and the KDoc names the condition under which one should be added.
That ladder is what makes a database row beat an environment variable, and it does so on purpose.
SystemPropertyCatalog.kt holds 46 catalogue entries across sixteen groups: facility (1),
printing (1), agents (5), identity (4), receiving (1), alerts (2), replenishment (1), packing (2),
shipping (6), inventory (1), cross-docking (4), waves (1), streaming (1), 3PL billing (2),
slotting (1) and profile (13). The identity entries are restart-bound environment metadata. The
alert, packing, cross-docking, wave, streaming, 3PL billing and slotting entries are read by engine
modules and carry the Extended capability they tune; in a deployment that never acts on them they
are stored and returned, and read by nothing. The profile entries - karyo.profile and one
karyo.capability.<name>.enabled switch per Extended capability - are read at Company key 0 and
written only by the Capabilities panel
(ADR 0052). Each entry carries a type, a group, a
description, a default, and five flags:
secretmasks the value in the effective view for every principal including Company administrators, while in-process consumers still read the real value (PropertyDefinition.secret). One key uses it: the Slack webhook URL.ownerWritable = falserestricts a runtime-editable key'sPUT/DELETEto an ops principal, so a goods-owner admin cannot store a Business Unit override above an operator-set hard stop. Sixteen runtime-editable keys use it: the printer target, the four agent settings, over-receipt, the Slack webhook, purge retention, the unit-load rename switch, the streaming switch, the cross-dock staging window and expiry action, the 3PL storage rate and billing currency, the Loci base URL, and the judgment engine opt-in.environmentOnly = truerefusesPUT/DELETEeven for ops principals, and the effective view resolves the key from configuration alone, ignoring any stored row. Provider type, exact issuer and API audience use it because changing identity trust requires a restart and coordinated deployment configuration. So do the agent resource URI, the setup reopen marker, the five ship-from keys and the four judgment engine connection keys (SystemPropertyResource.requireOwnerWritable).capabilityControlled = truerefusesPUT/DELETEthrough the raw editor for every principal (403 system-property-capability-controlled), because a profile change needs the Capabilities panel's preview and confirmation. The thirteen profile entries use it.engineWork = truemarks the switch or setting of background work an engine runs on its own (streaming, wave auto-release, the four cross-dock keys). The console keeps it listed while its capability is hidden, because hiding does not stop that work.
Non-catalogue keys must start with ext. on write. Karyo stores them without type validation;
their extension owns validation and reads them through RuntimePropertyLookup (karyo-auth-api),
without depending on karyo-auth-core. A foreign key without that prefix returns
422 system-property-unknown-key. Existing unknown rows remain listed with null type metadata,
readable and removable, but not writable; the console marks non-ext. rows Not recognised.
5. About forty environment knobs, almost none of them set in the operator's template
application.yaml, karyo is the karyo.* block. Almost every leaf is written as
${KARYO_SOMETHING:default}, and the file explains why the defaults are never empty strings: a
resolved empty value is treated by smallrye-config as missing (SRCFG00040) and fails boot once any
bean injects the property, so "none", "off" and "STRICT_PRIORITY" are non-empty sentinels
(application.yaml, quarkus.mailer.username, quarkus.mailer.password, karyo.print.url,
karyo.work.dispatch-strategy, karyo.sequence.generator). karyo.slotting.loci.base-url and the four Loci token
keys are the exceptions: each defaults to empty on purpose and is injected as Optional<String>,
so an unset base URL means "there is no slotting advice, and the route says so" and an unset
token URL means Karyo sends no credential, rather than a boot failure
(application.yaml, karyo.slotting.loci, SlottingConfig).
karyo.webhooks.* (application.yaml, karyo.webhooks) - allow-http, poll-interval, batch-size,
http-timeout, max-attempts, backoff-base, backoff-cap. Each is written
${KARYO_WEBHOOKS_<KEY>:default}, so the environment variable (KARYO_WEBHOOKS_MAX_ATTEMPTS and
the like) sets it, and scripts/.env.prod.example lists all seven as commented optional settings.
allow-http defaults to false and also resolves through the runtime catalogue for each Facility.
It is operator-only, permits clear-text targets for test receivers, and never bypasses host validation.
scripts/render_compose_env.py, service_assignments passes any non-KC_/non-POSTGRES_ variable
through to the application's environment file. The relay's README documents the keys with their
variables and defaults
(services/integration-hub-service/karyo-webhooks-core/README.md, Configuration knobs).
karyo.monitors.* (application.yaml, karyo.monitors) - interval (monitor evaluation, 5m),
delivery-interval (alert delivery relay tick, 30s), delivery-batch-size (deliveries one tick
sends, 100) and delivery-max-attempts (attempts before an alert delivery is marked DEAD, 5).
Their variables are KARYO_MONITORS_INTERVAL, KARYO_MONITORS_DELIVERY_INTERVAL,
KARYO_MONITORS_DELIVERY_BATCH_SIZE and KARYO_MONITORS_DELIVERY_MAX_ATTEMPTS, listed in
scripts/.env.prod.example. The alert-delivery back-off is not a knob: it is 10 seconds doubling
per attempt, capped at one hour (AlertDeliveryProcessor).
karyo.shipping.ship-from.* configures the shipper block on every bill of lading.
application.yaml maps its five fields to KARYO_SHIP_FROM_NAME, KARYO_SHIP_FROM_STREET,
KARYO_SHIP_FROM_CITY, KARYO_SHIP_FROM_ZIP_CODE and KARYO_SHIP_FROM_COUNTRY.
Both production templates expose them, and the
deploy runbook requires real values.
The catalogue marks these keys environment-only, installation-wide and restart-bound; the runtime
property ladder does not override ShipFromConfig. Per-tenant overrides remain a follow-up.
Non-empty demo defaults preserve boot compatibility: Karyo Demo Warehouse, 1 Logistics Way,
Distribution City, 00000, US. The startup log warns about retained demo identifiers.
Production validation refuses omitted fields or any retained demo name, street, city or postal
code; US remains a valid real country. Only an explicitly enabled KARYO_DEMO in the environment
file permits the demo address. A direct application launch bypasses that refusal, but not the warning.
scripts/.env.prod.example is the authoritative deploy template. It carries the
provider-neutral trust profile: exact issuer, audience and algorithm, provider type/key, claim
paths, browser client/scopes and reviewed additional issuer-to-tenant mappings. Managed
Keycloak credentials are explicitly managed-profile-only. The same template documents optional
Loci, demo, over-receipt and purge settings; the complete application property tree remains
in application.yaml. Do not maintain a prose count of environment variables here: the template
and the environment preflight fixtures are the drift checks.
6. Name-selected strategies fail loudly; priority-selected ones do not
Four seams are selected by a configured name rather than by priority, and all four treat an unknown name as a hard failure rather than a silent fallback:
karyo.work.dispatch-strategy-STRICT_PRIORITY,TRAVEL_PATHorPROXIMITY; the installation value is the default of a per-Facility setting, and an unknown name fails at dispatch time.application.yaml,karyo.work.dispatch-strategyrecords the reason: priority-based selection let any custom strategy underInt.MAX_VALUEsilently take over the default (see Work allocation).karyo.sequence.generator-TIMESTAMP_RANDOMorFORMATTED_COUNTER; validated at boot bySequenceNumberService.validateOnStartup(application.yaml,karyo.sequence.generator).karyo.simulation.simulator-flow(the default) orlost-sales; validated at boot bySimulationService.validateOnStartup, so a name no simulator answers to stops the application instead of running the first registered simulator (application.yaml,karyo.simulation.simulator).CountScopeStrategy- always resolved by name, becauseFullWarehouseScopeoutranksExplicitLocationScopeon priority and an unnamed resolve would escalate every cycle count into a warehouse-wide freeze (see Stocktaking).
The OrderStrategy name columns are checked when they are written instead: shortfallStrategy,
pickDifferenceStrategy and packoutStrategy are VARCHAR columns with string defaults, and
POST or PUT /api/v1/order-strategies refuses a name that no strategy bean answers to with 422
(invalid-strategy-name, StrategyNameValidator). The names come from the beans themselves, so a
strategy a build adds is accepted without a list to maintain. Shortfall and pick-difference names are
matched exactly. A packout name is matched ignoring case and padding, because cartonization answers its
knob in any spelling. Resolution at run time still falls through to the priority chain when a name
matches nothing, so a row written before this check, or edited in the database, keeps the built-in
behaviour; the check does not rewrite stored values.
Writing an order strategy is Company-level, for the reason in section 2: the row has no owner or
Facility, so orders.write has to be granted at the Company node. The same action granted at a
Business Unit or a Facility is refused with 403 (order-strategy-company-forbidden).
Related
- Extension SPIs and how one is installed
- Documents and printing - where the ship-from block ends up
- Strategies and policies - the per-seam register from the administrator's side
- The runtime configuration store -
system_propertiesin full