mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-02 14:28:59 +02:00
[eric] tests: the surface a test needs is public, not reached into
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018foyDoK19jjbYdudfzQVkZ
This commit is contained in:
co-authored by
Claude Opus 5
parent
164956965e
commit
df85e9ea86
@@ -26,7 +26,7 @@ P_PER_MESSAGE_CAP = 700
|
||||
# user's own lane (a Claude subscription for most people), and up to 12 turns of verbatim
|
||||
# `User:/Assistant:` was the exact shape ENG-358 removed from the recap, spent here on suggestion
|
||||
# chips. Whether the filter keys on it is unknown; the trade is not, so it costs a gist (ENG-396).
|
||||
P_MODEL_TEXT_CAP = 200
|
||||
MODEL_TEXT_CAP = 200
|
||||
|
||||
|
||||
@typechecked
|
||||
@@ -49,7 +49,7 @@ def conversation_tail(session: AgentSession) -> str:
|
||||
lines.append(f"They asked: {text[:P_PER_MESSAGE_CAP]}"
|
||||
+ ("..." if len(text) > P_PER_MESSAGE_CAP else ""))
|
||||
else:
|
||||
gist = text[:P_MODEL_TEXT_CAP] + ("..." if len(text) > P_MODEL_TEXT_CAP else "")
|
||||
gist = text[:MODEL_TEXT_CAP] + ("..." if len(text) > MODEL_TEXT_CAP else "")
|
||||
lines.append(f"They were answered, in gist: {gist}")
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class SkillExportable:
|
||||
}
|
||||
files: dict[str, bytes] = {}
|
||||
if kind == "folder":
|
||||
files = p_read_supporting_files(os.path.join(store.SKILLS_DIR, local_id))
|
||||
files = read_supporting_files(os.path.join(store.SKILLS_DIR, local_id))
|
||||
return cls(local_id, name, payload, files)
|
||||
|
||||
def serialize(self, ctx: ExportContext) -> dict:
|
||||
@@ -96,7 +96,7 @@ class SkillExportable:
|
||||
store.save_index(index)
|
||||
|
||||
|
||||
def p_read_supporting_files(skill_dir: str) -> dict[str, bytes]:
|
||||
def read_supporting_files(skill_dir: str) -> dict[str, bytes]:
|
||||
"""Every file in a skill folder except SKILL.md, as {relpath: bytes}.
|
||||
|
||||
Prunes the same build/venv dirs the app exporter has always pruned. This walker bound `dirs`
|
||||
|
||||
@@ -9,8 +9,6 @@ These pin that the last rung is bounded BY CONSTRUCTION, and that the bound can
|
||||
policy ratchet back open.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
|
||||
from backend.apps.agents.core.models import AgentSession, Message
|
||||
from backend.apps.agents.manager.run import empty_finish as ef
|
||||
from backend.apps.agents.manager.run.RunOptions import effective_prefix_mode, PREFIX_NARROWNESS
|
||||
|
||||
@@ -93,7 +93,7 @@ def test_an_empty_run_renders_empty_not_a_frame():
|
||||
|
||||
def test_the_aux_conversation_tail_gists_model_text_and_keeps_the_user_verbatim():
|
||||
# Shared by predict_followups AND memory distillation, both aux calls on the user's own lane.
|
||||
from backend.apps.agents.manager.predict_followups import conversation_tail, P_MODEL_TEXT_CAP
|
||||
from backend.apps.agents.manager.predict_followups import conversation_tail, MODEL_TEXT_CAP
|
||||
|
||||
class P_Sess:
|
||||
pass
|
||||
@@ -110,4 +110,4 @@ def test_the_aux_conversation_tail_gists_model_text_and_keeps_the_user_verbatim(
|
||||
mod.get_branch_messages = orig
|
||||
assert not ROLE_REPLAY.search(tail), f"role-tagged replay in the aux tail:\n{tail}"
|
||||
assert "how do I deploy this" in tail, "the user's own words are what we predict from"
|
||||
assert "z" * (P_MODEL_TEXT_CAP + 50) not in tail, "model prose must arrive gisted, not whole"
|
||||
assert "z" * (MODEL_TEXT_CAP + 50) not in tail, "model prose must arrive gisted, not whole"
|
||||
|
||||
@@ -6,9 +6,7 @@ bound `dirs` and never pruned it, so it swept a python3.13 tree with absolute pa
|
||||
on any other machine, into the bundle. The app exporter has always pruned the same set.
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from backend.apps.swarm.entities.skills import p_read_supporting_files
|
||||
from backend.apps.swarm.entities.skills import read_supporting_files
|
||||
from backend.apps.outputs.workspace_io import WALK_SKIP_DIRS
|
||||
|
||||
|
||||
@@ -21,7 +19,7 @@ def test_a_venv_never_reaches_the_bundle(tmp_path):
|
||||
(skill / "helper.py").write_text("real content")
|
||||
(skill / "SKILL.md").write_text("# skill")
|
||||
|
||||
out = p_read_supporting_files(str(skill))
|
||||
out = read_supporting_files(str(skill))
|
||||
assert "helper.py" in out, "real supporting files must still ship"
|
||||
assert not any(".venv" in k for k in out), f"venv leaked: {list(out)}"
|
||||
assert not any("node_modules" in k for k in out)
|
||||
|
||||
Reference in New Issue
Block a user