Skip to content

The agent that grows with you

fix(install-e2e): a live cron ticker's stamps are not user state

etherneta9d12fabb4f2
diff --git a/tests/install/e2e-assets/verify-user-state.py b/tests/install/e2e-assets/verify-user-state.py
index ea08b3038d9..d6dc0623b4e 100644
--- a/tests/install/e2e-assets/verify-user-state.py
+++ b/tests/install/e2e-assets/verify-user-state.py
@@ -313,9 +313,16 @@ def _modification_allowed(rel: str) -> bool:
config.yaml is rewritten by config migration: additive, by design.
state.db is a live SQLite file — its size moves whenever rows are written,
so its real contract is the row-count check below, not byte equality.
+ The cron ticker stamps its own liveness on a schedule of its own, inside the
+ verified window or not: they are never user state. On a cold home they show up
+ as ordinary additions (tolerated); once the ticker exists, the same file moves.
"""
name = rel.rsplit("/", 1)[-1]
- return name in ("config.yaml", "state.db")
+ if name in ("config.yaml", "state.db"):
+ return True
+ parent = rel.rsplit("/", 1)[0] if "/" in rel else ""
+ is_cron = parent == "cron" or parent.endswith("/cron")
+ return is_cron and name in ("ticker_heartbeat", "ticker_last_success")
def _rows_shrank(rel: str, before: dict, after: dict) -> bool:
diff --git a/tests/scripts/test_verify_user_state.py b/tests/scripts/test_verify_user_state.py
index e264d576ecf..824c2d4197e 100644
--- a/tests/scripts/test_verify_user_state.py
+++ b/tests/scripts/test_verify_user_state.py
@@ -312,3 +312,30 @@ def test_a_rewritten_dotenv_names_the_moved_variables_and_never_their_values(tmp
for leaked in ("aaaa", "bbbb", "cccc", "dddd", "http://127.0.0.1:9001/v1"):
assert leaked not in rendered
assert leaked not in json.dumps(report)
+
+
+def test_cron_ticker_stamps_move_but_user_cron_state_still_fails(tmp_path):
+ """A live ticker rewrites its own liveness stamps; that is not user state.
+
+ On a cold home those files appear as additions (tolerated). Once the ticker
+ exists the same files register as modifications, which used to fail the user's
+ upgrade outward for the harness's own background process.
+ """
+ home = tmp_path / "home"
+ (home / "cron").mkdir(parents=True)
+ (home / "profiles" / "p" / "cron").mkdir(parents=True)
+ (home / "cron" / "ticker_heartbeat").write_text("100\n", encoding="utf-8")
+ (home / "profiles" / "p" / "cron" / "ticker_last_success").write_text("100\n", encoding="utf-8")
+ (home / "cron" / "jobs.json").write_text('{"jobs": []}\n', encoding="utf-8")
+ snap = vus.snapshot_home(str(home))
+
+ (home / "cron" / "ticker_heartbeat").write_text("200\n", encoding="utf-8")
+ (home / "profiles" / "p" / "cron" / "ticker_last_success").write_text("200\n", encoding="utf-8")
+ (home / "cron" / "jobs.json").write_text('{"jobs": [1]}\n', encoding="utf-8")
+ report = vus.verify_home(str(home), snap)
+
+ assert set(report["modified"]) == {"cron/jobs.json"}
+ assert report["tolerated_modified"] == [
+ "cron/ticker_heartbeat", "profiles/p/cron/ticker_last_success"]
+ # The user's own cron DEFINITIONS are still state that must not move.
+ assert report["ok"] is False