Packages & frontends
An app instance runs one bundle: a calimero:app WebAssembly component
named by hex(SHA-256(wasm)). A core module (an SDK 0.12 app, which ran on
wasmer) is refused at upload, create and install (400 UNSUPPORTED_BUNDLE),
and an instance the node left behind answers 410 UNSUPPORTED_ENGINE. In production a bundle always comes out of a package
release: a signed .mpk (calimero-bundle) holding a calimero:app
component built with meroctl app build, its manifest signed by its publisher
with meroctl app pack (or meroctl app sign). See
Packaging & signing for building one.
What a release carries
Section titled “What a release carries”The .mpk manifest names the package, its version, its services (each a
calimero:app component, wasm, and optionally a compute component,
compute; a single-service package has one unnamed service), a frontend,
display metadata, who upgrades its instances (upgrades: owner | publisher),
the minRuntimeVersion it needs, the outbound URL prefixes it declares and
any pipelines it registers (pipelines). The manifest is signed by the
publisher’s key, and every artifact in the archive is listed with its digest.
- A compute component runs only on job nodes, never on a replica. Install
prepares it on the compute engine alone and refuses the release unless its
ABI lists exactly the app component’s compute methods with the same caps
(
400 COMPUTE_ABI_MISMATCH) and it imports nothing outside the compute world (400 BAD_BUNDLE). A release without one installs and runs calls; it cannot run compute (Compute actions). - A compute-only package ships the compute component alone (one service,
no
wasm). It needs at least one compute method (400 NO_COMPUTE_METHODS) and installs only once every node runs a release that knows it (409 CLUSTER_NOT_UPGRADED). Its instances have no app state: a call, view or init is422 NO_APP_COMPONENT; they hold files and run pipelines. - Pipelines (
pipelines/*.yaml) are compiled and checked at install against the release’s compute methods and the modules of other packages a step names (module: <package>[@<version>], pinned to the release resolved then: one the installer may use that is public or the operator’s, its own signer’s, or private to every organization a private release is for); any error is400 BAD_PIPELINEwith every problem listed.GET /packages/{package}/{version}/pipelinesanswers them (Pipeline runs).
Installing a release
Section titled “Installing a release”A release travels from its publisher to a registry, and from there to every
node that runs it, never from node to node: the node that installs it verifies
it before the system log records its hash, and each replica fetches and
verifies the same bytes again before running them. The installer is an
account (or an app’s creator, since POST /apps installs a missing release
first) or the operator. On a development cluster (--dev) an uploaded .mpk
(POST /packages) skips the registry and is spread to a majority of nodes
instead; a production node refuses uploads (403 UPLOADS_DISABLED).
There are two ways in:
POST /packages/install { package, version, org? }fetchespackage@versionfrom the operator’s registry (--registry-url,calimero-app-downloader’sHttpRegistry).POST /packages?org=takes an uploaded.mpk, on a development cluster only.
Before the system log records anything (InstallPackage), the node that took
the request verifies the release (Node::verify_release):
- The publisher’s signature over the manifest and every artifact’s digest
(
calimero_bundle::VerifiedBundle), and that it ships WASM at all. minRuntimeVersionis not newer than this node’s release (CALIMERO_RELEASE_VERSION). The other nodes do not verify the.mpk: placement, replica moves and upgrades judge the requirement against each node that would run the app (The runtime a release needs).- The package’s pinned signer: the first release of a package pins its
publisher key (
did:key); a release signed by any other key is refused. - Each service’s WASM compiles, imports nothing outside the
calimero:appworld (What the host offers), and carries an ABI of a supportedabiVersion; otherwise400 BAD_BUNDLE. - A registry install got the package and version it asked for.
- No WASM it ships (a service or a compute component) ships in a release of
another package signed by another key (
409): a WASM belongs to one signer, whose packages alone may name it (each instance is judged by the release it runs).
apply checks the signer pin and the one-signer rule again, refuses a version already installed with
other contents (the same release again changes nothing but who installed it:
the new installer is added to the release’s installers), and charges each of its parts (every service’s
component and compute component) at its own size to the installer’s bundle quota (the operator’s installs count against no
account). The log keeps, per release, the .mpk’s hash and size, where it came
from (registry or upload), each service’s bundle hash, the metadata, and the
declared outbound prefixes.
Where the bytes live
Section titled “Where the bytes live”- A registry release is never passed between nodes. Each node that needs
to run it fetches it from the registry itself (
Node::release_wasm), refuses bytes whose hash differs from the one the log recorded, and verifies the release again before using its WASM. That is the one-source rule: the registry is the only place a registry release comes from. - An uploaded release (development clusters only) has no registry. The
.mpkis stored on a majority of nodes before the log records it; a node that lacks it fetches it from a peer, checks the recorded hash and verifies it again. Production takes no uploads: an upload’s only copies are on the nodes it reached, and a cluster that grows from one node and retires it would lose the release, while a registry release can always be fetched again. - Each service’s WASM is also kept in the installing node’s blob store under
its bundle hash; other nodes extract it from the
.mpkon first use.
Creating, upgrading and removing
Section titled “Creating, upgrading and removing”POST /apps { package, version?, service?, … }creates an instance from a release; without a version, the newest installed one. If the release is not installed yet, it is installed from the registry first. A package with several services needsservice. Withdeployment, the instance runs the release that deployment offers forpackage, and records it.POST /apps/{app}/upgrade { version }moves an instance to another release of its package (Upgrades).DELETE /packages/{p}[/{v}]removes a release, or all of them, and is refused while any app still runs one of its bundles. A bundle another release also ships stays, recorded under that release. Only whoever installed the package’s first release (an account, or the operator) may uninstall, and never a release a deployment offers. It takes only the releases it may use: one it may not answers as a missing version, and with none named, the others stay. The same holds for registering the package’s origins: a first installer does it only while a release of the package is theirs to use.
Who sees a release
Section titled “Who sees a release”Many organizations may share one cluster, and what one of them installed is
not another’s to list or run.
An account installs a release for an organization it is a member of: the one it names (org), else its only one; an account in several must name one.
Below the cluster version that brings Feature::PrivateReleases an install names no organization, as before, so a rolling upgrade breaks no install.
The release is public when the registry serves it to anyone (fetched without the cluster’s registry credential), and private otherwise: a private registry package (fetched with the credential and the installing account, x-calimero-install-account), or an upload.
A release is visible, which is the right to use it (SystemState::sees_release), to:
- every account, for a release the operator installed (
/ops/packages): the cluster’s own catalog, which the operator upgrades apps to; - every account, for a public release;
- a member of an organization a private release was installed for (an installer only while such a member), each install for another organization adding it;
- the accounts that installed a private release installed for no organization
(an account in none installs for none), until an install for an organization
adds one; an account in none installing again a release already private to some
organization is refused
404before anything is recorded, as the registry answers an account it does not serve; - the operator, for the releases it installed; it sees no account’s releases.
A session opened on the package’s own frontend sees what its account sees, the display name and author of the package’s newest release included; a sign-up there names the package by its id unless that release is public, the operator’s, or recorded before visibility.
A release recorded before releases were public or private keeps the earlier rule: whoever installed it, an account sharing an organization with an installer, an account that reaches an app running it, and a session on the package’s frontend.
Reaching an instance reads the release it runs (its name and version, SystemState::reads_release), never uses it, nor reads another release that shares its WASM.
An instance whose record names no release (made by its WASM’s hash) is told, to one who only reaches it, a release that reader may use, else a public or catalog one that ships its WASM, never a private one.
For anyone else the release is not installed. GET /packages and
GET /packages/{p} list only the releases the caller sees (a package with
none answers 404), and GET /ops/packages only the operator’s. Creating or
upgrading an app from it resolves as for a missing release: without a version,
the newest release the caller sees; with one, the release is installed from
the registry first, which makes a registry release the caller’s too, and
answers what a missing release answers when the registry lacks it (an upload).
Naming its WASM by hash answers as an unknown bundle. Approving outbound hosts
takes the prefixes of the newest release the caller reads (a newer private
release of another organization neither blocks it nor shows), and answers 404
when it reads none, on the API and the consent page; the page’s requesting app
name and author and the frontend origins it may return to come from that release
too. An
upgrade run, whoever starts it, moves an app only to a release the app’s owner
sees, or that the app’s deployment still offers; the operator’s run also to one
it installed. From the cluster version that brings Feature::PrivateReleases,
applying the move judges it again (RELEASE_NOT_USABLE), so no node moves an
app onto a release its owner may not use.
Records from before installers existed read with none; every release has
always recorded installedBy, so each is visible by the rules above from the
first start of this version.
Rolling upgrade (no version gate). A node on the previous release applies an install of an already installed release as a no-op. While both releases run, a repeated install is recorded only on the upgraded nodes (and a node upgraded later keeps the record its old snapshot had). Repeat the install once every node runs this version, and it is recorded everywhere. Nodes on the previous release still list every package to everyone.
Development bundles
Section titled “Development bundles”POST /bundles takes raw WASM (at most 16 MiB) with no publisher signature. It
is refused unless the node allows unsigned bundles (--dev, or
allow_unsigned_bundles). The node checks the WASM compiles, stores it on a
majority of nodes, then records PutBundle { hash, size }. Raw bundles have no
package, so they cannot be served as a frontend, cannot declare outbound
prefixes, and have no pinned signer.
ABI facts
Section titled “ABI facts”The node reads the ABI a component embeds (its calimero:abi section) for what
it acts on: which methods are views and confirm methods, whom each method admits
(accounts, API keys, other apps, the system), its timers, and the tables search
indexes. A method the ABI does not name is refused (default-deny). These facts
are trusted because they are part of the component’s bytes, which a release’s
publisher signs, so an operator cannot mark a method public or a view a
write (App interface).
Frontends
Section titled “Frontends”With --apps-domain D, each package’s frontend is served at its own origin,
{label}.D, where the label is 52 lowercase base32 characters of
SHA-256("calimero.app-host.v1\0" ‖ package) (app_host::label). merod local
uses localhost.
- The files are the release’s own
.mpkfrontend, fetched like its WASM and verified against the publisher’s signature before a byte is served. GET /redirects to the newest release’s entry;/{version}/{path}serves a file, falling back to the entry for client-side routes./.well-known/calimero.jsonnames the package, the cluster serving it (merod’s--cluster), its releases, the deployments offering it (id,name,app,version) and the cluster’s API URLs, so one frontend build finds its cluster wherever it is served.GET /app/{app}/{path}redirects to/{version}/{path}of the release that instance runs (the one it was created at or last upgraded to, never simply the newest shipping its WASM: releases may share one and differ only in their frontend), so a link handed to a customer opens the frontend matching their instance after a newer release is installed.GET /d/{deployment}/{path}redirects to/{version}/{path}?deployment={id}, the release that deployment offers for this package (the newest, if it offers several), so the page knows which deployment to create instances from. Neither names anything but a version; an instance of another package, or a deployment that does not offer this one, is a404.- Only
GETandHEADof files. An unknown label under D is a404, never a node route. Responses carry a fixed content security policy with the cluster’s API origins and the attestation mirror (https://cloud.calimero.network, orhttps://staging.cloud.calimero.networkfor a page under staging’s apps domain, as mero-js picks it; where the page’s client gets the release’s signed measurements and Intel’s collateral; both are signed, so the mirror is trusted with nothing) added toconnect-src, and the origins the release’s signed manifest lists underfrontend.connect, as the node recorded them at install (PackageVersion::frontend_connect; eachhttps://and a DNS name, its leftmost label optionally*, no IP address, at mostMAX_FRONTEND_CONNECT). A release that declares any is installed only fromFeature::FrontendConnect(1.0.0-rc.40), so every node records and counts them. They count as the release’s egress, so one added by an update makes it red. A page is served per release, so they are not under an organization’s outbound approvals or egress switch;GET /apps/{app}/egressnames them while egress is off.media-src 'self' data: blob:lets a page play audio and video it holds in memory.
GET /packages/{package}/{version}/frontend (anyone, over the sealed channel
like every route) answers the release’s entry and every file with its SHA-256
and size, by the path it is served at. The node computed them from the files it
verified against the publisher’s signature. A client that attested the node
checks the page it was served against this list, so whoever terminates TLS or
holds a certificate for the origin cannot swap the page unseen: mero-tee’s
frontend verifier extension does this in the browser (Levels of frontend
trust).
Levels of frontend trust
Section titled “Levels of frontend trust”A page decrypts and shows what the signed-in person reads, and checks the node’s attestation in its own JavaScript, so the person trusts whoever served it:
| Level | Where the page comes from | Who could serve another page | For |
|---|---|---|---|
| Debug | A static host (Vercel) or any branch build | That host, whoever can push to the branch or its dependencies, anyone with a certificate for its name | Demos and debugging, never data that matters |
| Production | The node (--apps-domain), from the release’s signed .mpk; TLS ends in the TD on Calimero Cloud |
Whoever can get a WebPKI certificate for the name (the operator, through its DNS zone) | Every customer-facing app |
| Full | Production, with the frontend verifier extension checking every file against this attested node’s list | Nobody without the attested node’s key or the publisher’s | People who must not have to trust TLS, DNS or the operator |
The extension blocks a changed file before the page runs it in Firefox, and detects it after loading in Chrome, whose extensions cannot read a response.
A session signed in on a frontend is bound to its package; what it may call, and how it asks for the rest, is in Sessions & authority.
Cluster hosts
Section titled “Cluster hosts”A package may be deployed on several clusters while each customer’s account and
organization live on one, and a front that routes by hostname alone (Calimero
Cloud’s resolver) cannot tell them apart by the package’s host. So on each
cluster the package also has the host {cluster_label}.D, where the label is 52
lowercase base32 characters (unpadded, alphabet a–z, 2–7) of
SHA-256("calimero.app-host.cluster.v1\0" ‖ cluster ‖ "\0" ‖ package),
cluster being the node’s --cluster (app_host::cluster_label). For example,
com.calimero.kv on cluster eu-shared-1 is at
zqcnu7vlgoxqnu6ar6awxsbcclqru6ry4ygt3bou7tqpimvx25va.D.
On its cluster the host is the package’s site exactly as {label}.D is (every
path above, /d/{deployment}/ included), and an origin of the package: CORS
admits it, and a passkey ceremony from it opens a session bound to the package.
A cluster label made for another cluster answers 404.
Deployment hosts
Section titled “Deployment hosts”Every deployment has a host of its own too, {dlabel}.D, where the dlabel is
52 lowercase base32 characters (unpadded, alphabet a–z, 2–7) of
SHA-256("calimero.app-host.deployment.v1\0" ‖ id) and id is the
deployment’s id (32 lowercase hex characters; app_host::deployment_label).
For example, deployment 0123456789abcdef0123456789abcdef is served at
lprfchrsznkwfwiu7gfovvcywyujxdza3rentyjkivnw6cxescca.D. Its own prefix keeps a
dlabel apart from every package label.
The deployment’s host names the deployment, and with it the cluster that holds it.
- It serves the frontend of the one package the deployment offers, exactly as
/d/{deployment}/does on the package’s host:GET /redirects to/{version}/?deployment={id}of the release it offers; files, client routes and/app/{app}/as above;/d/{deployment}/only for its own deployment. /.well-known/calimero.jsoncarries"deployment": idand lists that deployment first (nullon the package’s host).- A deployment that offers nothing yet, or apps of several packages, has no
frontend: its host answers
404. - It is an origin of its own, of the same package: CORS admits it, and a passkey ceremony from it opens a session bound to that package, like one from the package’s host.
POST /deploymentsanswers the new deployment’shostbeside itsid, andGET /deploymentsandGET /deployments/{id}carry it (nullwithout--apps-domain).
Custom domains
Section titled “Custom domains”A package’s manager may have the cluster serve its frontend on a domain of
their own (https://kv.example.com) by registering it as a served origin
(POST /package-origins/{package} { origin, served: true }, with their
passkey; Registered origins). A
request whose Host is that name gets the package’s site exactly as {label}.D
serves it (every path above, the same content security policy, /.well-known/calimero.json),
before any node route. Unlike the package’s host, it is a registered origin: a
passkey ceremony there runs under the domain’s own rp-id, never the
cluster’s, and opens a session bound to the package that names the origin;
removing it ends the site and those sessions together, as does uninstalling
the package’s last release.
- Which requests. A
Hostof the name alone, or with port 443, nameshttps://{name}; on a--devnode alocalhostname with its port nameshttp://{name}:{port}(app_host::served_origin_of). Another port, a name under D, or a node’s own API host is never a served site, so the request reaches the node’s routes. - What is refused. Only on a node with
--apps-domain(400 NOT_SERVING); never a name under D or under the cluster’s rp-id; 4 per package and 64 per cluster (MAX_SERVED_ORIGINS_PER_PACKAGE,MAX_SERVED_ORIGINS). Adding one needs every replica, voter and learner on a release that reads the flag (409 CLUSTER_NOT_UPGRADED): an older node would dropservedand hold the origin unserved, not serving the site but still admitting its ceremonies. The API andSystemState::add_package_originjudge the same rules, so a command any node proposes is judged alike on every node. The full list is in Registered origins. - Certificates. merod holds none: TLS for the name ends in front of it, as
for D.
GET /ops/served-originslists every served origin’s host by its package’s label, never the package’s name, for whatever orders the certificates and routes the name (The operator). - One cluster’s record. Each cluster’s log holds its own origins, so the same origin may be registered on another cluster; which cluster a browser reaches is decided by the name’s DNS and the front, not by either log.
Why a flag on a registered origin. Everything a custom domain needs once
the bytes arrive (who may add and remove it, ceremonies under its rp-id, CORS,
binding sessions to the package and ending them on removal) is a registered
origin’s already. A separate record would duplicate all of it, and the same
name could then be held twice, by two packages or under two rp-ids. One map
keyed by origin gives one answer to who holds https://kv.example.com, so a
held origin keeps its served and its rp-id: changing either is refused
(409 ORIGIN_TAKEN for served; remove it first). The consent names served: true so that a
consent to the plain origin, signed by a client that never knew the flag,
cannot be replayed to make the name served.
A custom domain’s sessions are only as safe as its DNS: whoever controls the name can serve their own page there and use its passkeys, though only for that package. On the package’s host, that trust rests on the apps domain’s DNS alone.
Why its own origin. An app’s page is third-party code. Served from the cluster’s own origin, it could reach anything the signed-in account can. On its own origin it is a separate site to the browser, and a passkey ceremony from it opens a session bound to its package: that session reaches only instances of that package, creates only instances of it, and is refused credentials, API keys, approvals, upgrades, uninstalls and uploads, and every organization change but its own package’s channels (Package-bound sessions). Its step-ups come only from its own origin. What it may not do itself, such as approving an upgrade or creating an organization, it asks the node’s consent page for.
In calimero-node
Section titled “In calimero-node”Where the node implements this chapter, by the names in its code: paths are under crates/node/src unless another crate is named.
The design and its reasons are above; a module’s own detail is in its //! doc, and the node’s mental model is crates/node/AGENTS.md.
Packages
Section titled “Packages”Code: packages.rs, system::PackageRecord.
POST /packages(uploads) needsConfig::allow_package_uploads, on with--dev.minRuntimeVersionis compared withCALIMERO_RELEASE_VERSION, set bybuild.rs.Node::release_wasmfetches a release this node does not hold: from the registry for a registry release, never a peer; from a peer for an upload.POST /packages/install { package, version, org? }andPOST /packages?org=pick the organization withNode::install_organdapi::apps::only_org(404for a non-member’s,400 ORG_REQUIRED).PackageVersion::orgsgains it, andInstallPackagerefuses a non-member’s (NOT_AN_ORG_MEMBER); belowFeature::PrivateReleases,record_releasedrops it.- Uninstall answers a release the actor may not use as missing (
api::packages::refuse_unusable;UninstallPackagefromFeature::PrivateReleases), andmanages_packageholds origins to the same rule.
Public and private releases
Section titled “Public and private releases”PackageVersion::visibility (Feature::PrivateReleases) comes from Node::fetch_for_install:
- Without the registry URL’s credential (userinfo): served is public;
401or403(RegistryStatus) goes on to step 2; any other failure is503. - With the credential and
INSTALL_ACCOUNT_HEADER(none for the operator): private. A403witherror: account_not_linkedis403 ACCOUNT_NOT_LINKED, which says to link the account in Calimero Cloud (refused_as_not_linked).
- An account in no organization records none (
orgsempty;installed_by_any); an install again its installer could not then use is404(not_for_this_account) and records nothing. - A reinstall the registry serves to anyone makes a release public, never private again.
release_mpkfetches a public release without the credential, then once more with it on404,401or403; the recorded hash pins what comes back.
Compiling
Section titled “Compiling”Every compile (each service’s component and compute component, and a raw POST /bundles) goes through the node’s one compile::Compiler (Node::compile) on the blocking pool.
| Limit | Value | On breach |
|---|---|---|
MAX_CONCURRENT_COMPILES |
1 at a time | — |
MAX_QUEUED_COMPILES, COMPILE_WAIT |
4 waiting, 10 s each | 503 BUSY |
COMPILE_TIMEOUT |
60 s | 422 COMPILE_TIMEOUT, the service in details; the slot is held until the thread returns |
MAX_COMPONENT_BYTES |
47 MiB unpacked (a blob) | 413 TOO_LARGE before compiling, since it could not reach another node |
A component app’s first-use prepare (Node::prepare_bytes) stays outside the compiler, off the workers through spawn_blocking.
Compute components and compute-only packages
Section titled “Compute components and compute-only packages”- A compute component is prepared on
Node::compute_engineonly. - A compute-only release has
PackageVersion::components = ComputeOnly, emptyservices, andcompute[""]holding the hash. - It needs
require_upgraded_nodes(409 CLUSTER_NOT_UPGRADED): an older node dropscomponentsand would apply it as an app’s release. - App-level lookups read
PackageVersion::app_parts, so a compute-only app’sbundleandcompute_bundleare both the compute hash. - Its app has
AppRecord::components = ComputeOnly;AppRecord::require_app_componentrefuses a call, view, intent, init or tick (422 NO_APP_COMPONENT). - An upgrade between compute-only releases only moves the directory record; one that adds or drops the app component is
409 COMPONENTS_CHANGED. PackageVersion::computemaps service to hash; itsBundleRecordhasPackageRef::compute = true, soresolve_release,CreateAppandUpgradeAppnever treat it as a service.release_factsreads a compute-only release’s ABI from its compute component, asGET /apps/{app}/abidoes.
Pipelines
Section titled “Pipelines”Code: packages/pipelines.rs.
Install compiles each pipeline (calimero_pipeline::compile) against an Env:
self: the package’s compute methods and caps, the default module for a step;- one module per other package a step names, resolved by
Node::resolve_modules(newest when unversioned) to a release that ships one compute component, elseUNKNOWN_MODULE; the release must be oneSystemState::may_pinallows; - the cluster’s pool memory ceilings.
Errors are 400 BAD_PIPELINE with details: [{file, path, code, message}], including NO_COMPUTE and DUPLICATE_NAME.
A named service declaring pipelines is 422 PIPELINES_NEED_ONE_SERVICE.
PackageVersion::pipelines maps name to PipelineRef { hash, worstCaseFuel, modules }, each module a ModulePin { package, version, compute }.
InstallPackage applies only while every pinned release is installed, and uninstalling a pinned one is 409 MODULE_IN_USE (SystemState::module_pinned).
The canonical JSON is a blob under its hash; Node::pipeline_json(hash) reads it, else recompiles from the .mpk.
A release with pipelines also needs 409 CLUSTER_NOT_UPGRADED cleared.
may_pin judges the release as the install leaves it, and an install again resolves its existing pins; InstallPackage judges may_pin_all again from Feature::PrivateReleases.
Release reads
Section titled “Release reads”GET /packages/{package}/{version}/pipelinesanswers{ name: { hash, worstCaseFuel, modules, pipeline } }(meroctl package pipelines).GET /packages/{package}/{version}/capabilitiesanswers the release’s card before any app of it exists, to whoever sees the release. A session bound to the package sees what its account does, and every release only for a record from beforevisibility(SystemState::sees_release_from). It is read throughconsent_page::release_capabilities; its first eight keys matchconsent_page::diff::side, andabiis the embeddedcalimero:abiverbatim.?service=picks the service; an unknown name, or none on a multi-service release, is400 NO_SUCH_SERVICE(packages::no_such_service). A name overMAX_SERVICE_QUERY_BYTESis400 BAD_REQUEST, checked first.
An instance’s release
Section titled “An instance’s release”Code: AppRecord::release, a system::PackageRef.
AppRecord::release is set at create and by every UpgradeApp, which checks that the release ships the bundle (SystemState::release_ships).
Releases may share a WASM, so bundle alone does not say which release runs, and moving to a release with the same WASM is an ordinary upgrade.
An org run writes such an UpgradeApp without running anything on the app’s group.
Node::release_of_appandreport::release_of_appread it, as doesGET /apps.- A record without it (older, or a raw upload) falls back to the only release shipping its bundle (
SystemState::running_release), and to none when several do. - The apply-side
SystemState::governingstill takes the bundle’s first recorded release for such a record. UpgradeRecord::from_releaseandto_releasename both ends of an upgrade.- Create and upgrade carry the compute hash of the release they name (
resolve_release_parts); apply checks the pair withSystemState::ships_compute. - By bundle hash alone,
SystemState::compute_ofresolves the compute part;400 AMBIGUOUS_COMPUTEwhen releases differ,compute: falsewhen none ships one. ComponentCmd::InitandUpgradecarrycompute_bundleintoComponentHead::compute_bundle, so a run pins what the group runs, not the system record.- A release’s parts are charged at their own sizes (
PackageVersion::part_sizes); an older release counts the whole.mpkper part.
Who sees a release
Section titled “Who sees a release”SystemState::sees_release is the rule above; a release recorded before visibility keeps the earlier one (sees_release_from).
- Reading an instance’s release (
report::release_of_app) isSystemState::reads_release, by the package and version the app’s record names. - A route (
src/api,src/consent_page) reads a release a client names only throughrelease_used,releases_used,package_used,newest_used,newest_readandrelease_offered_to. The gatecrates/node/tests/it/release_lookups.rsfails on any other read ofpackages,versionsorbundlesthere, unlessREADS_ALLOWEDnames the line and why. GET /packages[/{p}]shows each release’s kind (PackageVersion::visibility_shown; a catalog release is public) and, of a private one’sorgs, only the reader’s (SystemState::release_orgs_of).- For anyone else,
resolve_releasetreats the release as missing and upgrade runs skip it (api::upgrades::upgrade_release). sees_bundlehides its WASM; a raw bundle’s uploader still names it, and a release’s first installer counts only beside a release recorded beforevisibility.- Outbound approval picks the newest release the caller reads with
PackageRecord::latest_where;SetOutboundApprovaljudges it again at apply fromFeature::PrivateReleases. - An app team (
ScopeApps,MoveApp,createOrg’s) is named after the newest release its maker may use (latest_where), elseno such package, andcreateOrgoffers no app team. - A sign-up’s package name is
passkeys::app_name.
Deployments
Section titled “Deployments”Code: SystemState::deployments, system::Deployment, Offer, api/deployments.rs.
- Managers are whoever
acts_forthe owner (aDeployer); create and offer also needmay_deploywhere deployments are granted. CreateDeployment’s id issystem::deployment_idof the consent’s nonce.- Bounds:
MAX_DEPLOYMENTS_PER_OWNER,MAX_DEPLOYMENTS,MAX_APPS_PER_DEPLOYMENT; namesdeployment_name_fits, app names and idsdeployment_segment_fits. POST /apps { deployment, ... }resolves throughapi::offered_bundle;CreateAppchecks the offer again (offers_bundle).- An offer serves a create or an upgrade only while someone who
acts_forthe owner may use its release (SystemState::offer_serves), else400 NOT_OFFERED; instances made before keep running. upgrade_appresolves a deployment instance’s target withapi::apps::offered_bundle;node::outside_deploymentanswers409 OUTSIDE_DEPLOYMENT.- At apply,
SystemState::within_deploymentjudgesUpgradeAppwhen itsin_deploymentflag is set (Feature::UpgradeInDeployment,in_deployment_rule) orSystemState::cluster_bringsthe rule. Organization, publisher, operator and unit runs judge the same; fromFeature::PrivateReleasesonly an offer that still serves counts, as in an automatic update (auto_update_allows). - The consent page’s
upgradeandupgradeUnittaketoVersionas optional (UpgradeSubject::to_version) and resolve it inconsent_page::requested_release. Another instance still names it (400 VERSION_REQUIRED). UninstallPackagerefuses an offered release (offered).- An organization owner holds a recovery key (
system::RECOVERY_KEY_REQUIRED,Feature::DeploymentNeedsRecovery), judged inapi/deployments.rsandapi/recovery.rsbefore the passkey and again insystem/deployments.rs. - A transfer is
OfferDeployment,AcceptDeploymentandCancelDeploymentTransfer(Feature::DeploymentTransfer), keeping onePendingTransferonDeployment::transfer.hands_overdecides who may offer (NOT_HANDING_OVER); an acceptance pastTRANSFER_TTL_SECSisTRANSFER_LAPSED, andDeployment::transferredrecords the hand-over. - Until a person approves an update of an instance after the hand-over (
AppRecord::owner_seen_at),SystemState::handed_over_unseenkeeps updates from applying on their own.
Deployment secrets
Section titled “Deployment secrets”Code: SystemState::deployment_secrets (deployment id → name → component::InstanceSecret); api/deployments.rs: deployment_secrets, deployment_secret_set, deployment_secret_clear.
SetDeploymentSecretandClearDeploymentSecret;authorizerecomputes the fingerprint from the value the entry carries, so no node swaps it.- Refused:
system::UNDECLARED_SECRET. - Bounds:
component::MAX_SECRET_VALUE_BYTES(shared with instance secrets),MAX_SECRETS_PER_DEPLOYMENT,MAX_DEPLOYMENT_SECRETS. - Gates:
Feature::DeploymentSecretsand, for names reached throughuses,Feature::DeploymentUsedSecrets. - The API sets
SetDeploymentSecret { used: true }only when no offered release declares the name; apply then checksSystemState::deployment_uses_declareoverused_releases. FromFeature::PrivateReleases, a used release counts only if someone acting for the owner may use it (offer_serves) or the offered package’s signer signs it (same_signer). InstallPackagerecordsuses(system::ReleaseUse) only once the feature is active (record_releasedrops it before); reinstalling the same.mpkfills it in.GETaddsdeclaredBy(deployment_declarers).- Lookup at run time:
Node::outbound_for→component::run_secrets. The deployment’s value comes fromSystemState::deployment_secrets_ofon this node’s system state, not the app’s log, and only whereSystemState::deployment_covers. - The gate attaches a value where
PackageVersion::secretsbinds it: one host and one header or body field each (a hard cutover in 1.0.0-rc.37). SecretValue’sDebughides the value, andapply’s answers never carry it.
Instance secrets
Section titled “Instance secrets”Code: api/apps.rs: app_secrets, app_secret_set, app_secret_clear; component.rs: ComponentCmd::SecretSet/SecretClear, InstanceSecret, rows::CSECRET.
- The owner, or whoever manages the organization’s apps, sets a value with a step-up over
{ name, fingerprint }. - The host commands
__secret_setand__secret_clearwrite one hidden row on the replicas (AppMachine::instance_secrets) that no host function reads. - A call’s or tick’s run reads it with the state it sees (
RunExtras::secrets); an action reads it on the leader. outbound_forhands it to the gate ascalimero_outbound::OwnSecrets.GETanswers through the leader’s reserved view__secrets: fingerprints, never values.- Set and clear need
require_upgraded_nodes.
Code: api/apps.rs: create_instance, unit_members; api/upgrades.rs: app_upgrade_unit.
Creating and deleting
Section titled “Creating and deleting”create_instancecreates eachmode: createreference first, at mostMAX_UNIT_DEPTHdeep.unit_memberspicks the newest installed release in range that the creator may use (sees_release), that the instance’s own signer published, or, for a deployment instance, thatoffer_servesallows. Otherwise it is409 USES_NOT_INSTALLED, answered as for a package not installed.- The member’s create runs exactly that release (
CreateAppBody::unit_release,serde(skip)); a unit’s preview (egress::release_unit) and upgrade (unit_plan,egress::update) pick by the same rule. - It records them in
AppRecord::links(Feature::AppLinks) and passes their ids aslinksininitArgswheninittakes them; a client’s ownlinksthere is refused. - A failure after a member was made leaves it in place.
- With
Feature::WholeUnits, members of a deployment instance carry its deployment, and theirCreateAppnamesunit_offer, checked at apply in place of the member’s own release.CreateAppBody::unit_offerisserde(skip): only the node sets it. DELETE /apps/{app}of an instance deletes its unit (SystemState::unit_of, overlinkstransitively) and answers it inmembers.DeleteApp { members }must match at apply (UNIT_NOT_AS_NAMED), and the actor must be allowed to delete each one.- A member (
unit_parent) deleted alone is409 UNIT_MEMBERat the API andUNIT_MEMBERat apply. - The API sends
membersonce the cluster version brings the feature, or for an instance with members (else409 FEATURE_NOT_ACTIVE). - A member finds its instance with
env::unit_of(WITcontext.unit-of;SysDirectory::unit_of), derived from the system state, so nothing new is stored.
Upgrading a unit
Section titled “Upgrading a unit”POST /apps/{app}/upgrade-unitstarts a run whose consent (org:<org> / __upgrade_unit / { app, package, version, targets }) names each member’s release (UpgradeRun::targets,RunTarget,Feature::UnitUpgrade).- Apply derives the apps from
links(upgrade_run_apps);run_may_moveandUpgradeApp { run }judge each byUpgradeRun::target_of. - A member upgraded alone outside its instance’s range is
409 OUTSIDE_UNIT_RANGE(refuse_off_unit_range). unit_planreads nothing of a target its account may not use: before any member, target or passkey it answers asresolve_releaseanswers a missing release. For a deployment instance, anything but its offer that still serves is409 OUTSIDE_DEPLOYMENT.- The consent page’s
upgradeUnit(unit_upgrade_request) builds one model fromapi::unit_planand each app’s sheet; members skip the bound session’swithin.Action::UpgradeUnitis stale when a bundle or the targets moved, andactrunsapi::upgrade_unit.
Attached apps
Section titled “Attached apps”- An
attachreference is held inAppRecord::attached, apart fromlinks, so unit upgrades and deletes never touch it. SystemCmd::LinkApp { app_id, name, target }(Feature::AttachApp; consent<app> / __link / { name, target },system::link_app_args) sets it;target: nulldetaches.- Apply requires: whoever manages both apps, the same organization, a name (
calimero_bundle::is_use_name) that is not a unit member’s, and at mostMAX_ATTACHED. PUT|DELETE /apps/{app}/links/{name}(app_link,app_unlink) also need anattachreference of the running release (release_uses;409 NOT_AN_ATTACH_REFERENCE) and an app of that package (409 WRONG_PACKAGE). An app outside the range is attached and answeredinRange: false.GET /apps/{app}/linkslists each reference (link_row).remove_appdetaches a deleted app everywhere.- The upgrade sheet’s
attachedOutOfRangecomes fromattached_outside. - Runs read links with
env::linked(SysDirectory::linked:links, thenattached).
App frontends
Section titled “App frontends”Code: app_host.rs.
- Files come from
Node::release_mpk, verified before a byte is served; opened ones are cached, and so is a release shipping none. FrontendCache::get_or_loadruns one load per release and at mostFRONTEND_LOADSat once./app/{app}/of a record withoutAppRecord::releasegoes to the newest release shipping its WASM, bycompare_versions./d/{deployment}/is looked up again on fresh state when nothing matches.- Every redirect keeps the request’s query, after any
deploymentit adds, so/?invite=...reaches the page. - The mirror in
connect-srcisattestation_mirror(host):STAGING_ATTESTATION_MIRRORunderSTAGING_APPS_DOMAIN,ATTESTATION_MIRRORon any other host, copies of mero-js’sCLOUD_ENVIRONMENTSkept equal bythe_mirrors_match_mero_js. - Cluster hosts are
cluster_label(config.cluster, package); deployment hosts aredeployment_label(id), served as anapp_host::Site.
Package-bound sessions
Section titled “Package-bound sessions”- The session’s package is
SessionClaims::app, carried by refresh. Principal::withinkeeps it to that package’s apps: gate, app reads and writes, listings.unboundandholderrefuse it everything the design lists, plus redeeming invites, an app’s delete and its access.- The exception is its own package’s teams (
Principal::within_team,OwnTeam,Org::package_of_team):team_createunder one;team_updateof a team below the app team, never the app team itself, with a move only within;team_set_memberandteam_remove_memberon any of them;team_deletebelow the app team when every app in its subtree is the package’s;app_accessof a package app between two such teams.
- Step-ups are over one of the package’s apps, or
org:{org}forBOUND_TEAM_STEP_UPS(__set_team_member,__remove_team_member,__delete_team);step_upjudgeswithin_teamagain.
Smaller rules
Section titled “Smaller rules”- Init:
initArgsis kept on theAppRecord; a failed init answers422 INIT_FAILED(AppState::init_error). - Typed ids (accounts, apps, organizations, teams, upgrade runs, API keys) are base64url that never starts with
-(api::typed_id), which meroctl would read as a flag. - Context ids: an app answers to
hex(SHA-256(app_id))wherever the API takes an app id (Node::canonical_app_id); a component reads its id withenv::app_id. - Inspection:
GET /apps/{app}/storage,GET /apps/{app}/abi,GET /auth/usage(withdeveloperFuelTodayanddeveloperWritesToday),GET /orgs/{org}/usage(admins) andGET /apps/{app}/usage(owner and org admins; see Execution).