Skip to main content

Construction Kit Library Management

OctoMesh provides built-in tools for managing Construction Kit (CK) model libraries across tenants. This includes browsing available libraries from catalogs, checking compatibility, resolving dependencies, and importing libraries with full dependency resolution.

Catalog Sources​

CK model libraries are distributed through catalogs. OctoMesh supports multiple catalog sources:

CatalogDescriptionDefault
EmbeddedResourceSystem models embedded in the service binariesAlways active
PublicGitHubPublic GitHub repository with released CK librariesEnabled
PrivateGitHubPrivate GitHub repository for development/pre-release librariesDisabled in production
LocalFileSystemLocal file system for development useDisabled in production

Catalog sources can be configured per environment via Helm values or environment variables.

System-Managed Models​

Models whose name is System or starts with System. (e.g., System.Identity, System.Communication) are managed by the OctoMesh services themselves. These models:

  • Are imported automatically during tenant creation and service startup
  • Cannot be imported by a caller at all: ImportCk, ImportFromCatalog and ImportFromCatalogBatch (and with them octo-cli, the SDK and MCP) refuse them, whatever the version (upgrade, same version, downgrade), whoever calls and also with forceBreakingUpdate (see below)
  • Are shown with a "Service-Managed" badge in the Library Overview
  • Are excluded from the "Fix All" batch operation

Service-managed models cannot be imported by a caller​

The rule compares the model name case-insensitively (system.identity counts as System.Identity) and judges the model the file or catalog entry really contains, not its file name or the requested id. For a zip file every model entry is checked. A refused request is answered with 403 and problem details:

{
"type": "https://schemas.meshmakers.cloud/errors/ck-service-managed-model",
"title": "Service-managed CK models cannot be imported",
"status": 403,
"code": "CK_SERVICE_MANAGED_MODEL",
"message": "System.Identity-3.7.0 is a service-managed CK model and cannot be imported by a caller. ...",
"models": ["System.Identity-3.7.0"]
}

Nothing is cached, queued or imported, and a batch with one such model is refused as a whole. The services install their own models when a tenant is set up or resolved; to run that import again for a tenant, use octo-cli -c ClearCache or ReRunTenantSetup. Blueprints and tenant restore are not affected.

Earlier versions let a caller with the Data Model Management role import such a model as a file, also an older version (logged as Explicit downgrade of CK model). That was a security gap: a self-built System.Identity could, for example, remove the restriction that identity types are written only through the identity service.

Version Compatibility​

When evaluating whether a CK library can be imported into a tenant, OctoMesh checks transitive compatibility against installed system model versions:

  • The check walks the full dependency chain recursively
  • A classic (exact-pinned) model requires the installed system model to match its pin exactly: with System-2.7.0 pinned and System-2.8.0 installed, the library is incompatible
  • A range-retaining model (CK language 2, dependencyRanges) is judged by the range it declares: any installed version inside the range and at or above the floor is compatible (System-[2.5,3.0) accepts System-2.8.0)
  • A range-retaining model that reaches a system model only transitively (for example EnergyIQ → Basic → System) is not compared against that system model itself: its compiled dependencies list holds the flat exact closure, including the transitive pin, but dependencyRanges name only direct dependencies. The intermediate model decides: a range-retaining Basic-2.5.0 with System-[2.5,3.0) accepts System-2.8.0, a classic Basic that is pinned to System-2.7.0 still blocks the import
  • If a range excludes the installed version, the reason names the range, for example Requires System-[2.5,3.0), but System-3.1.0 is installed

Incompatible libraries are flagged in both the UI and CLI and cannot be imported.

Dependency Resolution​

When importing a CK library, OctoMesh automatically resolves its full dependency tree:

  1. Fetch the target model from the catalog
  2. Walk its Dependencies list (exact version references)
  3. For each dependency, recursively resolve sub-dependencies
  4. Deduplicate by model name, keeping the highest required version
  5. Exclude system-managed models (they are managed by services)
  6. Order topologically (dependencies before dependents)

The result is a flat, ordered list of models to import. Each model is imported sequentially via Hangfire background jobs, ensuring that dependencies are available before dependents are imported.

How Version Ranges Become Exact Pins​

