Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdd7686638 | ||
|
|
0beaac2133 |
@@ -26,10 +26,10 @@ from aipass.memory.apps.handlers.json import json_handler
|
||||
|
||||
DEFAULT_CONFIG: Dict[str, Any] = {
|
||||
"enabled": True,
|
||||
"threshold": 0.3,
|
||||
"max_surfaces_per_session": 5,
|
||||
"min_messages_between": 10,
|
||||
"cooldown_seconds": 300,
|
||||
"threshold": 0.25,
|
||||
"max_surfaces_per_session": 12,
|
||||
"min_messages_between": 1,
|
||||
"cooldown_seconds": 30,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -142,20 +142,23 @@ class TestShouldSurfaceHappy:
|
||||
|
||||
def test_first_surface_ignores_spacing(self):
|
||||
"""Fresh session: first prompt with high relevance surfaces immediately."""
|
||||
# Explicit config: this exercises the spacing mechanism, so it must not
|
||||
# move whenever DEFAULT_CONFIG is retuned.
|
||||
cfg = {"min_messages_between": 10, "cooldown_seconds": 300}
|
||||
state = new_state()
|
||||
state["messages_since_last"] = 1
|
||||
ok, reason, updated = should_surface("compass-1", 0.8, state, current_time=100.0)
|
||||
ok, reason, updated = should_surface("compass-1", 0.8, state, cfg, current_time=100.0)
|
||||
assert ok is True
|
||||
assert "ready" in reason.lower()
|
||||
|
||||
for i in range(9):
|
||||
updated = record_message(updated)
|
||||
ok, reason, _ = should_surface("compass-2", 0.8, updated, current_time=100.0 + 400 + i)
|
||||
ok, reason, _ = should_surface("compass-2", 0.8, updated, cfg, current_time=100.0 + 400 + i)
|
||||
assert ok is False
|
||||
assert "spacing" in reason.lower()
|
||||
|
||||
updated = record_message(updated)
|
||||
ok, _, _ = should_surface("compass-2", 0.8, updated, current_time=600.0)
|
||||
ok, _, _ = should_surface("compass-2", 0.8, updated, cfg, current_time=600.0)
|
||||
assert ok is True
|
||||
|
||||
|
||||
@@ -246,7 +249,7 @@ class TestConfigMerging:
|
||||
assert "threshold" in reason.lower()
|
||||
|
||||
def test_default_config_values_match(self):
|
||||
assert DEFAULT_CONFIG["threshold"] == 0.3
|
||||
assert DEFAULT_CONFIG["max_surfaces_per_session"] == 5
|
||||
assert DEFAULT_CONFIG["min_messages_between"] == 10
|
||||
assert DEFAULT_CONFIG["cooldown_seconds"] == 300
|
||||
assert DEFAULT_CONFIG["threshold"] == 0.25
|
||||
assert DEFAULT_CONFIG["max_surfaces_per_session"] == 12
|
||||
assert DEFAULT_CONFIG["min_messages_between"] == 1
|
||||
assert DEFAULT_CONFIG["cooldown_seconds"] == 30
|
||||
|
||||
Reference in New Issue
Block a user