deriveModelIdentifier

fun deriveModelIdentifier(descriptor: ModelDescriptor?, modelReference: ModelReference?): String?(source)

Produce a non-blank modelIdentifier for an ksl.app.config.optimization.OptimizationProblemSpec.

Order of preference:

  1. descriptor.modelIdentifier (when available — that's the identifier of the actual Model the runtime will build).

  2. A natural identifier derived from the model reference ("bundleId:modelId" for ByBundleAndModelId, the providerId for ByProviderId, etc.).

Returns null only when modelReference is null. The OptimizationProblemSpec init accepts a null field but rejects a blank string.