Skip to content

Upgrade

Kronik Maintainers edited this page Dec 1, 2026 · 3 revisions

Upgrade

Goal: change the executing binary only after the new engine has replayed the actual retained history without a behavior change. A patch version is not an engine-compatibility exemption.

Procedure

  1. Record old and candidate kronik --version output and binary SHA-256. Obtain the candidate through the release verification process; do not weaken signature verification for an upgrade. Make a recoverable backup using the backup runbook, including its independent key source, and keep a copy of it that the candidate will not write into: the candidate ships to the same [ship] url, and a record the old binary cannot read makes that bucket unrestorable for the old binary too (going back from v0.6.0). With privacy mode on, that copy holds the keystore backups of its time: a subject erased after it stays readable there, and comes back when you go back to it. Record every subject you erase while the copy exists, erase them again after going back, and delete the copy once you stay.

  2. With the candidate binary, check the actual data and configured keys:

    /owned/candidate/kronik --json upgrade check \
      --data-dir /owned/installation/data --config /owned/installation/kronik.toml \
      --workers 2 --dry-run
    /owned/candidate/kronik --json upgrade check \
      --data-dir /owned/installation/data --config /owned/installation/kronik.toml \
      --workers 2

    Select a retained traffic window that covers the application's important behavior. Check the actual old/new engine pair, root and turn counts and that the diff holds no verified difference. A zero-input check is not application evidence. Turns that met erased data (their own recorded input, or state and messages it shaped) are reported N turns unverifiable and pass; read that count, not only the exit code, because those turns were not verified. The check also asks the question the start asks of the data directory, whether the log that retention kept reaches state.db and every actor database: it prints a note on stderr, also with --json, when the start will repair that by installing a snapshot, and exits 1 with STORAGE_CORRUPT and the start's own message when it cannot (A start that stops at the log's start). An actor database the old daemon holds is read without taking that lock. If it cannot be read, the check exits 1 with STORAGE_CORRUPT rather than treating the database as current.

  3. If ENGINE_UPGRADE_DIVERGED, STORAGE_CORRUPT, missing keys or another prerequisite is reported, keep the current binary. Read the saved report/diff. Never edit historical engine strings, suppress divergence, or copy a report from another directory/pair. An unavailable prerequisite is not a passing check. UNAVAILABLE with replay could not run is no verdict either way: the check's instance pool was full, so it compared nothing and wrote no report. Run it again, with fewer --workers if it persists.

  4. Stop only the owned old process/service using its recorded lifecycle handle, replace its binary through the normal verified installation mechanism, and start the candidate with the same owned data/config/key source. In a local fixture, do not install/reload/restart a global host service.

  5. Check health, the real engine.upgrade audit event and integrity through the old recorded LSN. Read the fixture's known SQL/key-value state and repeat a key-backed effect. Restart the owned candidate once and ensure it does not append a second upgrade event for the same completed transition.

  6. Identity replay in both modes must remain complete and unchanged. A fork keeps the code of its fork point, so fork after the last deployment (kronik deployments list); an earlier fork point diverges on the later deployments, not on the engine:

    kronik fork create --at <lsn after the last deployment> --name identity-isolated --reason 'upgrade identity replay'
    kronik replay identity-isolated --mode isolated --reason 'upgrade identity replay'
    kronik fork create --at <the same lsn> --name identity-continuous --reason 'upgrade identity replay'
    kronik replay identity-continuous --mode continuous --reason 'upgrade identity replay'

    Every root input replayed, no changed response, effect or state, no error introduced. Turns that met an erased subject's data are counted as Unverifiable in the replay's summary: they are the check's unverifiable turns, not a change, and no token makes them verifiable. A rollback is an engine transition in the opposite direction and needs its own passing check; restoring the old binary over new data without a check is unsafe. When the old binary cannot read the new records (v0.4.1 after a connection's turn), going back is a restore of step 1's copy.

For data written by v0.3.0 or older, two things differ from the procedure above: an older binary could not start on data that a newer one had served, so the backup of step 1 is the way back, and some reads answer 503 SECRET_UNAVAILABLE after the upgrade until retention has deleted the old snapshots. What was checked, and how to end it, is in Upgrading from v0.3.0 or older.

Compatibility drill

scripts/compatibility-corpus.py preserves actual released producer data and uses the candidate's real public upgrade check, integrity and isolated/continuous identity replay. Its source alone is not a drill result. Keep the immutable producer's release/revision/binary digest and exact candidate proof, including failed/refused transitions. The actual v0.1.0 release reports 0.1.0-dev; retain that historical identity rather than relabeling it. The compatibility policy describes the broader corpus and notice requirements.

Clone this wiki locally