Skip to content

The agent that grows with you

test(update): drop gzip from the rehearsal backup archives

ethernete7055b2ffadb
diff --git a/scripts/update-test/HANDOFF.md b/scripts/update-test/HANDOFF.md
index 46aa292c1ea..70376756f48 100644
--- a/scripts/update-test/HANDOFF.md
+++ b/scripts/update-test/HANDOFF.md
@@ -1,166 +1,32 @@
-# Handing this off
+# testing the bundles branch against your normal hermes install
-This directory is a small kit you give to someone who already runs Hermes, so
-they can point their install at a custom repo/ref, update through the normal
-update path, and put everything back afterwards.
+instructions:
-Three files matter to them: `hermes-update-rehearsal.sh` (macOS/Linux),
-`hermes-update-rehearsal.ps1` (Windows), and `PLAN.md` if they want the detail.
-`smoke-test.*` is for you, not them.
+1. close hermes, the gateway, etc. make sure you have no running hermes processes.
----
+2. apply my updater override:
+ open a terminal, `cd` to the folder you downloaded this script into. then,
-## 1. What to send
+ macos/linux:
+ `curl -fsSL 'sh_url' | bash -s -- pre`
+ windows:
+ `& ([scriptblock]::Create((irm 'ps1_url'))) pre`
-Zip the directory and send it however you like (Discord, email, a gist):
+ this backs up your entire hermes home and any desktop app settings. _from this point on, nothing you do in hermes will be preserved, until you restore your backup at the end._
-```bash
-cd ~/Documents && zip -r hermes-update-rehearsal.zip hermes-update-rehearsal
-```
+3. boot hermes up to ensure everything is working, still. if you normally have a background service, gateway, etc, make sure it's running.
-```powershell
-Compress-Archive -Path "$HOME\Documents\hermes-update-rehearsal" `
- -DestinationPath "$HOME\Documents\hermes-update-rehearsal.zip" -Force
-```
+4. update hermes like you normally do.
-Fill these in before you send, because the recipient cannot guess them:
+5. test hermes. make sure nothing breaks, everything you use still works, etc.
-| placeholder | meaning | example |
-|---|---|---|
-| `SOURCE` | repo their update should pull from | `https://github.com/<you>/hermes-agent.git` |
-| `REF` | branch or tag in that repo | `<your-branch>` |
-| `WHY` | one line on what you changed | "the desktop updater rewrite" |
+6. close hermes, the gateway, etc. make sure you have no running hermes processes.
----
+7. restore your backup:
-## 1b. Or: run straight from a gist
+ macos/linux:
+ `curl -fsSL 'sh_url' | bash -s -- post --yes`
+ windows:
+ `& ([scriptblock]::Create((irm 'ps1_url'))) post --yes`
-Fewer moving parts than a zip — the recipient needs nothing on disk. Put the two
-scripts in a gist, then use each file's **per-file raw URL**
-(`.../raw/<filename>`), never the gist-wide `/raw/` URL: that concatenates
-every file in the gist into one blob, so you would be piping two scripts into
-one shell.
-
-Pin the revision too, so the recipient runs the exact file you tested instead of
-whatever the gist says later:
-
-**macOS / Linux**
-
-```bash
-curl -fsSL '<RAW_URL>' | bash -s -- pre --source '<SOURCE>' --ref '<REF>'
-```
-
-**Windows**
-
-```powershell
-& ([scriptblock]::Create((irm '<RAW_URL>'))) pre -Source '<SOURCE>' -Ref '<REF>'
-```
-
-`post` is the same command with `pre` replaced by `post`.
-
-Two things worth knowing about this form:
-
-- The PowerShell one is not blocked by `-ExecutionPolicy`. That policy governs
- files, and this never writes one.
-- Piped in, a script cannot see its own path. The "run this next" line it prints
- therefore says `hermes-update-rehearsal.sh post --backup-root …` rather than a
- path, plus a reminder to re-run the same one-liner. That is expected, not a
- failure.
-
----
-
-## 2. The message to paste
-
-> I'd like you to test a Hermes change on your install. It's reversible, but
-> please read the first paragraph before you start.
->
-> **What this does:** it backs up your entire Hermes install, then points your
-> updater at my fork's `<REF>` instead of the official repo, so `hermes update`
-> pulls my code. Nothing is updated until *you* run `hermes update`. When you're
-> done, `post` wipes and puts your backup back.
->
-> **What it touches:** your whole Hermes install (`HERMES_HOME`), the desktop
-> app's data, the `hermes` commands on your PATH, and one line in your global
-> git config. `post` undoes all of it. If you stop part-way, run `post` anyway —
-> don't just walk away from it.
->
-> **Before you start:** you need `git`, `tar` and `python3` on your PATH, about
-> as much free disk as your install takes, and ~30 seconds of network. Close the
-> desktop app and any running Hermes sessions first — a running process holds
-> files the updater needs.
->
-> If you're on Windows and `python3` is the Microsoft Store stub, install a real
-> Python first; the script will tell you if it can't find one.
->
-> **1. Back up and point it at my code**
->
-> ```bash
-> ./hermes-update-rehearsal.sh pre --source SOURCE --ref REF
-> ```
->
-> (Windows: `powershell -ExecutionPolicy Bypass -File hermes-update-rehearsal.ps1 pre -Source SOURCE -Ref REF`)
->
-> It prints where your backup went and the exact next commands. Read that output
-> — it's the source of truth rather than this message.
->
-> **Check the block it prints at the top before it does anything.** It looks
-> like this, and it tells you which install it's about to touch:
->
-> ```
-> === your install ===
-> HERMES_HOME ...
-> install ...
-> desktop data ...
-> backup root ...
-> ```
->
-> It follows your `HERMES_HOME`. If you run Hermes with a profile (or a
-> non-default home) and that block shows the wrong place, stop, `export` the
-> right `HERMES_HOME`, and run `pre` again. If it's showing the wrong home,
-> `post` would restore the wrong home too.
->
-> **2. Update and use it**
->
-> ```bash
-> cd "$HERMES_HOME/hermes-agent" && hermes update
-> ```
->
-> (If your install isn't in the default place, use your path. `pre` prints it.)
-> Then use Hermes normally for a bit — that's the part I actually need tested.
-> If you use the desktop app, update it from Settings → About → Update now
-> instead, so I get the app's own updater covered too.
->
-> **3. Put it back**
->
-> ```bash
-> ./hermes-update-rehearsal.sh post
-> ```
->
-> Close the app first. It removes the redirect, wipes, restores your backup, and
-> reports how exactly it matched. Keep the backup folder until that looks right.
->
-> **Send me back:** the output of all three steps, and anything that looked
-> wrong. If `post` says entries didn't match, send me that too — it's the most
-> useful thing you could find.
-
----
-
-## 3. Before you send it
-
-- [ ] `bash smoke-test.sh` and `smoke-test.ps1` are both green. The kit's
- restore path runs on someone else's machine; this is the only test it has.
-- [ ] `SOURCE`/`REF` actually contain the code you want tested — the script
- defaults to the fork's `main`, so if you're testing a branch you must pass
- `--ref`.
-- [ ] You've said out loud that the recipient's install gets rewritten, even
- though it's reversible.
-
-## 4. After they run it
-
-- [ ] Confirm they ran `post` — a half-finished run leaves a global git-config
- redirect behind. If they didn't, the manual undo is:
- `git config --global --unset-all url.<SOURCE>.insteadOf` plus
- `rm "$HERMES_HOME/.skip_upstream_prompt"`.
-- [ ] Their "nothing was lost" claim is a self-report. If it matters, have them
- run `hermes doctor` and open the desktop app once before deleting the
- backup.
+ this puts hermes back to exactly how it was beforehand.
diff --git a/scripts/update-test/PLAN.md b/scripts/update-test/PLAN.md
index a1307fab4fc..47e124d8a9d 100644
--- a/scripts/update-test/PLAN.md
+++ b/scripts/update-test/PLAN.md
@@ -116,7 +116,9 @@ Everything lands in `~/hermes-update-rehearsal/<UTC timestamp>/` (override with
`--backup-root`). Keep it off the same volume if you can — the copy is the size
of the install, and `pre` reports how long it took.
-1. **The entire `$HERMES_HOME`** → `hermes-home.tgz`. No excludes: the
+1. **The entire `$HERMES_HOME`** → `hermes-home.tar` (uncompressed: the backup
+ root is usually the same internal disk, so gzip costs ~5x the wall time and
+ buys nothing). No excludes: the
`hermes-agent/` checkout, the venv/PM store, `node_modules`, `.git` and all
runtime state come with it, so a restore is a true rollback rather than a
re-download. SQLite sidecars (`-wal`/`-shm`/`-journal`) travel **with** their
@@ -129,7 +131,7 @@ of the install, and `pre` reports how long it took.
`remotes.txt` (`name<TAB>url`, from `config --get`, not `remote -v`), and the
checkout's local `.git/config`. These are *assertion* inputs for `verify`,
not a restore mechanism — the tar already carries `.git`.
-3. **Electron userData** → `electron-userdata.tgz`.
+3. **Electron userData** → `electron-userdata.tar`.
`HERMES_DESKTOP_USER_DATA_DIR` when set, else the platform default
(`~/Library/Application Support/Hermes`, `%APPDATA%\Hermes`) plus
`HERMES_DATA_DIR_SUFFIX`.
@@ -309,7 +311,7 @@ PM store and `node_modules` come back with it, not just the config.
and restore the `hermes` launcher shims.
4. Stop the desktop app and the gateway.
5. Delete `$HERMES_HOME`, the Electron userData dir, and the recorded shim files.
-6. Extract `hermes-home.tgz` into `$HERMES_HOME` and `electron-userdata.tgz`
+6. Extract `hermes-home.tar` into `$HERMES_HOME` and `electron-userdata.tar`
into the userData dir.
7. Restore the shims (files from `shims/`, symlinks from `shims-links.txt`).
8. Re-fingerprint and compare against the pre-`pre` fingerprints, then report
diff --git a/scripts/update-test/hermes-update-rehearsal.ps1 b/scripts/update-test/hermes-update-rehearsal.ps1
index ffb6709664f..78eabe4c7ee 100755
--- a/scripts/update-test/hermes-update-rehearsal.ps1
+++ b/scripts/update-test/hermes-update-rehearsal.ps1
@@ -406,13 +406,15 @@ function Invoke-Pre {
Step 'copying your entire HERMES_HOME'
$started = Get-Date
- $homeTar = Join-Path $script:Snap 'hermes-home.tgz'
+ $homeTar = Join-Path $script:Snap 'hermes-home.tar'
# No excludes: checkout, venv, PM store and node_modules come too, so post is
- # a true rollback rather than a re-download.
- & $script:Tar -czf $homeTar -C $P.Home .
+ # a true rollback rather than a re-download. No -z: the backup root is
+ # typically the same internal disk, so gzip costs ~5x the wall time for
+ # nothing (measured on an M1).
+ & $script:Tar -cf $homeTar -C $P.Home .
if ($LASTEXITCODE -ne 0) { Fail 'backup failed (tar)' }
$elapsed = [int]((Get-Date) - $started).TotalSeconds
- Ok "hermes-home.tgz ($([math]::Round((Get-Item $homeTar).Length / 1MB, 1)) MB, ${elapsed}s)"
+ Ok "hermes-home.tar ($([math]::Round((Get-Item $homeTar).Length / 1MB, 1)) MB, ${elapsed}s)"
Step 'recording git facts'
$head = Invoke-Git $P @('rev-parse', 'HEAD')
@@ -428,10 +430,10 @@ function Invoke-Pre {
Step "copying the desktop app's data"
if (Test-Path -LiteralPath $P.UserData) {
- $udTar = Join-Path $script:Snap 'electron-userdata.tgz'
- & $script:Tar -czf $udTar -C $P.UserData .
+ $udTar = Join-Path $script:Snap 'electron-userdata.tar'
+ & $script:Tar -cf $udTar -C $P.UserData .
if ($LASTEXITCODE -ne 0) { Fail 'userData backup failed' }
- Ok "electron-userdata.tgz ($([math]::Round((Get-Item $udTar).Length / 1KB, 1)) KB)"
+ Ok "electron-userdata.tar ($([math]::Round((Get-Item $udTar).Length / 1KB, 1)) KB)"
}
else { Warn "no Electron userData at $($P.UserData) (desktop app not installed?)" }
@@ -650,15 +652,15 @@ function Invoke-Post {
Step 'restoring your HERMES_HOME'
New-Item -ItemType Directory -Force -Path $P.Home | Out-Null
- & $script:Tar -xzf (Join-Path $script:Snap 'hermes-home.tgz') -C $P.Home
+ & $script:Tar -xf (Join-Path $script:Snap 'hermes-home.tar') -C $P.Home
if ($LASTEXITCODE -ne 0) { Fail "restore failed -- your backup is intact at $($script:Snap)" }
Ok 'restored'
Step "restoring the desktop app's data"
- $udTar = Join-Path $script:Snap 'electron-userdata.tgz'
+ $udTar = Join-Path $script:Snap 'electron-userdata.tar'
if (Test-Path -LiteralPath $udTar) {
New-Item -ItemType Directory -Force -Path $P.UserData | Out-Null
- & $script:Tar -xzf $udTar -C $P.UserData
+ & $script:Tar -xf $udTar -C $P.UserData
if ($LASTEXITCODE -ne 0) { Fail "userData restore failed (backup intact at $($script:Snap))" }
Ok 'restored'
}
diff --git a/scripts/update-test/hermes-update-rehearsal.sh b/scripts/update-test/hermes-update-rehearsal.sh
index 8629f9a0ae8..a52f27dea3a 100755
--- a/scripts/update-test/hermes-update-rehearsal.sh
+++ b/scripts/update-test/hermes-update-rehearsal.sh
@@ -360,9 +360,12 @@ cmd_pre() {
# No excludes: checkout, venv, PM store and node_modules come too, so `post`
# is a true rollback rather than a re-download. SQLite sidecars travel WITH
# their db on purpose (a raw copy of db+wal+shm is consistent).
- tar -czf "$SNAP/hermes-home.tgz" -C "$HERMES_HOME" . || die "backup failed (tar)"
+ # No -z: the backup root is typically the same internal disk, so the size
+ # saving buys nothing and gzip costs ~5x the wall time on a checkout-sized
+ # tree (72s vs 14s measured on an M1). Rename to .tar to match the format.
+ tar -cf "$SNAP/hermes-home.tar" -C "$HERMES_HOME" . || die "backup failed (tar)"
elapsed=$((SECONDS - started))
- ok "hermes-home.tgz ($(du -h "$SNAP/hermes-home.tgz" | cut -f1), ${elapsed}s)"
+ ok "hermes-home.tar ($(du -h "$SNAP/hermes-home.tar" | cut -f1), ${elapsed}s)"
step "recording git facts"
{
@@ -381,8 +384,8 @@ cmd_pre() {
step "copying the desktop app's data"
if [ -d "$USERDATA_DIR" ]; then
- tar -czf "$SNAP/electron-userdata.tgz" -C "$USERDATA_DIR" . || die "userData backup failed"
- ok "electron-userdata.tgz ($(du -h "$SNAP/electron-userdata.tgz" | cut -f1))"
+ tar -cf "$SNAP/electron-userdata.tar" -C "$USERDATA_DIR" . || die "userData backup failed"
+ ok "electron-userdata.tar ($(du -h "$SNAP/electron-userdata.tar" | cut -f1))"
else
warn "no Electron userData at $USERDATA_DIR (desktop app not installed?)"
fi
@@ -616,13 +619,13 @@ cmd_post() {
step "restoring your HERMES_HOME"
mkdir -p "$HERMES_HOME"
- tar -xzf "$SNAP/hermes-home.tgz" -C "$HERMES_HOME" || die "restore failed — your backup is intact at $SNAP"
+ tar -xf "$SNAP/hermes-home.tar" -C "$HERMES_HOME" || die "restore failed — your backup is intact at $SNAP"
ok "restored"
step "restoring the desktop app's data"
- if [ -f "$SNAP/electron-userdata.tgz" ]; then
+ if [ -f "$SNAP/electron-userdata.tar" ]; then
mkdir -p "$USERDATA_DIR"
- tar -xzf "$SNAP/electron-userdata.tgz" -C "$USERDATA_DIR" || die "userData restore failed (backup intact at $SNAP)"
+ tar -xf "$SNAP/electron-userdata.tar" -C "$USERDATA_DIR" || die "userData restore failed (backup intact at $SNAP)"
ok "restored"
else
warn "there was no desktop app data to restore"
diff --git a/scripts/update-test/smoke-test.ps1 b/scripts/update-test/smoke-test.ps1
index 56dc4b9a560..1ffb08ec994 100755
--- a/scripts/update-test/smoke-test.ps1
+++ b/scripts/update-test/smoke-test.ps1
@@ -191,10 +191,10 @@ try {
$r = Invoke-Rehearsal -Arguments @('pre', '-Source', $Install, '-Ref', 'main', '-BackupRoot', $Backups)
Check 'pre exits 0' ($r.Code -eq 0)
$Snap = (Get-ChildItem -LiteralPath $Backups -Directory | Sort-Object Name)[-1].FullName
- foreach ($f in @('hermes-home.tgz', 'electron-userdata.tgz', 'fingerprint-before.txt', 'userdata-before.txt', 'manifest.json', 'shims.txt', 'checkout.txt', 'remotes.txt')) {
+ foreach ($f in @('hermes-home.tar', 'electron-userdata.tar', 'fingerprint-before.txt', 'userdata-before.txt', 'manifest.json', 'shims.txt', 'checkout.txt', 'remotes.txt')) {
Check "backup artifact $f" (Test-Path -LiteralPath (Join-Path $Snap $f))
}
- $tarList = (& tar.exe -tzf (Join-Path $Snap 'hermes-home.tgz') | Out-String)
+ $tarList = (& tar.exe -tf (Join-Path $Snap 'hermes-home.tar') | Out-String)
Check 'whole home: checkout .git in the tar' ($tarList -match '(?m)^\./hermes-agent/\.git/config\s*$')
Check 'whole home: PM store in the tar' ($tarList -match '(?m)^\./hermes-agent/\.hermes-runtime/python/interpreter\.bin\s*$')
Check 'whole home: config.yaml in the tar' ($tarList -match '(?m)^\./config\.yaml\s*$')
diff --git a/scripts/update-test/smoke-test.sh b/scripts/update-test/smoke-test.sh
index ab87fba53b3..29320afebb9 100755
--- a/scripts/update-test/smoke-test.sh
+++ b/scripts/update-test/smoke-test.sh
@@ -84,10 +84,10 @@ STATUS_BEFORE="$(git -C "$INSTALL" status --porcelain)"
"${RUN[@]}" pre --source "$INSTALL" --ref main --backup-root "$BACKUPS" > "$ROOT/pre.log" 2>&1
check $? "pre exits 0"
SNAP="$(ls -1d "$BACKUPS"/*/ | head -1)"; SNAP="${SNAP%/}"
-for f in hermes-home.tgz electron-userdata.tgz fingerprint-before.txt userdata-before.txt manifest.json shims.txt checkout.txt remotes.txt; do
+for f in hermes-home.tar electron-userdata.tar fingerprint-before.txt userdata-before.txt manifest.json shims.txt checkout.txt remotes.txt; do
[ -e "$SNAP/$f" ]; check $? "backup artifact $f"
done
-TARLIST="$(tar -tzf "$SNAP/hermes-home.tgz" 2>&1 || true)"
+TARLIST="$(tar -tf "$SNAP/hermes-home.tar" 2>&1 || true)"
grep -qE '^\./hermes-agent/\.git/config$' <<< "$TARLIST"; check $? "whole home: checkout .git in the tar"
grep -qE '^\./hermes-agent/\.hermes-runtime/python/interpreter\.bin$' <<< "$TARLIST"; check $? "whole home: PM store in the tar"
grep -qE '^\./config\.yaml$' <<< "$TARLIST"; check $? "whole home: config.yaml in the tar"