Skip to content

The agent that grows with you

test(sessions): trim the repair-profiles title-clash tests to two invariants

teknium1b9616fe1d198
diff --git a/tests/hermes_cli/test_sessions_repair_profiles.py b/tests/hermes_cli/test_sessions_repair_profiles.py
index d3202c2ef2a..b33eccbabf4 100644
--- a/tests/hermes_cli/test_sessions_repair_profiles.py
+++ b/tests/hermes_cli/test_sessions_repair_profiles.py
@@ -236,12 +236,12 @@ def test_legacy_main_rekey_adopts_a_standalone_gateways_history(homes, monkeypat
assert not any(f["kind"] == "legacy_main" for f in _report()["findings"])
[email protected]("colliding", ["first", "second"])
[email protected]("title", ["Grocery list", "G" * SessionDB.MAX_TITLE_LENGTH])
-def test_move_into_a_store_that_already_holds_the_title(homes, monkeypatch, colliding, title):
+def test_move_into_a_store_that_already_holds_the_title(homes, monkeypatch):
"""Titles are unique per store only. A stranded row whose title an unrelated session of the
target profile already holds used to raise on the unique-title index, fail every row of the
- batch, and leave the rows copied before it in both stores, on every run."""
+ batch, and leave the rows copied before it in both stores, on every run. The clash is the
+ FIRST row of the batch and its title is at the length cap, so the suffix must still fit."""
+ title = "G" * SessionDB.MAX_TITLE_LENGTH
monkeypatch.setattr("hermes_cli.sessions_cmd_repair_profiles.default_snapshot", lambda store: "snap")
root = SessionDB(homes["default"] / "state.db")
acme = SessionDB(homes["acme"] / "state.db")
@@ -249,7 +249,7 @@ def test_move_into_a_store_that_already_holds_the_title(homes, monkeypatch, coll
_session(root, "s-a", "agent:acme:telegram:dm:210", profile="acme")
_session(root, "s-b", "agent:acme:telegram:dm:211", profile="acme", messages=3)
_session(acme, "w-1", ACME_KEY, profile="acme")
- clash, other = ("s-a", "s-b") if colliding == "first" else ("s-b", "s-a")
+ clash, other = "s-a", "s-b"
root.set_session_title(clash, title)
root.set_session_title(other, "Weekend plans")
acme.set_session_title("w-1", title)
@@ -276,11 +276,11 @@ def test_move_into_a_store_that_already_holds_the_title(homes, monkeypatch, coll
assert not any(f["kind"] == "wrong_store" for f in _report()["findings"])
[email protected]("stage", ["import", "delete"])
-def test_a_failing_row_moves_alone_and_its_lineage_waits_with_it(homes, monkeypatch, capsys, stage):
+def test_a_failing_row_moves_alone_and_its_lineage_waits_with_it(homes, monkeypatch, capsys):
"""One row that cannot move is that row's failure: an unrelated row of the same batch still
moves, the batch is not re-run per finding, and the failed row's lineage stays linked so the
- next run moves it whole."""
+ next run moves it whole. The failure is at import (the shape a unique-index clash takes)."""
+ stage = "import"
monkeypatch.setattr("hermes_cli.sessions_cmd_repair_profiles.default_snapshot", lambda store: "snap")
root = SessionDB(homes["default"] / "state.db")
try: