Files
odysseus/tests/smoke/test_memory_smoke.py
T
Léo 12f74ec9ea test(smoke): add a release smoke suite over every advertised feature area
The decomposition lanes have two safety nets and neither covers the
product. The checkpoint benchmark measures the agent runtime; the
computed-style snapshot pins the CSS. Nothing checked that Notes,
Calendar, Documents, Email, Memory, Cookbook or Settings still worked
after a route package moved or a 17,000-line module was split - and the
unit suite does not, since a byte-identical file move can break tests
that pass on the base branch with CI green throughout. The 28 Playwright
specs we do have are all under tests/e2e/photo-editor/ and no workflow
runs them.

scripts/odysseus-smoke boots this worktree through `odysseus dev` and
runs tests/smoke/: one scenario per area, each asserting a user-visible
outcome rather than a status code. Models come from a deterministic
OpenAI-compatible stub on an ephemeral loopback port; email reuses the
existing ODYSSEUS_EMAIL_FIXTURE path rather than inventing a second
mechanism. No scenario touches a live endpoint or the network.

The report is a per-area table that prints the areas the suite does not
cover next to the ones it does, and builds its rows from the registry
rather than from what happened to run, so an area cannot go missing by
having its module deleted or renamed. Under a plain pytest with nothing
booted every scenario skips with the reason, so the full suite stays
green.
2026-09-30 12:12:58 +02:00

41 lines
1.6 KiB
Python

"""Memory: a stored fact is listed, found by search, and gone after delete.
Keyword mode is enough here on purpose. The memory store degrades to
keyword matching when no vector service answers, and that degraded path
is the one a clean checkout actually runs, so it is the one worth
smoking.
"""
from __future__ import annotations
MEMORY_PATH = "/api/memory"
ADD_PATH = "/api/memory/add"
SEARCH_PATH = "/api/memory/search"
# A token that cannot collide with a real memory on a scratch instance.
TOKEN = "odysseus-smoke-marker-quintile"
TEXT = f"The release smoke suite stored the token {TOKEN} as a fact."
def test_a_memory_round_trips(client):
created = client.post(ADD_PATH, json={"text": TEXT, "category": "fact"})
assert created.status_code == 200, created.text
assert created.json().get("ok") is True, created.text
listed = client.get(MEMORY_PATH)
assert listed.status_code == 200, listed.text
matching = [m for m in listed.json().get("memory") or [] if TOKEN in str(m.get("text"))]
assert matching, [m.get("text") for m in listed.json().get("memory") or []]
memory_id = matching[0]["id"]
try:
found = client.post(SEARCH_PATH, data={"query": TOKEN})
assert found.status_code == 200, found.text
hits = [m for m in found.json().get("memories") or [] if TOKEN in str(m.get("text"))]
assert hits, found.text
finally:
removed = client.delete(f"{MEMORY_PATH}/{memory_id}")
assert removed.status_code == 200, removed.text
remaining = client.get(MEMORY_PATH).json().get("memory") or []
assert memory_id not in [m.get("id") for m in remaining]