From df85e9ea86ab44600ddeccf4ad2c1c4d20b7dbf6 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Tue, 25 Aug 2026 01:59:48 -0700 Subject: [PATCH] [eric] tests: the surface a test needs is public, not reached into Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_018foyDoK19jjbYdudfzQVkZ --- backend/apps/agents/manager/predict_followups.py | 4 ++-- backend/apps/swarm/entities/skills.py | 4 ++-- backend/tests/test_final_rung_bounded.py | 2 -- backend/tests/test_no_transcript_replay.py | 4 ++-- backend/tests/test_skill_export_prunes.py | 6 ++---- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/backend/apps/agents/manager/predict_followups.py b/backend/apps/agents/manager/predict_followups.py index 208dd9b2..4591d8ce 100644 --- a/backend/apps/agents/manager/predict_followups.py +++ b/backend/apps/agents/manager/predict_followups.py @@ -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) diff --git a/backend/apps/swarm/entities/skills.py b/backend/apps/swarm/entities/skills.py index 013bb9ae..8530d638 100644 --- a/backend/apps/swarm/entities/skills.py +++ b/backend/apps/swarm/entities/skills.py @@ -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` diff --git a/backend/tests/test_final_rung_bounded.py b/backend/tests/test_final_rung_bounded.py index 4bd42ac0..ab43a203 100644 --- a/backend/tests/test_final_rung_bounded.py +++ b/backend/tests/test_final_rung_bounded.py @@ -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 diff --git a/backend/tests/test_no_transcript_replay.py b/backend/tests/test_no_transcript_replay.py index 2ce55986..d8bf9bae 100644 --- a/backend/tests/test_no_transcript_replay.py +++ b/backend/tests/test_no_transcript_replay.py @@ -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" diff --git a/backend/tests/test_skill_export_prunes.py b/backend/tests/test_skill_export_prunes.py index e6499a16..57cc0423 100644 --- a/backend/tests/test_skill_export_prunes.py +++ b/backend/tests/test_skill_export_prunes.py @@ -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)