remove dev environment references from codebase
This commit is contained in:
1 parent
5747ad2fa6
commit
38cba33bbf
18 files changed
+327
-249
No files matched your search
+1
-1
@@ -4,7 +4,7 @@
|
||||
engine used ONLY by pure-stdlib unit tests of scheduling mechanics (pausing,
|
||||
resuming, routing, authoring). The real engine is the decision-maker in
|
||||
production and in the integration tests; this double exists so a mechanics test
|
||||
can drive the loop without loading a GGUF on the dev machine, exactly as a
|
||||
can drive the loop without loading a GGUF locally, exactly as a
|
||||
loopback HTTP server stands in for a live service elsewhere.
|
||||
|
||||
It is not a mock of SemIf scoring: it answers each `DecisionRequest` with a
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""End-to-end pipeline test. Run ONLY on the box with real SemIf + real LLM.
|
||||
"""End-to-end pipeline test. Run ONLY where real SemIf + a real LLM are available.
|
||||
|
||||
python -m pytest tests/integration -q
|
||||
|
||||
@@ -12,7 +12,7 @@ import time
|
||||
|
||||
import pytest
|
||||
|
||||
from semif_agent.cli import _opt_float, build_scheduler, load_config
|
||||
from semif_agent.cli import _opt_float, _required_model, build_scheduler, load_config
|
||||
from semif_agent.codegen import (
|
||||
CodegenClient,
|
||||
generate_skill_body,
|
||||
@@ -61,7 +61,7 @@ def require_real(config: dict):
|
||||
def _isolate_runtime(config: dict, tmp_path) -> None:
|
||||
"""Point every runtime artifact at tmp_path.
|
||||
|
||||
Without this, persisted authoring output in the box's `data/categories.json`
|
||||
Without this, persisted authoring output in the runtime `data/categories.json`
|
||||
and `data/skills/` leaks into the tree and navigation routes to a stale stub
|
||||
instead of the injected fixture — an environment-dependent failure.
|
||||
"""
|
||||
@@ -294,8 +294,8 @@ def test_generate_skill_body_codegen(tmp_path):
|
||||
|
||||
The body must perform the action via a stdlib transport and declare
|
||||
INTEGRATION; the test is a hermetic mechanics check (loopback for HTTP), not
|
||||
proof of the live integration. Slow: uses the big codegen model
|
||||
(qwen38-iq3s by default). Run this one in the background and poll —
|
||||
proof of the live integration. Slow: uses the configured codegen model.
|
||||
Run this one in the background and poll —
|
||||
long-lived ssh sessions get SIGHUP'd.
|
||||
"""
|
||||
config = load_config()
|
||||
@@ -303,7 +303,7 @@ def test_generate_skill_body_codegen(tmp_path):
|
||||
codegen_cfg = config.get("codegen", {})
|
||||
client = CodegenClient(
|
||||
base_url=codegen_cfg.get("base_url", "http://localhost:11434/v1"),
|
||||
model=codegen_cfg.get("model", "qwen38-iq3s"),
|
||||
model=_required_model(codegen_cfg, "codegen"),
|
||||
timeout=float(codegen_cfg.get("timeout", 1200.0)),
|
||||
stream=True,
|
||||
temperature=_opt_float(codegen_cfg.get("temperature")),
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
The scheduler is constructed with the lazy SemIfEngine (never loaded), so this
|
||||
runs anywhere without SemIf. Submit degrades to a JSON error, which is the
|
||||
expected behaviour on the thin dev box; relabel works against a seeded log.
|
||||
expected behaviour without an engine; relabel works against a seeded log.
|
||||
"""
|
||||
|
||||
import json
|
||||
@@ -223,7 +223,7 @@ def test_skill_writing_and_created_events_in_payload(tmp_path):
|
||||
category="tracking",
|
||||
skill="track_live",
|
||||
description="Follow a package in real time.",
|
||||
model="qwen38-iq3s",
|
||||
model="test-codegen",
|
||||
contract_ref="a1b2c3d",
|
||||
contract_dirty=True,
|
||||
)
|
||||
@@ -246,7 +246,7 @@ def test_skill_writing_and_created_events_in_payload(tmp_path):
|
||||
writing = next(e for e in run["events"] if e["kind"] == "skill_writing")
|
||||
assert writing["skill"] == "track_live"
|
||||
assert "real time" in writing["description"]
|
||||
assert writing["model"] == "qwen38-iq3s"
|
||||
assert writing["model"] == "test-codegen"
|
||||
assert writing["contract_ref"] == "a1b2c3d"
|
||||
assert writing["contract_dirty"] is True
|
||||
created = next(e for e in run["events"] if e["kind"] == "skill_created")
|
||||
|
||||
@@ -4,8 +4,8 @@ The gateway is the agent's command surface only. These tests exercise its own
|
||||
routing, authorization, and batching; parsing/accept/address live in
|
||||
`tests/test_simplex_ws.py`. The decision engine is never loaded and the LLM
|
||||
endpoint is unreachable, so scheduler calls degrade to errors — which is fine.
|
||||
The real `websockets` transport against a live `simplex-chat` daemon is a jarvis
|
||||
integration concern, not a dev-box unit test.
|
||||
The real `websockets` transport against a live `simplex-chat` daemon is a
|
||||
live-daemon integration concern, not a unit test.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
"""Guard: no deployment-specific artifacts in tracked files.
|
||||
|
||||
The repo is generic. Hostnames, addresses, usernames, absolute home paths, and
|
||||
the local model choices of any one deployment must not leak into tracked files —
|
||||
they belong in the gitignored ``local/`` folder (see ``local/ENVIRONMENT.md``).
|
||||
This test fails if a denylisted term reappears anywhere in the tree.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
# Generated/ignored trees and binary assets. ``local/`` is the intended home
|
||||
# for deployment specifics and is gitignored, so it is exempt.
|
||||
SKIP_DIRS = {".git", ".runtime", "local", "data", ".pytest_cache", "__pycache__"}
|
||||
SKIP_SUFFIXES = {
|
||||
".pyc", ".svg", ".png", ".jpg", ".jpeg", ".gif", ".ico",
|
||||
".woff", ".woff2", ".ttf", ".pdf", ".zip", ".gz",
|
||||
}
|
||||
SKIP_NAMES = {Path(__file__).name}
|
||||
# Fallback (non-git) walk: skip gitignored per-machine artifacts by name/pattern.
|
||||
SKIP_GLOBS = ("config.json", "*.bak.*", "*.log")
|
||||
|
||||
# label -> regex. Kept specific so a legitimate generic term is not flagged.
|
||||
DENYLIST = {
|
||||
"deployment hostname": r"jarvis|guppy",
|
||||
"operator username": r"\babby\b",
|
||||
"ssh key comment": r"shitass",
|
||||
"git owner": r"gabby",
|
||||
"git host": r"manyworlds",
|
||||
"lan address": r"192\.168\.8\.",
|
||||
"local codegen model": r"qwen38",
|
||||
"local llm model": r"qwen3\.5:4b",
|
||||
"stale llm default": r"qwen2\.5:3b",
|
||||
"absolute home path": r"/home/abby",
|
||||
"old venv path": r"semif-venv",
|
||||
"machine descriptor": r"\b(?:the box|dev box|dev machine|staging box)\b",
|
||||
}
|
||||
|
||||
|
||||
def _git_tracked_files() -> list[Path] | None:
|
||||
"""Tracked files from git (so gitignored per-machine files are exempt).
|
||||
|
||||
Returns ``None`` when git is unavailable or this is not a checkout, so the
|
||||
guard still works on an extracted tarball via the walk fallback.
|
||||
"""
|
||||
try:
|
||||
out = subprocess.run(
|
||||
["git", "-C", str(REPO_ROOT), "ls-files", "-z"],
|
||||
capture_output=True,
|
||||
check=True,
|
||||
).stdout
|
||||
except (OSError, subprocess.CalledProcessError):
|
||||
return None
|
||||
names = [n for n in out.decode("utf-8", "surrogateescape").split("\0") if n]
|
||||
return [REPO_ROOT / n for n in names]
|
||||
|
||||
|
||||
def _iter_tracked_text_files():
|
||||
"""Yield candidate files, pruning ignored trees and binary assets."""
|
||||
tracked = _git_tracked_files()
|
||||
if tracked is not None:
|
||||
candidates = tracked
|
||||
else:
|
||||
candidates = []
|
||||
for dirpath, dirnames, filenames in os.walk(REPO_ROOT):
|
||||
dirnames[:] = [d for d in dirnames if d not in SKIP_DIRS]
|
||||
for name in filenames:
|
||||
path = Path(dirpath) / name
|
||||
if any(path.match(g) for g in SKIP_GLOBS):
|
||||
continue
|
||||
candidates.append(path)
|
||||
for path in candidates:
|
||||
if path.name in SKIP_NAMES or path.suffix in SKIP_SUFFIXES:
|
||||
continue
|
||||
yield path
|
||||
|
||||
|
||||
def test_no_deployment_specific_artifacts():
|
||||
hits: list[str] = []
|
||||
for path in _iter_tracked_text_files():
|
||||
try:
|
||||
text = path.read_text(encoding="utf-8")
|
||||
except (UnicodeDecodeError, OSError):
|
||||
continue
|
||||
for label, pattern in DENYLIST.items():
|
||||
for match in re.finditer(pattern, text, re.IGNORECASE):
|
||||
line = text.count("\n", 0, match.start()) + 1
|
||||
hits.append(
|
||||
f"{path.relative_to(REPO_ROOT)}:{line}: {label} "
|
||||
f"-> {match.group(0)!r}"
|
||||
)
|
||||
assert not hits, "deployment-specific artifacts in tracked files:\n" + "\n".join(
|
||||
hits
|
||||
)
|
||||
@@ -3,7 +3,7 @@
|
||||
`semif_agent.simplex_ws` is shared by the command gateway and the forwarding
|
||||
bridge, so its parsing/accept/address behavior is tested here, independent of
|
||||
either front end. The real `websockets` transport against a live daemon is a
|
||||
jarvis integration concern.
|
||||
live-daemon integration concern.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
|
||||
@@ -4,7 +4,7 @@ path when the engine is unavailable.
|
||||
|
||||
No mocking: the async write test uses a real CodegenClient against a throwaway
|
||||
stdlib HTTP server (real endpoint, per the repo rule); engine-dependent success
|
||||
paths are exercised only by the box integration tests against the real decision
|
||||
paths are exercised only by the integration tests against the real decision
|
||||
model.
|
||||
"""
|
||||
|
||||
|
||||
Reference in new issue
Block a user