Skip to main content

Range Retention

Today a compiled model freezes every dependency range into an exact pin: System-[2.5,3.0) in ckModel.yaml becomes System-2.5.0 in the compiled model, and a tenant must hold exactly that version (see Versioning rules). Every new System version therefore forces every dependent to be rebuilt and republished.

Range retention keeps the declared range in the compiled model instead. A range-retaining model stays usable when an additive minor of its dependency is installed — no rebuild, no version bump.

Always On​

Range retention is the compiler default: every compile — MSBuild (CkCompile) and octo-ckc Compile alike, for CK language 1 and 2 models — writes the declared ranges, the floors and major-qualified references. There is no switch: the MSBuild property OctoCkRangeRetention, the environment variable of the same name and the option octo-ckc -rr are gone. A build that still sets the property, the variable or passes -rr keeps working: the value is ignored and the build logs the deprecation warning OCTO-CK300 ("OctoCkRangeRetention / -rr is obsolete and ignored"). Remove them.

Compatibility — read before you publish

A model compiled by this compiler differs from the same sources compiled before: it carries dependencyRanges, minEngineVersion: 3.5.1 (for a model that has dependencies) and major-qualified references, and it is published under ck-models/v3/. Engines below 3.5.1 refuse such a model (message 126) or do not see ck-models/v3/; every service of an environment must run the CK v2 engine before a range-retaining base model (System, Basic, ...) is published into a shared catalog (see the operating rule). The first publish of an existing model after the switch needs a MINOR bump (ValidateVersion row D6, "the one-time re-pin"). Already published versions are immutable and unaffected; dependents that are not rebuilt keep their exact pins until they are re-pinned.

What the Compiler Writes​

# ckModel.yaml (source)
modelId: Acme.Plant-1.0.0
ckLanguage: 2
dependencies:
- System-[2.5,3.0)
- Acme.Assets-[1.0,2.0)
# compiled by the default compiler (range retention)
dependencies: # exact closure, kept for older readers and the SemVer diff
- Acme.Assets-1.0.0
- System-2.5.0
dependencyRanges: # every declared dependency: range verbatim + floor
- range: Acme.Assets-[1.0,2.0)
floor: 1.0.0
- range: System-[2.5,3.0)
floor: 2.5.0
usedSurface: # what this model uses of System (sorted)
- System@2/Entity-1
- System@2/Entity-1.Name
usedSurfaceHash: sha256:…
minEngineVersion: 3.5.1
types:
- typeId: Pump
derivedFromCkTypeId: Acme.Assets@1/Device-1 # major-qualified, version-less
implements:
- Acme.Assets@1/Calibratable-1
  • dependencyRanges lists every declared dependency with its range and its floor.
  • The floor is the declared lower bound ([2.5,3.0) → 2.5.0), never "the highest version in the catalog". An exclusive lower bound gets the next patch ((2.4,3.0) → 2.4.1).
  • Every reference into a dependency is major-qualified and model-version-less: Model@Major/Element-n, e.g. System@2/Entity-1. References to the model's own elements stay concrete.
  • usedSurface lists, per declared dependency, the elements and members of that dependency the model uses: base types and records, implemented and extended interfaces, reused attribute definitions, records and enums used as value types, association roles and targets (element level, System@2/Entity-1), and attribute paths of indexes and ownerAttributePath into an inherited dependency type (member level, System@2/Entity-1.Name). usedSurfaceHash is a sha256 over the list. A later import check (F2.5) uses it to tell which consumer a dependency change would break. It cannot see behavioural or semantic changes (defaults, display rules, the meaning of a value), and references into undeclared, transitive dependencies are not listed.
  • minEngineVersion is set and the model is published under ck-models/v3/.

Compile-time checks​

  • One major per range. Because references are stored as Name@<major> of the floor's major, every declared range must stay inside one major. System-[2.5,3.0) is accepted; System-2.5 (= >= 2.5.0), System-[2.0,), System-[2.5,3.0] and System-[2.5,4.0) are rejected ("... admit more than one major version ..."). A new major is a deliberate change of the dependent.
  • Compile against the floor, verify against the highest. The model is resolved and validated against the highest version in the range, but every element it references in a dependency must already exist in the floor version (or, if the floor itself was never published, in the lowest available version in the range). Otherwise: "references elements that do not exist at the floor of its dependency range ...". Raise the floor in ckModel.yaml if you need a newer element.
  • Transitive references. A model may use elements of a model it does not declare (through another dependency). Those references are major-qualified and floor-checked too, against the guarantee of the intermediate model; a miss asks you to declare the model in ckModel.yaml. Declaring every model you reference is recommended.

