Keep composers usable, group actions and notifications, and drop the tool-count cap
DevPlace CI / test (push) Failing after 3h10m39s

Comment and post layouts stay full width on small screens. Secondary actions live in the More menu. Notifications can be grouped and throttled, and Enter can submit when that profile setting is on. Emulated-tool models accept large catalogs, with reserved names aliased on the wire and the catalog cached per owner. A dropped service-worker navigation is retried once. The test server waits 120s to finish importing before it is stopped.
This commit is contained in:
2026-11-12 15:29:27 +01:00
parent dbdd0d29dd
commit 8a48e3ef85
103 changed files with 2680 additions and 378 deletions
@@ -110,15 +110,81 @@ def test_history_roundtrips_into_the_same_format_the_model_emits():
assert '"name": "bash"' in results and "a.txt" in results
def test_caps_reject_loudly():
with pytest.raises(te.ToolEmulationError):
te.emulate_request(_payload(tools=[BASH] * (te.MAX_TOOLS + 1)))
huge = json.loads(json.dumps(BASH))
huge["function"]["description"] = "x" * (te.MAX_CATALOG_CHARS + 1)
with pytest.raises(te.ToolEmulationError):
te.emulate_request(_payload(tools=[huge]))
def _many_tools(count):
return [
{
"type": "function",
"function": {
"name": f"tool_{index}",
"description": f"tool number {index}",
"parameters": {"type": "object", "properties": {}, "required": []},
},
}
for index in range(count)
]
def test_large_catalogs_are_served_with_no_cap():
out = te.emulate_request(_payload(tools=_many_tools(424)))
system = out["messages"][0]["content"]
assert '"name": "tool_0"' in system
assert '"name": "tool_423"' in system
assert "tools" not in out and "tool_choice" not in out
def test_malformed_tools_still_reject_loudly():
with pytest.raises(te.ToolEmulationError):
te.emulate_request(_payload(tools=[{"type": "retrieval"}]))
with pytest.raises(te.ToolEmulationError):
te.emulate_request(_payload(tools=[{"type": "function", "function": {}}]))
with pytest.raises(te.ToolEmulationError):
te.emulate_request(_payload(tools="bash"))
with pytest.raises(te.ToolEmulationError):
te.cached_emulated_tools(_payload(tools="bash"))
def test_catalog_cache_reuses_the_built_instruction_per_owner():
cache = te.CatalogCache()
owner = ("user", "uid-1")
first = te.emulate_request(_payload(tools=_many_tools(424)), cache, owner)
assert len(cache._entries) == 1
second = te.emulate_request(_payload(tools=_many_tools(424)), cache, owner)
assert len(cache._entries) == 1
assert second["messages"][0]["content"] == first["messages"][0]["content"]
emulated = te.cached_emulated_tools(_payload(tools=_many_tools(424)), cache, owner)
assert emulated is not None and len(emulated[0]) == 424
def test_catalog_cache_is_namespaced_per_owner_and_toolset():
cache = te.CatalogCache()
payload = _payload(tools=_many_tools(10))
te.emulate_request(payload, cache, ("user", "uid-1"))
te.emulate_request(payload, cache, ("user", "uid-2"))
assert len(cache._entries) == 2
assert cache.lookup(payload, ("user", "uid-3")) is None
changed = _payload(tools=_many_tools(11))
assert cache.lookup(changed, ("user", "uid-1")) is None
renamed_choice = _payload(tools=_many_tools(10), tool_choice="required")
assert cache.lookup(renamed_choice, ("user", "uid-1")) is None
def test_catalog_cache_evicts_oldest_first_within_bounds():
cache = te.CatalogCache()
cache.MAX_ENTRIES = 3
for index in range(5):
te.emulate_request(
_payload(tools=_many_tools(index + 1)), cache, ("user", "uid-1")
)
assert len(cache._entries) == 3
assert cache.lookup(_payload(tools=_many_tools(1)), ("user", "uid-1")) is None
assert cache.lookup(_payload(tools=_many_tools(5)), ("user", "uid-1")) is not None
def test_catalog_cache_never_caches_a_shape_error():
cache = te.CatalogCache()
with pytest.raises(te.ToolEmulationError):
te.emulate_request(_payload(tools=[{"type": "retrieval"}]), cache, ("user", "uid-1"))
assert len(cache._entries) == 0
def test_existing_stop_sequences_are_kept_and_capped():