A source ckModel.yaml declares dependencies as version ranges (Basic.Energy-[1.3,2.0)), but a compiled CK library carries exact dependency pins. The compiler resolves each range against the catalogs — picking the highest published version that satisfies the range — and freezes the result into the compiled model. From then on, every import of that library requires exactly the frozen versions.

This compile-time pinning is why dependency bumps cascade: when Basic.Energy publishes a new version, an already-compiled dependent like EnergyCommunity still pins the old one. The dependent must be rebuilt and republished (with a version bump — the SemVer gate enforces this) before a tenant can hold both. See Versioning Rules for the full rule set, including the different floor-based resolution used by blueprints.

Import Pipeline​

The import flow uses the existing asynchronous job pipeline:

Display-Rule Backfill​

If an imported model changes the display name rules declared on its types, existing entities of the affected type subtrees are updated by an automatic background sweep that recomputes rtDisplayName / rtDisplayDescription. The sweep is durable and retried (tracked in the system collection display_rule_sweep); no manual action is required.

Authorization​

Every operation that changes the data model of a tenant is protected by the Data Model Management policy: the caller needs the scope octo_api and the tenant role DataModelManagement. Reading needs only a read scope.

OperationRequired
Browse catalogs (list, search)octo_api.read_only or octo_api
View library status, resolve dependencies, check an upgrade, validate a CK modelocto_api.read_only or octo_api
Import a CK model file (ImportCk)octo_api + role DataModelManagement
Import from a catalog (ImportFromCatalog), FixAllocto_api + role DataModelManagement
Install, update, uninstall a blueprintocto_api + role DataModelManagement (GraphQL mutations: also AdminPanelManagement)
Refresh CK model or blueprint catalog cachesocto_api + role DataModelManagement

A caller without the role gets HTTP 403 with the body {"message": "...", "code": "DataModelManagementRequired"} (GraphQL: error code DataModelManagementRequired) and nothing is changed. octo-cli prints the message and the code; the MCP tools return the code in errorCode.

The DataModelManagement role is included in the default TenantOwners group, so tenant creators, provisioned administrators and scratch-tenant creators have it. Grant it to any other user or client-credentials client that imports models or installs blueprints, for example octo-cli -c AddUserToRole -un <user> -r DataModelManagement, or add the subject to a group that carries the role.

Changed in r3.5.67

Until r3.5.67 these operations only checked the scope (octo_api or octo_api.data_model_management), and ImportCk and the blueprint endpoints accepted any read-write token. Callers without the role, including automation clients, must be granted it before the upgrade. The scope octo_api.data_model_management alone is no longer enough.

Platform services install their own CK models and service-managed blueprints internally; they are not affected.

Why a Model Is ResolveFailed​

When the re-validation after an import marks a model ResolveFailed, it stores the reason with the model and clears it when the model recovers. The reason is plain English text that names only models, versions, ranges and exact pins, for example Unmet dependency: RrBase-[1.0,2.0) (floor 1.1.0): installed RrBase-1.0.0; several causes are joined with ; and the text is capped at 1000 characters. It is returned by:

