Skip to main content

ensure_disk_at_current_version

Function ensure_disk_at_current_version 

Source
pub fn ensure_disk_at_current_version(path: &Path) -> Result<(), Error>
Expand description

Refuse to proceed if the on-disk config is at a stale schema version.

Used by CLI write commands (config set, config patch, config init) to ensure the user explicitly opts into the migration via zeroclaw config migrate before modifying a stale config — the alternative would be a silent auto-migrate-on-write, which is harder to audit and surprises users who didn’t realize their config schema had changed.

  • Missing file → Ok(()) (fresh install: nothing to migrate yet).
  • Current version → Ok(()).
  • Stale (or future) version → Err with a message that names the disk version and the command the user needs to run.