The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
chore(install-e2e): explain a .env modification the key diff cannot name
ethernet3f12c497c8ce
diff --git a/tests/install/e2e-assets/verify-user-state.py b/tests/install/e2e-assets/verify-user-state.pyindex 2f3b8a69937..381e15f2b26 100644--- a/tests/install/e2e-assets/verify-user-state.py+++ b/tests/install/e2e-assets/verify-user-state.py@@ -186,6 +186,25 @@ def _env_key_diff(before: dict, after: dict) -> dict:}+def _env_line_summary(path: str) -> dict:+ """Line-level shape of a .env without any content: totals, blanks, key order.++ The per-key digests deliberately ignore comments, blank lines and ordering, so+ a file rewritten only in those ways reports as modified with nothing named --+ which is exactly the "0 deleted, 1 modified" with no `variables ...` line.+ """+ try:+ with open(path, "r", encoding="utf-8", errors="replace") as fh:+ lines = fh.read().splitlines()+ except OSError:+ return {"lines": 0, "comments": 0, "blanks": 0, "key_order": []}+ comments = sum(1 for line in lines if line.strip().startswith("#"))+ blanks = sum(1 for line in lines if not line.strip())+ order = [line.split("=", 1)[0].strip() for line in lines+ if "=" in line and line.strip() and not line.strip().startswith("#")]+ return {"lines": len(lines), "comments": comments, "blanks": blanks, "key_order": order}++def _entry_record(abs_path: str) -> dict:if _is_link(abs_path):record: dict = {"kind": "symlink", "target": os.readlink(abs_path)}@@ -207,6 +226,7 @@ def _entry_record(abs_path: str) -> dict:record["sha256"] = _sha256_file(abs_path)if os.path.basename(abs_path) == ".env":record["env_keys"] = _env_key_hashes(abs_path)+ record["env_lines"] = _env_line_summary(abs_path)return recordreturn {"kind": "other"}@@ -397,6 +417,10 @@ def _render(report: dict) -> str:if detail.get(field))if named:lines.append(f" {rel}: variables {named} (names only; values are never recorded)")+ else:+ lines.append(f" {rel}: no key differs -- comments/order/blanks only "+ f"(before {pair['before'].get('env_lines')}, after {pair['after'].get('env_lines')}; "+ f"counts and names, never content)")for rel in report["rows_shrank"]:lines.append(f" ROWS SHRANK {rel}")for rel in report["tolerated_modified"]:diff --git a/tests/scripts/test_verify_user_state.py b/tests/scripts/test_verify_user_state.pyindex 824c2d4197e..755331f992b 100644--- a/tests/scripts/test_verify_user_state.py+++ b/tests/scripts/test_verify_user_state.py@@ -339,3 +339,25 @@ def test_cron_ticker_stamps_move_but_user_cron_state_still_fails(tmp_path):"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+++def test_a_dotenv_changed_only_in_comments_is_reported_as_such(tmp_path):+ """The per-key digests ignore comments, order and blanks by design.++ So a .env rewritten only in those parts reports as modified with no `variables`+ line -- the real "0 deleted, 1 modified" with nothing named. The report must say+ that explicitly, and still carry no values.+ """+ home = tmp_path / "home"+ home.mkdir()+ (home / ".env").write_text("# one\nOPENAI_BASE_URL=http://127.0.0.1:9000/v1\n", encoding="utf-8")+ snap = vus.snapshot_home(str(home))++ (home / ".env").write_text("# one\n# two\nOPENAI_BASE_URL=http://127.0.0.1:9000/v1\n", encoding="utf-8")+ report = vus.verify_home(str(home), snap)++ assert set(report["modified"]) == {".env"}+ assert report["modified"][".env"]["key_diff"]["keys_changed"] == []+ rendered = vus._render(report)+ assert "no key differs" in rendered+ assert "http://127.0.0.1:9000/v1" not in rendered