WhereField
REST GET {tenantId}/v1/models/LibraryStatus and the SDK DTO CkModelLibraryStatusItemDtoresolveFailedReason (ResolveFailedReason in C#)
GraphQL constructionKit { models { items { modelState resolveFailedReason } } }CkModel.resolveFailedReason (String)
octo-cli -c LibraryStatuscolumn REASON

The field is null unless the model is ResolveFailed, and null against an asset repository that predates it. Clients show the text and never parse it.

Updates That Would Break an Installed Model​

A compiled classic model carries exact dependency pins. If an installed model such as EnergyCommunity.Registration-2.8.0 is pinned to Basic-2.4.0, importing Basic-2.5.0 replaces the pinned version and turns Registration into ResolveFailed. LibraryStatus and CheckUpgrade therefore evaluate the tenant upgrade guard for the offered catalog version and report the result read-only. These two endpoints enforce nothing, they write nothing and start no job; the import endpoints enforce the same guard, see Enforcement on Import.

WhereMembers (all optional; older clients ignore them)
REST GET {tenantId}/v1/models/LibraryStatus, per item (SDK CkModelLibraryStatusItemDto)isBlocked, blockers[], isRangeRetaining
REST POST {tenantId}/v1/models/CheckUpgrade (SDK UpgradeCheckResponseDto)isBlocked, blockers[]
  • A blocked row keeps hasUpdate = true and has needsAction = false, so a client that predates the guard (for example FixAll of an older octo-cli) skips it. Service-managed models, rows without an update and catalog-only rows are never blocked.
  • Each entry of blockers[] names the model that would break (dependent), the update that causes it (update), the kind (ExactPin, FloorNotMet, RangeNotSatisfied, ElementRemoved, ElementChanged, ElementBecameInternal, NameCollision; new kinds may appear), the pin or element (subject), a stable code (CK_UPGRADE_EXACT_PIN, ...) and an English message, for example EnergyCommunity.Registration 2.8.0 would break: exact pin Basic-2.4.0: Basic-2.5.0 replaces it.
  • When the catalogs offer a newer version of the blocking model and updating it together with the offered model was proven to resolve the blocker, the entry carries suggestedDependentUpdate (EnergyCommunity.Registration-2.10.0) and resolveHint (update EnergyCommunity.Registration to 2.10.0 first). Once that version is installed, the row is no longer blocked.
  • isRangeRetaining is true when the installed model declares dependency ranges (CK language 2). Models that are still exact-pinned show false.
  • A row is judged with the dependency updates its import pulls in, not with the offered version alone. The set is the one the import dialog (ResolveDependencies) builds for the same model - the offered version plus every catalog dependency that is not yet satisfied by the installed versions - judged together as one update set. In the example, Industry.Energy-3.6.0 brings Basic-2.5.0 with it: the Industry.Energy row is blocked, Basic-2.5.0 is the update that causes it and EnergyCommunity.Registration-2.8.0 the installed model that would break, exactly as in the import dialog. A row without dependency updates is judged by its own offered version as before. Each row is still judged against the current installed state (not against the other rows); the import endpoints judge the whole update set of a request together. CheckUpgrade.hasBreakingChanges remains the verdict on the model's own migration and is independent of isBlocked.

Enforcement on Import​

ImportFromCatalog and ImportFromCatalogBatch (and with them octo-cli ImportFromCatalog and FixAll) enforce the same guard before anything is cached or queued:

  • The whole update set of the request is judged as one set - the single model, or all modelIds of a batch (the modelsToImport of ResolveDependenciesBatch). A dependent that is itself part of the set is judged by its new version: a batch of EnergyCommunity.Registration-2.10.0, Basic-2.5.0, Basic.Energy-1.10.0 and EnergyCommunity-4.10.0 is accepted, the same batch without Registration is refused.
  • A set that would break an installed model is answered with HTTP 409 and the stable code CK_UPGRADE_BLOCKED. No job is queued, nothing is cached and nothing is written. A batch is refused as a whole - there is no partial import and no per-model result.
  • The override is the request member forceBreakingUpdate (ForceBreakingUpdate in C#, default false). Both endpoints already require the Data Model Management policy (see Authorization), so a caller without it gets 403 with or without the flag. A forced import is queued and leaves a WARN log line with the tenant, the caller (sub, client_id, name), the update set and every blocker. If the guard itself fails, the import fails with 500 even when forced - the blockers (and the audit line) would be unknown.
  • Not guarded (deliberately): the embedded System* models imported at service start (they have their own downgrade guard). The import of a model file (ImportCk) is guarded too, see File Import.
  • Blueprints are judged by the same guard: the CK models a blueprint install or update installs or raises are the update set, see Updates That Would Break an Installed Model. Same 409 CK_UPGRADE_BLOCKED body, same override name and policy.
  • Preview agrees with the refusal: ResolveDependencies (the flattened import set of the tree) and ResolveDependenciesBatch (modelsToImport as one set) return isBlocked and blockers[] next to the existing members, judged by the same guard and read-only. Older clients ignore them.

The error body is application/problem+json (RFC 9457) and language neutral - clients render code, updateSet and the structured blockers[] (the same entries as in LibraryStatus); detail is an English sentence for clients that do not localize:

{
"type": "https://schemas.meshmakers.cloud/errors/ck-upgrade-blocked",
"title": "The update would break installed CK models",
"status": 409,
"detail": "Importing Basic-2.5.0 would break 1 installed model(s): EnergyCommunity.Registration 2.8.0 would break: exact pin Basic-2.4.0: Basic-2.5.0 replaces it (update EnergyCommunity.Registration to 2.10.0 first). Nothing was imported. ...",
"code": "CK_UPGRADE_BLOCKED",
"updateSet": ["Basic-2.5.0"],
"blockers": [
{
"dependent": "EnergyCommunity.Registration-2.8.0",
"update": "Basic-2.5.0",
"kind": "ExactPin",
"subject": "Basic-2.4.0",
"code": "CK_UPGRADE_EXACT_PIN",
"message": "EnergyCommunity.Registration 2.8.0 would break: exact pin Basic-2.4.0: Basic-2.5.0 replaces it",
"dependentIsInUpdateSet": false,
"suggestedDependentUpdate": "EnergyCommunity.Registration-2.10.0",
"resolveHint": "update EnergyCommunity.Registration to 2.10.0 first"
}
]
}

File Import (ImportCk)​

POST {tenantId}/v1/models/ImportCk (octo-cli ImportCk -f <file>) is guarded by the same tenant upgrade guard. Before this was fixed the file import was accepted unchecked, and a System file that removed an attribute used by System.Identity left every model Available while the tenant could no longer be loaded - and could not be deleted through the API either.

  • The service reads the uploaded file exactly as the import job does (JSON, YAML, or a zip holding one of them; a file that cannot be read is a 400) and judges it before anything is cached or queued. A file that would break an installed model is answered with the same 409 CK_UPGRADE_BLOCKED problem details as above (updateSet is the model id of the file, plus a fileName member); no job is queued and nothing is written.
  • A file with a service-managed model (System, System.*) is refused before this guard with 403 CK_SERVICE_MANAGED_MODEL (see Service-managed models cannot be imported by a caller). CheckUpgrade still judges such models, so its preview shows what a release of the services would break (isBlocked / blockers[] for a System release; hasBreakingChanges stays the migration verdict of the model itself).
  • A file is judged whatever its direction. A downgrade that breaks nothing is still allowed and logged as WARN Explicit downgrade of CK model ... from X to Y; a downgrade that breaks an installed model (a used element is missing, a floor is not met) is refused like an upgrade. A first install, a re-import of the installed version and a parallel major are never blocked.
  • The override is the form member forceBreakingUpdate next to the file (default false; octo-cli ImportCk --forceBreakingUpdate, -f is the file there). ImportCk itself needs the read/write policy, but a requested override needs the Data Model Management policy: 403 without it, nothing happens. A forced import with blockers writes the same WARN audit line as above, with the file name. If the guard itself fails, the import fails with 500 even when forced.
ClientBehavior
octo-cli ImportFromCatalogResolves the dependencies, and when the set is blocked prints every blocker with its resolve hint and stops before the import. It also prints a ready-to-run joint command when the blockers name dependent updates (see Upgrading Models That Pin Each Other). --force (-f) sends forceBreakingUpdate: the command warns and imports anyway. A 409 of the service is reported the same way.
octo-cli FixAllNever forces. Blocked rows of LibraryStatus that have a compatible catalog update join the candidate set and are judged together with the other updates, so models that block each other through exact pins are imported in one batch. What stays blocked in the joint set (or when the resolved set is blocked through a dependency) is dropped, reported with reason and resolve hint, and the others are imported.
octo-cli ImportCkPrints every blocker and fails with CK_UPGRADE_BLOCKED (non-zero exit code) when the file is refused. --forceBreakingUpdate (-fbu) sends the override and warns.
SDK IAssetServicesClientImportFromCatalogAsync (new), ImportFromCatalogBatchAsync and ImportCkModelAsync throw CkUpgradeBlockedException (Blockers, UpdateSet, Detail) on the 409; ForceBreakingUpdate on the request DTOs, ImportCkModelAsync(tenantId, path, forceBreakingUpdate) for the file import.
Graphical clientsOffer no force action; the override exists only in the API and in octo-cli --force (ImportFromCatalog) / --forceBreakingUpdate (ImportCk). They show the error text of a refusal.

Compatibility: previously accepted imports that break an installed model are now refused with 409 - clients that predate the guard (older octo-cli, graphical clients, pipelines calling ImportFromCatalog or importing files with ImportCk) see an unexpected error status; an older octo-cli cannot force a refused file import (--forceBreakingUpdate is new). The request member is optional (absent = false) and the response members are additive.

Upgrading Models That Pin Each Other​

Installed classic models can pin each other exactly: for example Industry.Basic-2.5.0 is pinned by Industry.Energy-3.5.0, Industry.Fluid-2.4.0, Industry.Maintenance-2.4.0 and Industry.Manufacturing-2.5.0. Each single update is blocked - Industry.Basic-2.6.0 alone would break the four dependents, and Industry.Energy-3.6.0 alone does not bring Industry.Basic-2.6.0 with it. The service judges a list of models as one post-state: a dependent that is part of the set is replaced by its new version, so the exact pins of the replaced versions stop being blockers. octo-cli ImportFromCatalog therefore accepts a comma-separated -m list and imports it as one guarded batch (one ResolveDependenciesBatch, one ImportFromCatalogBatch, one job), without --force:

octo-cli -c ImportFromCatalog -cn "PublicGitHubCatalog" `
-m "Basic-2.5.0,Industry.Basic-2.6.0,Industry.Energy-3.6.0,Industry.Fluid-2.5.0,Industry.Maintenance-2.5.0,Industry.Manufacturing-2.6.0" `
-w
  • Order. The service imports the ids in the order it receives them and concatenates the dependency trees of the roots in request order. The CLI therefore orders the merged set itself: a model is sent after every other model of the set whose name appears in its dependency tree, whatever the order of the -m list. Models without a relation keep the resolver order.
  • Blocked single import. When one model of such a group is imported alone, the command imports nothing, lists the blockers and prints the joint command: the requested models plus every suggestedDependentUpdate of the blockers that is not yet in the set. Run it as printed.
  • FixAll tries the blocked rows together in the same way and never forces.
  • A set that the service still judges blocked is refused as a whole; only --force overrides that, deliberately.

Repairing Models After a System Bump​

A release that ships a newer System model turns classic catalog models that pin System exactly into ResolveFailed. Run octo-cli -c FixAll -w -y against the tenant: it imports every model for which the catalog holds a compatible successor. A range-retaining successor is judged by its dependencyRanges, a classic one by its exact pin. Models that pin each other exactly are imported together as one guarded set, and FixAll never forces: updates that would break an installed model are skipped and listed. FixAll also skips the service-managed models (System, System.*): the services bring those along themselves (see System-Managed Models). Models without a successor stay ResolveFailed; LibraryStatus lists them with the reason (see Why a Model Is ResolveFailed).

For all tenants of an installation use Invoke-OctoTenantSweep -Installation <i> -Tenant a,b,c -CliArguments '-c','FixAll','-w','-y' (octo-tools), after ProvisionCurrentUser once per child tenant, so no interactive login per tenant is needed. Compare LibraryStatus before and after. The services and octo-cli must be version 3.5.43 or newer.

REST API Endpoints​

System Scope​

MethodEndpointDescription
GETsystem/v1/ckmodelcatalogList all models from all catalogs
GETsystem/v1/ckmodelcatalog/search?q={term}Search models
GETsystem/v1/ckmodelcatalog/catalogsList catalog sources
GETsystem/v1/ckmodelcatalog/{catalogName}List models from specific catalog
POSTsystem/v1/ckmodelcatalog/refreshRefresh all catalog caches

Tenant Scope​

MethodEndpointDescription
GET{tenantId}/v1/models/LibraryStatusMerged view: installed + catalog
POST{tenantId}/v1/models/ResolveDependenciesBatchResolve dependency trees
POST{tenantId}/v1/models/ImportFromCatalogBatchBatch import with jobs; refused as a whole with 409 CK_UPGRADE_BLOCKED when the set breaks an installed model unless forceBreakingUpdate
POST{tenantId}/v1/models/CheckUpgradePre-flight migration check
POST{tenantId}/v1/models/ImportFromCatalogSingle model import; 409 CK_UPGRADE_BLOCKED unless forceBreakingUpdate