The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(install-e2e): judge every sqlite database by its rows, not its bytes
ethernet633ff8801e87
diff --git a/tests/install/e2e-assets/verify-user-state.py b/tests/install/e2e-assets/verify-user-state.pyindex 51881c9fa6c..86f2ce8d32b 100644--- a/tests/install/e2e-assets/verify-user-state.py+++ b/tests/install/e2e-assets/verify-user-state.py@@ -215,7 +215,7 @@ def _entry_record(abs_path: str) -> dict:if os.path.isfile(abs_path):st = os.lstat(abs_path)record = {"kind": "file", "size": st.st_size}- if os.path.basename(abs_path) == "state.db":+ if os.path.basename(abs_path).endswith(".db"):counts = _db_counts(abs_path)if counts is not None:# Row counts, not bytes: a byte hash of a live db is noise.@@ -338,7 +338,7 @@ def _modification_allowed(rel: str) -> bool:as ordinary additions (tolerated); once the ticker exists, the same file moves."""name = rel.rsplit("/", 1)[-1]- if name in ("config.yaml", "state.db"):+ if name in ("config.yaml", "state.db") or name.endswith(".db"):return Trueparent = rel.rsplit("/", 1)[0] if "/" in rel else ""is_cron = parent == "cron" or parent.endswith("/cron")@@ -357,7 +357,7 @@ def _volatile_sidecar(rel: str) -> bool:def _rows_shrank(rel: str, before: dict, after: dict) -> bool:- if rel.rsplit("/", 1)[-1] != "state.db":+ if not rel.rsplit("/", 1)[-1].endswith(".db"):return Falseold, new = before.get("rows"), after.get("rows")if not isinstance(old, dict) or not isinstance(new, dict):diff --git a/tests/scripts/test_verify_user_state.py b/tests/scripts/test_verify_user_state.pyindex b979202d60f..004237bffd3 100644--- a/tests/scripts/test_verify_user_state.py+++ b/tests/scripts/test_verify_user_state.py@@ -387,3 +387,32 @@ def test_sqlite_sidecars_may_vanish_but_the_database_may_not(tmp_path):report = vus.verify_home(str(home), snap)assert report["deleted"] == ["cron/executions.db"]assert report["ok"] is False+++def test_any_sqlite_database_is_judged_by_rows_not_bytes(tmp_path):+ """Live SQLite files churn bytes constantly; their contract is the rows.++ state.db was already handled that way; cron/executions.db was not, so a run+ writing rows mid-window would have failed the leg as a byte modification.+ """+ home = tmp_path / "home"+ (home / "cron").mkdir(parents=True)+ db = home / "cron" / "executions.db"+ with sqlite3.connect(db) as conn:+ # A table the verifier actually counts (COUNTED_TABLES), not an arbitrary one.+ conn.execute("create table cron_jobs (id integer primary key, at text)")+ conn.execute("insert into cron_jobs (at) values ('one')")+ snap = vus.snapshot_home(str(home))++ with sqlite3.connect(db) as conn: # rows added: bytes move, contract holds+ conn.execute("insert into cron_jobs (at) values ('two')")+ report = vus.verify_home(str(home), snap)+ assert report["modified"] == {}+ assert report["rows_shrank"] == []+ assert report["ok"] is True++ with sqlite3.connect(db) as conn: # rows lost: still fatal+ conn.execute("delete from cron_jobs")+ report = vus.verify_home(str(home), snap)+ assert report["rows_shrank"] == ["cron/executions.db"]+ assert report["ok"] is False