One major per range, and how to check it​

Every declared range must stay inside the major of its floor: System-[2.5,3.0) is fine; Basic-[2.4,), a bare System (= >=1.0.0), System-2.5 (= >=2.5.0), System-[2.5,3.0] and System-[2.5,4.0) fail the compile with "admit more than one major version". Check your sources before you rebuild: octo-ckc -c AuditRanges -p <directory> lists every declaration with OK / REJECTED (same rule as the compiler, non-zero exit code when a range is rejected); the engine repository ships scripts/audit-ck-ranges.sh <monorepo-root> for all repositories of a monorepo checkout.

How a Range-Retaining Model Resolves​

A dependency of a range-retaining model is satisfied when the installed (or catalog) version is inside the range and at or above the floor. Major-qualified references bind to the installed version of the same name and major. Classic models keep their exact-pin semantics.

Example: Acme.Plant-1.0.0 above was compiled against Acme.Assets 1.0.0. When a tenant upgrades to an additive Acme.Assets 1.1.0, Acme.Plant stays Available and resolves against 1.1.0 — without recompiling. A classic (exact-pinned) dependent in the same tenant goes ResolveFailed until it is rebuilt.

Which versions satisfy a range​

A range such as System-[2.5,3.0) (floor 2.5.0) is satisfied by any version inside the range that is not below the floor. The compiler, the import into a tenant and the re-validation after an import apply the same table:

Versions availableResult
2.5.0resolves to 2.5.0
2.6.1 only (higher minor or patch than the floor)resolves to 2.6.1, the model loads
2.4.9 only (below the floor)rejected; the message names the range and the visible versions
3.0.0 only (higher major)rejected, a new major is a deliberate cascade
2.5.0, 2.6.1, 3.0.0resolves to 2.6.1, the highest version in range

Exact-pinned (classic) models keep exact-match semantics. There is no special treatment for the System models and the models Meshmakers ships: they resolve by the same rules, because their version discipline is guaranteed by the compile and publish gates (Versioning rules), not by a looser resolver. A blueprint still installs the floor of a dependency range and keeps a newer installed version that satisfies it.

One version per dependency model in a compile​

A compile resolves one version per dependency model, even when exact pins and ranges meet. The compiler collects every constraint on one model name over the whole dependency closure — the ranges you declare and the exact pins of classic dependencies — and picks the highest catalog version that satisfies all of them. Example: your model declares System-[2.5,3.0) and depends on a classic model that is pinned to System-2.5.0; with System 2.5.0 and 2.6.0 in the catalog the compile resolves System once, to 2.5.0 (earlier it failed with message 66). Two ranges (B-[1.0,1.5) and B-[1.2,2.0)) resolve to the highest version inside both. If no version satisfies all constraints, the compile fails and the message names every constraint, the model that requires it and the versions the catalogs show. Classic compiles (without the flag) resolve exactly as before.

In a tenant​

  • A range-retaining model is stored with its dependencyRanges; its references are persisted in the version-less form (System@2/Entity-1) and bound to the installed version only when the model is loaded.
  • After every import the engine re-validates the installed models. A range-retaining model is judged by its range and floor, a classic model by its exact pins. So an additive minor of a dependency leaves range-retaining dependents Available, while exact-pinned ones go ResolveFailed.
  • Installing a dependency below the floor (for example by an explicit downgrade) makes the dependent ResolveFailed; the log names the range, the floor and the installed version (Acme.Assets-[1.0,2.0) (floor 1.1.0): installed Acme.Assets-1.0.0). It recovers automatically once a satisfying version is installed again.

Known Limitations​

  • SemVer. The SemVer gate does not classify dependencyRanges yet; the exact dependencies closure is still diffed as before.
  • Models published before range retention became the default keep their exact pins and exact references until they are rebuilt.

See Also​