The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(install-e2e): a vanished sqlite sidecar is not deleted user state
ethernet9974dad62bff
diff --git a/tests/install/e2e-assets/verify-user-state.py b/tests/install/e2e-assets/verify-user-state.pyindex 381e15f2b26..51881c9fa6c 100644--- a/tests/install/e2e-assets/verify-user-state.py+++ b/tests/install/e2e-assets/verify-user-state.py@@ -345,6 +345,17 @@ def _modification_allowed(rel: str) -> bool:return is_cron and name in ("ticker_heartbeat", "ticker_last_success")+def _volatile_sidecar(rel: str) -> bool:+ """SQLite's own sidecars (-wal/-shm/-journal): hardware, not user state.++ A WAL/shm pair exists only while a connection is open. A snapshot taken with one+ live sees them; they disappear when it closes, and the report then says the+ upgrade DELETED user state (observed: cron/executions.db-shm and -wal). The+ database itself stays judged -- state.db by row counts -- so real loss still fails.+ """+ return rel.endswith(("-wal", "-shm", "-journal"))++def _rows_shrank(rel: str, before: dict, after: dict) -> bool:if rel.rsplit("/", 1)[-1] != "state.db":return False@@ -363,6 +374,8 @@ def verify_home(home: str, snap: dict) -> dict:failing_modified = {k: v for k, v in judged["modified"].items()if not _modification_allowed(k)}+ failing_deleted = sorted(k for k in judged["deleted"] if not _volatile_sidecar(k))+ tolerated_deleted = sorted(k for k in judged["deleted"] if _volatile_sidecar(k))shrank = sorted(k for k, v in judged["modified"].items()if _rows_shrank(k, v["before"], v["after"]))tolerated_modified = sorted(set(judged["modified"]) - set(failing_modified))@@ -378,20 +391,22 @@ def verify_home(home: str, snap: dict) -> dict:"counts": {"before": len(snap["entries"]),"after": len(fresh["entries"]),- "deleted": len(judged["deleted"]),+ "deleted": len(failing_deleted),"modified": len(failing_modified),"added": len(judged["added"]),"tolerated_modified": len(tolerated_modified),+ "tolerated_deleted": len(tolerated_deleted),"advisory_changed": len(advisory["deleted"]) + len(advisory["modified"])+ len(advisory["added"]),},- "deleted": judged["deleted"],+ "deleted": failing_deleted,+ "tolerated_deleted": tolerated_deleted,"modified": failing_modified,"added": judged["added"],"tolerated_modified": tolerated_modified,"rows_shrank": shrank,"advisory": advisory,- "ok": not judged["deleted"] and not failing_modified and not shrank,+ "ok": not failing_deleted and not failing_modified and not shrank,}@@ -425,6 +440,8 @@ def _render(report: dict) -> str:lines.append(f" ROWS SHRANK {rel}")for rel in report["tolerated_modified"]:lines.append(f" tolerated (config rewrite) {rel}")+ for rel in report.get("tolerated_deleted", []):+ lines.append(f" tolerated (sqlite sidecar) {rel}")advisory = report["advisory"]for label, key in (("advisory deleted", "deleted"), ("advisory modified", "modified")):for rel in advisory[key]:diff --git a/tests/scripts/test_verify_user_state.py b/tests/scripts/test_verify_user_state.pyindex 755331f992b..b979202d60f 100644--- a/tests/scripts/test_verify_user_state.py+++ b/tests/scripts/test_verify_user_state.py@@ -361,3 +361,29 @@ def test_a_dotenv_changed_only_in_comments_is_reported_as_such(tmp_path):rendered = vus._render(report)assert "no key differs" in renderedassert "http://127.0.0.1:9000/v1" not in rendered+++def test_sqlite_sidecars_may_vanish_but_the_database_may_not(tmp_path):+ """A WAL/shm pair exists only while a connection is open.++ A snapshot taken with one live sees them; they vanish when it closes, and the+ report then reads as the upgrade DELETING user state (seen live on+ cron/executions.db-shm and -wal). The database itself must still fail if lost.+ """+ home = tmp_path / "home"+ (home / "cron").mkdir(parents=True)+ for name in ("executions.db", "executions.db-wal", "executions.db-shm"):+ (home / "cron" / name).write_text(f"{name}\n", encoding="utf-8")+ snap = vus.snapshot_home(str(home))++ os.remove(home / "cron" / "executions.db-wal")+ os.remove(home / "cron" / "executions.db-shm")+ report = vus.verify_home(str(home), snap)+ assert report["deleted"] == []+ assert report["tolerated_deleted"] == ["cron/executions.db-shm", "cron/executions.db-wal"]+ assert report["ok"] is True++ os.remove(home / "cron" / "executions.db")+ report = vus.verify_home(str(home), snap)+ assert report["deleted"] == ["cron/executions.db"]+ assert report["ok"] is False