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:
| Catalog | Description | Default |
|---|---|---|
| EmbeddedResource | System models embedded in the service binaries | Always active |
| PublicGitHub | Public GitHub repository with released CK libraries | Enabled |
| PrivateGitHub | Private GitHub repository for development/pre-release libraries | Disabled in production |
| LocalFileSystem | Local file system for development use | Disabled 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,ImportFromCatalogandImportFromCatalogBatch(and with them octo-cli, the SDK and MCP) refuse them, whatever the version (upgrade, same version, downgrade), whoever calls and also withforceBreakingUpdate(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.0pinned andSystem-2.8.0installed, 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)acceptsSystem-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 compileddependencieslist holds the flat exact closure, including the transitive pin, butdependencyRangesname only direct dependencies. The intermediate model decides: a range-retainingBasic-2.5.0withSystem-[2.5,3.0)acceptsSystem-2.8.0, a classicBasicthat is pinned toSystem-2.7.0still 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:
- Fetch the target model from the catalog
- Walk its
Dependencieslist (exact version references) - For each dependency, recursively resolve sub-dependencies
- Deduplicate by model name, keeping the highest required version
- Exclude system-managed models (they are managed by services)
- 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.
| Operation | Required |
|---|---|
| Browse catalogs (list, search) | octo_api.read_only or octo_api |
| View library status, resolve dependencies, check an upgrade, validate a CK model | octo_api.read_only or octo_api |
Import a CK model file (ImportCk) | octo_api + role DataModelManagement |
Import from a catalog (ImportFromCatalog), FixAll | octo_api + role DataModelManagement |
| Install, update, uninstall a blueprint | octo_api + role DataModelManagement (GraphQL mutations: also AdminPanelManagement) |
| Refresh CK model or blueprint catalog caches | octo_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.
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:
| Where | Field |
|---|---|
REST GET {tenantId}/v1/models/LibraryStatus and the SDK DTO CkModelLibraryStatusItemDto | resolveFailedReason (ResolveFailedReason in C#) |
GraphQL constructionKit { models { items { modelState resolveFailedReason } } } | CkModel.resolveFailedReason (String) |
octo-cli -c LibraryStatus | column 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.
| Where | Members (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 = trueand hasneedsAction = false, so a client that predates the guard (for exampleFixAllof 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), thekind(ExactPin,FloorNotMet,RangeNotSatisfied,ElementRemoved,ElementChanged,ElementBecameInternal,NameCollision; new kinds may appear), the pin or element (subject), a stablecode(CK_UPGRADE_EXACT_PIN, ...) and an Englishmessage, for exampleEnergyCommunity.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) andresolveHint(update EnergyCommunity.Registration to 2.10.0 first). Once that version is installed, the row is no longer blocked. isRangeRetainingistruewhen the installed model declares dependency ranges (CK language 2). Models that are still exact-pinned showfalse.- 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.0bringsBasic-2.5.0with it: theIndustry.Energyrow is blocked,Basic-2.5.0is the update that causes it andEnergyCommunity.Registration-2.8.0the 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.hasBreakingChangesremains the verdict on the model's own migration and is independent ofisBlocked.
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
modelIdsof a batch (themodelsToImportofResolveDependenciesBatch). A dependent that is itself part of the set is judged by its new version: a batch ofEnergyCommunity.Registration-2.10.0,Basic-2.5.0,Basic.Energy-1.10.0andEnergyCommunity-4.10.0is accepted, the same batch withoutRegistrationis 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(ForceBreakingUpdatein C#, defaultfalse). Both endpoints already require the Data Model Management policy (see Authorization), so a caller without it gets403with 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 with500even 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_BLOCKEDbody, same override name and policy. - Preview agrees with the refusal:
ResolveDependencies(the flattened import set of the tree) andResolveDependenciesBatch(modelsToImportas one set) returnisBlockedandblockers[]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 same409 CK_UPGRADE_BLOCKEDproblem details as above (updateSetis the model id of the file, plus afileNamemember); no job is queued and nothing is written. - A file with a service-managed model (
System,System.*) is refused before this guard with403 CK_SERVICE_MANAGED_MODEL(see Service-managed models cannot be imported by a caller).CheckUpgradestill judges such models, so its preview shows what a release of the services would break (isBlocked/blockers[]for aSystemrelease;hasBreakingChangesstays 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
forceBreakingUpdatenext to the file (defaultfalse;octo-cli ImportCk --forceBreakingUpdate,-fis the file there).ImportCkitself needs the read/write policy, but a requested override needs the Data Model Management policy:403without 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 with500even when forced.
| Client | Behavior |
|---|---|
octo-cli ImportFromCatalog | Resolves 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 FixAll | Never 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 ImportCk | Prints 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 IAssetServicesClient | ImportFromCatalogAsync (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 clients | Offer 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
-mlist. 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
suggestedDependentUpdateof the blockers that is not yet in the set. Run it as printed. FixAlltries 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
--forceoverrides 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
| Method | Endpoint | Description |
|---|---|---|
GET | system/v1/ckmodelcatalog | List all models from all catalogs |
GET | system/v1/ckmodelcatalog/search?q={term} | Search models |
GET | system/v1/ckmodelcatalog/catalogs | List catalog sources |
GET | system/v1/ckmodelcatalog/{catalogName} | List models from specific catalog |
POST | system/v1/ckmodelcatalog/refresh | Refresh all catalog caches |
Tenant Scope
| Method | Endpoint | Description |
|---|---|---|
GET | {tenantId}/v1/models/LibraryStatus | Merged view: installed + catalog |
POST | {tenantId}/v1/models/ResolveDependenciesBatch | Resolve dependency trees |
POST | {tenantId}/v1/models/ImportFromCatalogBatch | Batch 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/CheckUpgrade | Pre-flight migration check |
POST | {tenantId}/v1/models/ImportFromCatalog | Single model import; 409 CK_UPGRADE_BLOCKED unless forceBreakingUpdate |