emrg: test — guard upgrade_prompt.j2 backup/rollback chain (data-loss protection) - #1046
Conversation
… protection) Completes the upgrade_prompt structure-guard trilogy (argszero#1045 guarded build steps + macOS re-seal chain; this adds the data-safety chain): - step 4 must back up BOTH app locations ({{ install_dir }}/emrg-gui/EMRG.app install source + ~/Applications/EMRG.app run copy) into {{ backup_dir }} - backup must precede the copy — replacing the working app without a backup leaves no rollback path - restore-from-backup must be instructed in both the step-5 verify failure path and the '## 4. Backup & rollback' section - the '## 4. Backup & rollback' section must contain backup + restore semantics Negative-state verified: removing the backup instruction makes the guard fail, restoring it passes. Python tests 1125 -> 1126, Agent.md synced. NOTE for reviewers: argszero#1044 (connect token guard) also documents 1126 — whomever merges second must rebase and bump the count to 1127.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 190007
Verified locally on head 9ed4eeb (17 upgrade tests pass; full suite collects 1126 = Agent.md 1126):
- Positive state: new
test_upgrade_prompt_backup_rollback_chain_guardedpasses. - Negative-state validation (both genuine regression classes caught):
- reword backup marker → FAIL, drop backup line → FAIL, change backup destination (
{{ backup_dir }}→ other dir) → FAIL - backup-after-copy ordering flip → FAIL, dropping a restore instruction → FAIL
- reword backup marker → FAIL, drop backup line → FAIL, change backup destination (
The test pins all critical invariants of the data-loss chain: backup of BOTH app locations ({{ install_dir }}/emrg-gui/EMRG.app + ~/Applications/EMRG.app), backup destination {{ backup_dir }}, backup-before-copy ordering, and ≥2 restore-on-failure instructions. CI green (test + test-windows).
Note for the next committer: this PR documents Python 1126, same as #1044 — whichever merges second must bump Agent.md to 1127.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 194103 (2/3)
Head 9ed4eeb unchanged since cycle 190007's deep review (17 upgrade tests pass, NEG-harness validated: reword marker / drop backup line / change backup dest / order flip / drop restore all FAIL as expected). CI dual-green (test 33065235866 + test-windows), MERGEABLE/CLEAN.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 195734 (3/3)
Fresh re-verification on head 9ed4eeb: 17 upgrade tests pass, full suite collects 1126 == Agent.md 1126. CI dual-green (test 33065235866 + test-windows), MERGEABLE/CLEAN. Third consecutive ✅ (cycles 190007 → 194103 → 195734, no ❌) — merge condition met.
Uh oh!
There was an error while loading. Please reload this page.
…er (guard on fixed-port probe) Rebased onto master (Agent.md Python 1126→1127 after #1046 merged).
…er (guard on fixed-port probe) (#1044) * emrg: connect — never delete a healthy daemon's token in cleanup_server (guard on fixed-port probe) * emrg: connect — never delete a healthy daemon's token in cleanup_server (guard on fixed-port probe) Rebased onto master (Agent.md Python 1126→1127 after #1046 merged). --------- Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Summary
Add the third static structure guard for
upgrade_prompt.j2— this time for the backup/rollback data-safety chain. Complements the already-merged guards from #1045 (GUI build steps + macOS re-seal chain).Background
The upgrade flow protects against two failure classes:
The backup/rollback instructions in
upgrade_prompt.j2were prompt-only with zero automated protection: a future edit could delete the backup step or the restore path and nothing would turn red.Changes
tests/test_upgrade.py— newtest_upgrade_prompt_backup_rollback_chain_guarded:{{ install_dir }}/emrg-gui/EMRG.app(install source) and~/Applications/EMRG.app(run copy) — into{{ backup_dir }}/<current_version>/Negative-state verified: with the backup instruction removed from the prompt, the guard fails; with it restored, it passes.
Also syncs the documented Python test count in
Agent.md(1125 → 1126).NOTE for reviewers (count race)
#1044 (
connecttoken guard) also documents 1126 (its own +1 test). Whichever PR merges second must rebase onto the new master and bump the count to 1127 — standard flow, same as R2250.Verification
uv run pytest tests/— 1125 passed + 1 skipped (= 1126 collected)tests/test_upgrade.py— 17 passed;tests/test_doc_counts.py— 4 passed