fix(update): default pre-update backup to off (#52729)

The pre-update HERMES_HOME zip shipped on by default (DEFAULT_CONFIG +
runtime fallback both True), so every `hermes update` zipped the entire
~/.hermes — sessions DB, caches, skills — adding minutes to each update.
The shipped cli-config.yaml.example, the --backup help, and the example
config all already said "off by default," so the live default
contradicted its own documentation.

Flip the default to off everywhere: DEFAULT_CONFIG, the runtime
`.get(..., False)` fallback in _run_pre_update_backup, and the stale
--backup help string. Users who want the #48200 safety net opt in via
updates.pre_update_backup: true or --backup for a single run.

Updated test_default_enabled_creates_backup -> test_default_disabled_is_silent
to assert the new default (silent no-op, no zip).
This commit is contained in:
Teknium 2026-06-25 16:01:09 -07:00 committed by GitHub
parent e4ff494860
commit 208f0d7c3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 27 deletions

View file

@ -1863,21 +1863,18 @@ class TestRunPreUpdateBackup:
backups = list((hermes_home / "backups").glob("pre-update-*.zip"))
assert len(backups) == 1
def test_default_enabled_creates_backup(self, hermes_home, capsys):
"""With the new safe default (``pre_update_backup: true``), every
``hermes update`` creates a backup before any destructive step
runs the cost is a few minutes of zip time vs. the alternative
of silent total data loss of ``~/.hermes/`` observed in #48200
when an update step computes a wrong path and the user had no
safety net.
def test_default_disabled_is_silent(self, hermes_home, capsys):
"""With the default (``pre_update_backup: false``), ``hermes update``
does NOT create a backup and stays silent zipping a large
HERMES_HOME can add minutes to every update. Users who want the
#48200 safety net opt in via the config knob or ``--backup``.
"""
from hermes_cli.main import _run_pre_update_backup
_run_pre_update_backup(Namespace(no_backup=False, backup=False))
out = capsys.readouterr().out
assert "Creating pre-update backup" in out
assert "Saved:" in out
backups = list((hermes_home / "backups").glob("pre-update-*.zip"))
assert len(backups) == 1
assert out == ""
assert not list((hermes_home / "backups").glob("pre-update-*.zip")) \
if (hermes_home / "backups").exists() else True
def test_no_backup_flag_skips(self, hermes_home, capsys):
from hermes_cli.main import _run_pre_update_backup