The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: trim the Aug-2026 conformance suites to behaviour invariants on main
teknium18a5a66d0d8f2
diff --git a/tests/agent/test_injected_param_strip_retry_registry.py b/tests/agent/test_injected_param_strip_retry_registry.pyindex cd6169a79e9..c3c719d2fc4 100644--- a/tests/agent/test_injected_param_strip_retry_registry.py+++ b/tests/agent/test_injected_param_strip_retry_registry.py@@ -116,9 +116,6 @@ class _FlakyTransport:class TestClassifierPathRegistryWalk:"""Every registered injected param × every real 400 shape must retry."""- def test_registry_is_never_empty(self):- assert REGISTRY_PARAMS, "injected-param registry must not be empty"-@pytest.mark.parametrize("param", REGISTRY_PARAMS)def test_classified_retryable_without_compression(self, param):"""#90257/#91164: injected-param 400 → retryable server_error,diff --git a/tests/agent/test_transcript_decoration_idempotence.py b/tests/agent/test_transcript_decoration_idempotence.pyindex 78f2d27d10e..a96f286ad85 100644--- a/tests/agent/test_transcript_decoration_idempotence.py+++ b/tests/agent/test_transcript_decoration_idempotence.py@@ -162,19 +162,6 @@ class TestDecorationIdempotenceLaw:f"{BUDGET}-breakpoint budget (the #90971 HTTP-400 class)")- @pytest.mark.parametrize("make", SHAPES)- def test_fixed_point_reached_after_one_pass(self, make):- """Convergence in one step: repeated application never drifts —- rounds 1..4 all serialize identically (stronger than pairwise)."""- forms = []- msgs = make()- for _ in range(4):- msgs = apply_anthropic_cache_control(- msgs, static_system_prefix="STATIC_PREFIX")- forms.append(_canon(msgs))- msgs = copy.deepcopy(json.loads(forms[-1]))- assert len(set(forms)) == 1, "decoration drifted across rounds"-def test_predecorated_input_does_not_inherit_extra_markers(self):"""#90971 core symptom: pre-decorated input must not carry stalemarkers PLUS fresh ones. Every marker in the output is one thediff --git a/tests/conformance/test_profile_write_tripwire.py b/tests/conformance/test_profile_write_tripwire.pyindex c9716b5f0e9..1b118e6c986 100644--- a/tests/conformance/test_profile_write_tripwire.py+++ b/tests/conformance/test_profile_write_tripwire.py@@ -257,52 +257,3 @@ def test_no_default_profile_writes(profile_tripwire, exercise):"""exercise(profile_tripwire)profile_tripwire.assert_default_untouched()---def test_session_db_file_lands_in_profile_home(profile_tripwire):- """The state.db written by an argless SessionDB() is PHYSICALLY the- testprof file — rows are readable from ``profiles/testprof/state.db``- and no root ``state.db`` exists at all (#88532's exact symptom).- """- db = hermes_state.SessionDB()- try:- db.create_session("20260823_111111_tripwire", "cli")- db.append_message("20260823_111111_tripwire", "user", "profile hello")- finally:- db.close()-- profile_db = profile_tripwire.profile / "state.db"- assert profile_db.exists()- conn = sqlite3.connect(str(profile_db))- try:- ids = {r[0] for r in conn.execute("SELECT id FROM sessions")}- finally:- conn.close()- assert "20260823_111111_tripwire" in ids-- assert not (profile_tripwire.root / "state.db").exists(), (- "#88532 regression: a state.db appeared in the DEFAULT profile home "- "while testprof was active"- )- profile_tripwire.assert_default_untouched()---def test_config_round_trips_through_profile_home(profile_tripwire):- """load_config() under testprof reads testprof's config, not the root's.-- #92662/#89190 shape: the base profile's config.yaml carried the default- model 'default-model'; a load under testprof must not see or mutate it.- """- from hermes_cli.config import load_config, save_config-- cfg = load_config()- cfg["model"] = "round-trip-model" # bare-string alias form is canonical- save_config(cfg)-- reread = load_config()- model = reread.get("model")- resolved = model if isinstance(model, str) else (model or {}).get("default")- assert resolved == "round-trip-model"- # The default profile's config still holds its own value.- assert "default-model" in (profile_tripwire.root / "config.yaml").read_text()- profile_tripwire.assert_default_untouched()diff --git a/tests/cron/test_cron_memory_contract.py b/tests/cron/test_cron_memory_contract.pyindex ddd2d4a5fa3..1e67e107388 100644--- a/tests/cron/test_cron_memory_contract.py+++ b/tests/cron/test_cron_memory_contract.py@@ -35,7 +35,10 @@ without that citation.Tests drive the REAL ``cron.scheduler.run_job`` path and capture the actualkwargs the scheduler passes to AIAgent (patched at ``run_agent.AIAgent``,-matching tests/cron/test_scheduler.py's pattern).+matching tests/cron/test_scheduler.py's pattern). The ON direction (default+skip_memory=False, memory not denylisted, per-job memory toolset kept) is+already pinned by tests/cron/test_scheduler.py::test_run_job_*memory*; this+module pins the OFF direction and the "no per-job knob" rule."""from __future__ import annotations@@ -62,10 +65,10 @@ def _run_job_patches(tmp_path):mock_agent.run_conversation.return_value = {"final_response": "ok"}base = [patch("cron.scheduler._hermes_home", tmp_path),- patch("cron.scheduler._resolve_origin", return_value=None),+ patch("cron.scheduler_delivery._resolve_origin", return_value=None),patch("hermes_cli.env_loader.load_hermes_dotenv"),patch("hermes_cli.env_loader.reset_secret_source_cache"),- patch("hermes_state.SessionDB", return_value=fake_db),+ patch("hermes_state_registry.acquire", return_value=fake_db),patch("hermes_cli.runtime_provider.resolve_runtime_provider",return_value={@@ -85,38 +88,6 @@ def _run_job_patches(tmp_path):class TestCronMemoryContractOn:"""Direction (a): default cron agents GET persistent memory (#91447)."""- def test_default_cron_agent_passes_skip_memory_false(self, tmp_path):- """The scheduler's AIAgent construction site passes skip_memory=False.-- This is the exact flag PR #91384 set to True and PR #91447 set back- to False. skip_memory=False means the built-in MEMORY.md/USER.md- store loads into the system prompt via agent_init's normal path.- """- job = {"id": "mem-contract-default", "name": "t", "prompt": "hi"}- with _run_job_patches(tmp_path) as (_db, agent_cls):- success, _out, _final, error = run_job(job)- assert success is True and error is None- kwargs = agent_cls.call_args.kwargs- assert kwargs["skip_memory"] is False, (- "Cron memory contract (#91447): cron agents load MEMORY.md/USER.md "- "like any other agent. If you are flipping this on purpose, edit "- "this module's docstring and cite the deciding issue/PR."- )-- def test_memory_toolset_not_policy_denied_by_default(self, tmp_path):- """PR #91447 removed 'memory' from the cron toolset denylist.-- PR #91384 had added it alongside messaging/clarify. It must not creep- back in silently.- """- job = {"id": "mem-contract-denylist", "name": "t", "prompt": "hi"}- with _run_job_patches(tmp_path) as (_db, agent_cls):- run_job(job)- kwargs = agent_cls.call_args.kwargs- assert "memory" not in (kwargs["disabled_toolsets"] or []), (- "'memory' must not be in cron's default denylist (#91447)"- )-def test_resolver_denylist_has_no_memory_entry(self):"""_resolve_cron_disabled_toolsets({}) itself never emits 'memory'."""from cron.scheduler import _resolve_cron_disabled_toolsets@@ -126,23 +97,6 @@ class TestCronMemoryContractOn:{"cron": {"allow_agent_scheduling": True}})- def test_per_job_memory_toolset_survives(self, tmp_path):- """A per-job enabled_toolsets naming memory keeps it (no stripping).-- PR #91384 introduced _strip_cron_memory_toolset; PR #91447 deleted it.- """- job = {- "id": "mem-contract-perjob",- "name": "t",- "prompt": "hi",- "enabled_toolsets": ["memory", "file"],- }- with _run_job_patches(tmp_path) as (_db, agent_cls):- run_job(job)- kwargs = agent_cls.call_args.kwargs- assert "memory" in (kwargs["enabled_toolsets"] or [])- assert kwargs["skip_memory"] is False-class TestCronMemoryContractOff:"""Direction (b): the supported OFF switch stays off."""@@ -189,20 +143,3 @@ class TestCronMemoryContractOff:run_job(job)kwargs = agent_cls.call_args.kwargsassert kwargs["skip_memory"] is False---class TestAgentInitOffPathStaysOff:- """agent_init side of the OFF direction (#65429 / #91447 wording).-- skip_memory=True with 'memory' merely present-by-default but denylisted- must NOT load the MEMORY.md store — a denylisted toolset is not a request.- """-- def test_denylisted_memory_toolset_is_not_a_request(self):- enabled = ["memory", "file"]- disabled = ["memory"]- requested = "memory" in enabled and "memory" not in disabled- # Mirrors agent_init's _memory_toolset_requested gate exactly; the- # deep store-construction behavior is covered by- # tests/agent/test_skip_memory_store_65429.py.- assert requested is Falsediff --git a/tests/hermes_cli/test_env_deprecation_truthtable.py b/tests/hermes_cli/test_env_deprecation_truthtable.pyindex f6f4eaa0507..6e550601c2d 100644--- a/tests/hermes_cli/test_env_deprecation_truthtable.py+++ b/tests/hermes_cli/test_env_deprecation_truthtable.py@@ -151,9 +151,8 @@ def test_deprecated_env_warning_truth_table(err = capsys.readouterr().errif warn_keys:- assert "Deprecated .env settings detected" in err+ assert err.strip(), "expected a deprecation warning on stderr"for key in warn_keys:- assert f"{key}=" in err, f"expected {key} in warning:\n{err}"- assert "config.yaml" in err # migration hint present+ assert key in err, f"expected {key} in warning:\n{err}"else:assert err == "", f"expected silence, got:\n{err}"diff --git a/tests/hermes_cli/test_update_receipt_truthfulness.py b/tests/hermes_cli/test_update_receipt_truthfulness.pyindex a8994b6d64b..129cb12a1c4 100644--- a/tests/hermes_cli/test_update_receipt_truthfulness.py+++ b/tests/hermes_cli/test_update_receipt_truthfulness.py@@ -198,8 +198,10 @@ class TestSuccessImpliesAccounting:plan = _plan_with_runtimes(_THREE_RUNTIMES)outcomes, incomplete, path = self._drive_decision(plan,- restarted_services=[],- relaunched_profiles=["work", "ops"],+ # Serve/dashboard runtimes are reconciled in their own unit+ # vocabulary and never borrow a gateway relaunch (#100479).+ restarted_services=["hermes-serve-ops.service"],+ relaunched_profiles=["work"],externally_supervised_profiles=[],killed_pids={101},failed_units=[],diff --git a/tests/hermes_state/test_state_db_maintenance_conformance.py b/tests/hermes_state/test_state_db_maintenance_conformance.pyindex 787a82b545a..fa326e8eab6 100644--- a/tests/hermes_state/test_state_db_maintenance_conformance.py+++ b/tests/hermes_state/test_state_db_maintenance_conformance.py@@ -4,7 +4,8 @@ Pins the bug CLASS behind #91839 (FTS rebuild corrupting a shared state.db),#90806 (WAL sidecars replaced under live holders), #90613 (_safe_copy_dbcopying a corrupt DB while reporting success) and #88235 (repair ran surgeryunder a live writer — repair-specific guard tests already exist in-tests/test_state_db_repair_live_writer_guard.py and are NOT duplicated here).+tests/hermes_state/test_state_db_repair_live_writer_guard.py and are NOT+duplicated here).Contract, in two sentences:@@ -12,13 +13,9 @@ Contract, in two sentences:unguarded against a database another live connection still holds — eachmust refuse loudly, degrade to a no-op, or coordinate safely, and thedatabase must be ``PRAGMA integrity_check == ok`` afterwards.-2. Any copy/snapshot path that reports success must leave an- integrity-clean destination; success + corrupt copy is the #90613 bug.--The REGISTRY below enumerates every known maintenance entry point. A-completeness test greps the source modules so a NEW maintenance function (or-a rename of an existing one) fails this suite loudly instead of silently-shipping without live-writer conformance coverage.+2. Any copy/snapshot path must fail closed on a source SQLite cannot read+ (no destination left behind, DB flagged in the snapshot manifest);+ success + unusable copy is the #90613 bug.All databases are real SQLite files under tmp_path (the production-DBisolation guard in hermes_state hard-fails on production-shaped paths — never@@ -28,8 +25,7 @@ mocks.from __future__ import annotations-import dataclasses-import re+import jsonimport sqlite3import threadingimport uuid@@ -37,101 +33,14 @@ from pathlib import Pathimport pytest-import hermes_state+import hermes_state_repairfrom hermes_state import SessionDB-from hermes_cli import backup as backup_modfrom hermes_cli.backup import (- _create_quick_snapshot_locked,_safe_copy_db,- copy_db_and_verify,+ create_quick_snapshot,verify_sqlite_integrity,)-REPO_ROOT = Path(hermes_state.__file__).resolve().parent--# ----------------------------------------------------------------------------# REGISTRY — every maintenance entry point doing structural work on state.db-# -----------------------------------------------------------------------------[email protected](frozen=True)-class MaintenanceOp:- """One maintenance entry point and where its live-writer safety lives."""-- module: str # import path holding the symbol- qualname: str # symbol ("func" or "Class.method")- kind: str # "in-place" | "copy" | "guard"- covered_by: str # which test (here or elsewhere) pins its conformance---REGISTRY: tuple[MaintenanceOp, ...] = (- # In-place structural ops (part 2 here, except repair — covered elsewhere)- MaintenanceOp("hermes_state", "SessionDB.vacuum", "in-place",- "test_in_place_op_refuses_or_degrades_under_live_writer"),- MaintenanceOp("hermes_state", "SessionDB.maybe_auto_prune_and_vacuum",- "in-place",- "test_in_place_op_refuses_or_degrades_under_live_writer"),- MaintenanceOp("hermes_state", "SessionDB.rebuild_fts", "in-place",- "test_in_place_op_refuses_or_degrades_under_live_writer"),- MaintenanceOp("hermes_state", "SessionDB.optimize_fts", "in-place",- "test_in_place_op_refuses_or_degrades_under_live_writer"),- MaintenanceOp("hermes_state", "repair_state_db_schema", "in-place",- "tests/test_state_db_repair_live_writer_guard.py"),- MaintenanceOp("hermes_state", "SessionDB._try_runtime_fts_rebuild",- "in-place", "tests/state/test_fts_runtime_rebuild.py"),- # The guards themselves — renaming one must break this suite (#88235,- # #90806: _foreign_state_db_holders is what stops sidecar replacement- # under a live holder).- MaintenanceOp("hermes_state", "_live_writer_holds_db", "guard",- "test_registry_symbols_exist"),- MaintenanceOp("hermes_state", "SessionDB._foreign_state_db_holders",- "guard", "test_registry_symbols_exist"),- MaintenanceOp("hermes_cli.backup", "verify_sqlite_integrity", "guard",- "test_copy_honesty_page_damage"),- # Copy/snapshot paths (part 3)- MaintenanceOp("hermes_cli.backup", "_safe_copy_db", "copy",- "test_copy_honesty_truncated_db"),- MaintenanceOp("hermes_cli.backup", "copy_db_and_verify", "copy",- "test_copy_honesty_page_damage"),- MaintenanceOp("hermes_cli.backup", "_create_quick_snapshot_locked",- "copy", "test_quick_snapshot_flags_corrupt_state_db"),-)--# Source files scanned for maintenance-shaped function definitions.-_SCAN_SOURCES = ("hermes_state.py", "hermes_state_search.py",- "hermes_cli/backup.py")--# def-names matching this pattern must be in the REGISTRY or the exempt list.-_MAINT_DEF_RE = re.compile(- r"^\s*def\s+(\w*(?:vacuum|rebuild_fts|repair_state|safe_copy|snapshot"- r"|checkpoint|optimize_fts|copy_db)\w*)\s*\(", re.M,-)--# Reviewed and deliberately outside the registry: read-only, orchestration-# wrappers around registered ops, or non-structural helpers.-_SCAN_EXEMPT = {- "_apply_macos_checkpoint_barrier", # per-connection pragma helper- "_try_wal_checkpoint", # best-effort on own conn, no surgery- "list_quick_snapshots", # read-only- "restore_quick_snapshot", # restore target, not live state.db- "_prune_quick_snapshots", # deletes snapshot dirs, not the DB- "prune_quick_snapshots", # public wrapper of the above- "_quick_snapshot_root", # path helper- "create_quick_snapshot", # lock wrapper -> registered _locked- "create_pre_update_snapshots_all_profiles", # loops create_quick_snapshot- "optimize_fts_storage", # offline rebuild w/ its own tests- "_repair_state_db_schema_locked", # inner half of registered repair-}---def _resolve(op: MaintenanceOp):- mod = {"hermes_state": hermes_state, "hermes_cli.backup": backup_mod}[op.module]- obj = mod- for part in op.qualname.split("."):- obj = getattr(obj, part)- return obj--# ---------------------------------------------------------------------------# Fixtures — real WAL-mode SessionDB in tmp dirs# ---------------------------------------------------------------------------@@ -216,110 +125,60 @@ class _LiveWriter:self.thread.join(timeout=30)-def _corrupt_page_damage(src: Path, dst: Path) -> None:- """Real corruption: XOR 512 bytes at the page boundary holding rows."""- data = bytearray(src.read_bytes())- idx = data.find(b"needle-10")- assert idx > 0, "fixture rows not found in raw db bytes"- page_start = (idx // 4096) * 4096- for off in range(page_start, page_start + 512):- data[off] ^= 0xFF- dst.write_bytes(bytes(data))--# ----------------------------------------------------------------------------# Part 1 — REGISTRY COMPLETENESS+# Part 1 — LIVE-WRITER GUARD (in-place ops)# -----------------------------------------------------------------------------def test_registry_symbols_exist():- """Every registered symbol must still resolve; renames break loudly.-- A silent rename would orphan the coverage below while the suite stayed- green — the exact failure mode that let #91839/#90806 regress guarded- paths.- """- for op in REGISTRY:- obj = _resolve(op)- assert callable(obj), f"{op.module}.{op.qualname} is not callable"+# In-place structural ops and the kwargs that make them attempt work now.+_IN_PLACE_OPS = {+ "vacuum": {},+ "maybe_auto_prune_and_vacuum": {"retention_days": 0, "min_interval_hours": 0},+ "rebuild_fts": {},+ "optimize_fts": {},+}-def test_source_scan_finds_no_unregistered_maintenance_ops():- """Grep the source modules for maintenance-shaped defs.+def _claims_no_work(result) -> bool:+ """A never-raise maintenance API degraded honestly: it reports zero work.- Any new function whose name matches the maintenance pattern must be- added to REGISTRY (with conformance coverage) or to _SCAN_EXEMPT (with a- reviewed justification). Either way the addition is a conscious act.+ ``int`` results count structures rewritten; the auto-maintenance dict+ must not say it vacuumed. Anything else is a claim of success under a+ live writer — the #91839 class."""- registered = {op.qualname.split(".")[-1] for op in REGISTRY}- found: set[str] = set()- for rel in _SCAN_SOURCES:- src = (REPO_ROOT / rel).read_text(encoding="utf-8", errors="replace")- found.update(_MAINT_DEF_RE.findall(src))- unregistered = found - registered - _SCAN_EXEMPT- assert not unregistered, (- "maintenance-shaped functions with no conformance coverage: "- f"{sorted(unregistered)} — add them to REGISTRY (and write a "- "live-writer/copy-honesty test) or to _SCAN_EXEMPT with a reason"- )- # And the scan itself must still see the registered names it pins,- # otherwise the regex has rotted into vacuity.- missing = {"vacuum", "rebuild_fts", "_safe_copy_db",- "repair_state_db_schema"} - found- assert not missing, f"source scan no longer sees {sorted(missing)}"---# ----------------------------------------------------------------------------# Part 2 — LIVE-WRITER GUARD (in-place ops)-# -----------------------------------------------------------------------------# op name -> callable(handle) -> outcome check. Each documented outcome is-# the op's refusal/degradation contract while a second connection holds a-# write transaction. "raises" pins loud refusal; dict/int outcomes pin the-# never-raise APIs degrading without touching the index/db structure.-_IN_PLACE_CASES = {- "SessionDB.vacuum": "raises-operational-error",- "SessionDB.maybe_auto_prune_and_vacuum": "returns-error-dict",- "SessionDB.rebuild_fts": "returns-zero",- "SessionDB.optimize_fts": "returns-zero",-}+ if isinstance(result, dict):+ return result.get("vacuumed") is False+ return result == 0@pytest.mark.requires_wal[email protected]("qualname", sorted(_IN_PLACE_CASES))-def test_in_place_op_refuses_or_degrades_under_live_writer(tmp_path, qualname):[email protected]("op_name", sorted(_IN_PLACE_OPS))+def test_in_place_op_refuses_or_degrades_under_live_writer(tmp_path, op_name):"""#91839/#88235 class: structural work must not proceed under a holder.With a real second connection holding BEGIN IMMEDIATE, each in-place- maintenance op must refuse or degrade per its documented contract, and- the database must be integrity-clean and row-identical afterwards.+ maintenance op must either refuse loudly (``sqlite3.OperationalError``+ naming the lock) or degrade to no work — never report success — and the+ database must be integrity-clean and row-identical afterwards."""db = _make_state_db(tmp_path)_require_wal(db)handle = SessionDB(db_path=db)try:with _LiveWriter(db):- outcome = _IN_PLACE_CASES[qualname]- method = getattr(handle, qualname.split(".")[1])- if outcome == "raises-operational-error":- with pytest.raises(sqlite3.OperationalError) as exc_info:- method()- msg = str(exc_info.value).lower()- assert "locked" in msg or "busy" in msg- elif outcome == "returns-error-dict":- result = method(retention_days=0, min_interval_hours=0)- assert result.get("vacuumed") is False, (- "auto-maintenance claims it vacuumed under a live writer"- )- assert result.get("error") or result.get("pruned") == 0- elif outcome == "returns-zero":- assert method() == 0, (- f"{qualname} claims it rewrote FTS structures while a "- "live writer held the database (#91839 class)"+ method = getattr(handle, op_name)+ try:+ result = method(**_IN_PLACE_OPS[op_name])+ except sqlite3.OperationalError as exc:+ msg = str(exc).lower()+ assert "locked" in msg or "busy" in msg, exc+ else:+ assert _claims_no_work(result), (+ f"{op_name} reported {result!r} while a live writer held "+ "the database (#91839 class: success claimed under a holder)")finally:handle.close()- assert _integrity_ok(db), f"{qualname} left state.db corrupt (#91839)"+ assert _integrity_ok(db), f"{op_name} left state.db corrupt (#91839)"# Canonical rows untouched.conn = sqlite3.connect(str(db))try:@@ -333,48 +192,20 @@ def test_live_writer_probe_detects_real_holder(tmp_path):"""The shared guard primitive must see a real holder (#88235, #90806)."""db = _make_state_db(tmp_path)_require_wal(db)- assert hermes_state._live_writer_holds_db(db) is False+ assert hermes_state_repair._live_writer_holds_db(db) is Falsewith _LiveWriter(db):- assert hermes_state._live_writer_holds_db(db) is True, (+ assert hermes_state_repair._live_writer_holds_db(db) is True, ("guard failed to detect a live write transaction — every ""registered op relying on it is now unguarded")- assert hermes_state._live_writer_holds_db(db) is False+ assert hermes_state_repair._live_writer_holds_db(db) is False# ----------------------------------------------------------------------------# Part 3 — COPY HONESTY (#90613)+# Part 2 — COPY HONESTY (#90613)# ----------------------------------------------------------------------------def test_copy_honesty_page_damage(tmp_path):- """#90613 pin: success + corrupt destination is forbidden.-- The merged fix layers verify_sqlite_integrity over the raw copier:- ``copy_db_and_verify`` must return False AND remove the destination when- the copy is not integrity-clean. The invariant asserted is the class:- never (returned True and destination invalid).- """- good = _make_state_db(tmp_path)- corrupt = tmp_path / "corrupt.db"- _corrupt_page_damage(good, corrupt)- assert not verify_sqlite_integrity(corrupt, run_pragma=True)["valid"], (- "fixture failed to actually corrupt the database"- )-- dst = tmp_path / "copy.db"- ok = copy_db_and_verify(corrupt, dst)- dst_valid = dst.exists() and verify_sqlite_integrity(- dst, run_pragma=True)["valid"]- assert not (ok and not dst_valid), (- "copy_db_and_verify returned success with a corrupt destination "- "(#90613: the exact silent-bad-backup bug)"- )- # Pin the merged fix's concrete behavior: refuse + clean up.- assert ok is False- assert not dst.exists(), "failed copy left a corrupt destination behind"--def test_copy_honesty_truncated_db(tmp_path):"""Truncation mid-page: even the raw copier must fail closed.@@ -392,12 +223,8 @@ def test_copy_honesty_truncated_db(tmp_path):assert _safe_copy_db(trunc, dst) is Falseassert not dst.exists(), "_safe_copy_db left a partial destination"- dst2 = tmp_path / "copy2.db"- assert copy_db_and_verify(trunc, dst2) is False- assert not dst2.exists()--def test_quick_snapshot_flags_corrupt_state_db(tmp_path, monkeypatch):+def test_quick_snapshot_flags_corrupt_state_db(tmp_path):"""The quick-snapshot path must flag — never silently absorb — a bad DB.A fake HERMES_HOME carries a truncated state.db plus a config.yaml. The@@ -412,12 +239,10 @@ def test_quick_snapshot_flags_corrupt_state_db(tmp_path, monkeypatch):raw = good.read_bytes()(home / "state.db").write_bytes(raw[: len(raw) - 4096 - 100])- snap_id = _create_quick_snapshot_locked(label="conformance",- hermes_home=home)+ snap_id = create_quick_snapshot(label="conformance", hermes_home=home)if snap_id is None:return # refused outright: honestsnap_dir = home / "state-snapshots" / snap_id- import jsonmeta = json.loads((snap_dir / "manifest.json").read_text())if "state.db" in meta.get("files", {}):copied = snap_dir / "state.db"diff --git a/tests/tools/test_bot_mode_canonical_chat_resolution.py b/tests/tools/test_bot_mode_canonical_chat_resolution.pyindex 67b4bc35b80..b81372aa911 100644--- a/tests/tools/test_bot_mode_canonical_chat_resolution.py+++ b/tests/tools/test_bot_mode_canonical_chat_resolution.py@@ -24,7 +24,7 @@ mint on ambiguity. Post-#92129 the contract is name-as-identity:What is pinned here is the Python layer the desktop relies on. The desktopclick/create flow itself (plugin.js), and group ROOM member-session lifecycle(#90005's original surface), live in Electron JS and are covered by-tests/canonical-chat-registry.test.mjs et al.; here we pin the DB/RPC algebra+apps/desktop/src/plugins/hermes-bots/canonical-chat-registry.test.ts; here we pin the DB/RPC algebrathose flows depend on, including a Python re-enactment of the #90005 and#92692 shapes at the registry layer."""@@ -252,14 +252,6 @@ def test_resolution_never_mints(home, state):assert _count_sessions(home) == before-def test_absent_registry_resolves_empty_not_minted(home):- """The #90705 shape exactly: null canonical → resolver must NOT mint."""- _state_empty(home)- assert _resolve() == []- assert _canonical_via_profiles() is None- assert _count_sessions(home) == 0--# ---------------------------------------------------------------------------# Property 3 — UNIQUENESS: at most one canonical row per profile, always# ---------------------------------------------------------------------------@@ -305,25 +297,6 @@ def _adopt_or_mint(home, sid, results, idx):db.close()[email protected]("seq", [- ["resolve", "resolve", "resolve"],- ["create", "resolve", "create", "resolve"],- ["resolve", "create", "resolve", "create", "resolve"],-])-def test_any_operation_sequence_leaves_at_most_one_canonical(home, seq):- """After ANY sequence of resolve/create ops: ≤1 canonical row (#92692)."""- _state_empty(home)- results = {}- for i, op in enumerate(seq):- if op == "resolve":- _resolve()- else:- _adopt_or_mint(home, f"mint-{i}", results, i)- assert len(_canonical_rows(home)) <= 1- creators = [v for k, v in results.items()]- assert len(set(creators)) <= 1 # every creator converged on one identity--def test_two_resolvers_racing_cold_profile_yield_one_canonical(home):"""#92692: two resolvers racing on a cold profile mint at most ONE chat.