Skip to content

Finalization invariants and fail-closed startup

A finalized control plane checks itself before it serves anything, and refuses to serve when any check fails. This is a hard stop at startup rather than a probe that merely reports unhealthy, which is why a misconfigured finalized deployment never reaches a state where it accepts a request it should not have.

What finalized means

A deployment is finalized when its identity latch is active. Until then the invariant set below is skipped entirely and the health surface reports bootstrap_finalized: false. See The identity latch.

The invariant set

Every check runs on both startup and readiness. Any failure is 503 with a message naming what was wrong.

flowchart TB
  S["Start"] --> F{"bootstrap_finalized?"}
  F -->|no| OK1["Serve: bootstrap mode"]
  F -->|yes| C1["Store answers"]
  C1 --> C2["Backend is postgres"]
  C2 --> C3["auth.runtime_shared_secret present"]
  C3 --> C4["Latch active: instance uuid and revision"]
  C4 --> C5["Latched backend and profile are supported values"]
  C5 --> C6["Observed backend matches latched"]
  C6 --> C7["Observed profile matches latched"]
  C7 --> C8["Deployment mode latch: revision and spec digest"]
  C8 --> C9["Active trust bundle: revision and digest"]
  C9 --> OK2["Serve: finalized"]
Check Failure message
The store answers and leases are readable startup invariants failed: ...
Backend is postgres finalized control-plane runtime requires postgres backend; observed db_backend=...
A runtime shared secret is configured finalized control-plane runtime requires auth.runtime_shared_secret
The latch carries an instance UUID and revision finalized control-plane runtime requires active immutable cp identity latch
The latched backend is a supported value finalized control-plane runtime requires cp identity latch backend parity metadata
The latched profile is a supported value finalized control-plane runtime requires cp identity latch store profile parity metadata
Observed backend equals latched backend finalized control-plane runtime backend drift detected; latched=... observed=...
Observed profile equals latched profile finalized control-plane runtime store profile drift detected; latched=... observed=...
A deployment mode latch exists finalized control-plane runtime requires immutable deployment mode latch
An active trust bundle exists finalized control-plane runtime requires active trust lifecycle metadata

Two of these are worth calling out.

Backend must be postgres. A finalized control plane that observes any other backend refuses to serve, regardless of what it was latched against. The shipped manifest's file-backed default is a bootstrap shape, so finalizing on it produces a deployment that fails its own checks.

Drift is symmetrical. The latched value and the observed value are both reported, so the message tells you whether the deployment moved or the latch did.

What each health endpoint answers

Endpoint Evaluates the invariant set Typical cause of failure
/v1/system/health/liveness No The process is dead
/v1/system/health/startup Yes The deployment cannot legitimately start
/v1/system/health/readiness Yes Configuration drifted, or a dependency stopped answering

Liveness reports only that the process is running. Restarting a pod whose readiness fails on an invariant will not help, because the next start evaluates the same set and stops at the same place.

Readiness additionally reports the observed store details, which is what makes it the useful endpoint to read when diagnosing:

curl -fsS "${CP_CLI_ENDPOINT}/v1/system/health/readiness" \
  | jq '{db_backend, store_profile, db_path, db_dsn_configured, finalization}'

What a healthy finalized response contains

The finalization block reports the identity, the latched storage values and the two governance latches:

bootstrap_finalized            true
cp_instance_uuid               cp-...
cp_identity_revision           ...
locked_db_backend              postgres
locked_store_profile           durable
policy_revision                ...
policy_source_spec_digest      sha256:...
active_trust_bundle_revision   ...
active_trust_bundle_digest     ...

The last four are governance rather than storage. A finalized control plane requires an immutable deployment mode latch and an active trust bundle, so a deployment that lost either stops serving rather than continuing without the governance state its nodes are validated against.

Reading a failure

Because every message names its cause, the response tells you which class of problem you have.

Storage. Backend, profile or drift messages mean the deployment's environment no longer matches what was latched. The fix is to restore the environment, not to change the latch, which cannot be changed. See Storage backends and profiles.

Identity. A missing latch on a finalized deployment means the latch record is not readable, which is a storage problem presenting as an identity one.

Governance. Missing deployment mode or trust bundle metadata means the control plane has state but not the governance records it needs to admit nodes. See Trust bundles and revisions.

Secret. A missing runtime shared secret is the one failure that is purely configuration, and it appears immediately after finalization if the secret was never set.

Where each of these is diagnosed in practice is Where to look when a step fails.