diff --git a/AGENTS.md b/AGENTS.md index 18fab1d..48ae9e3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -107,8 +107,9 @@ Each of these breaks the live bots or leaks the captain's data. Do the safe thin "check the baseline". A failed test leaves `artifacts/e2e/fallo-.md` (the error, the last WhatsApp messages and model turns, the gateway log): read it before rerunning anything. Skip it for small changes (copy, `SOUL.md`, `config.toml`, about 50 lines). For a behavior change, run it once at the end, and never rerun it for a one-line fix. The captain - asked for this 12 times, so `tests/conftest.py` enforces it: it refuses a run with no change against `main`, a - rerun with nothing changed, and a rerun after 3 changed lines or fewer. Only the captain overrides it, with + asked for this 12 times, so `tests/conftest.py` enforces it: it refuses a run with no change against `main`, one whose + changes are all files the E2E never reads (guides, `.md` outside `hermes/`, images, `.claude/`, `scripts/`), a + rerun with nothing changed, and a rerun after 3 changed lines or fewer. When it refuses, do not work around it. Only the captain overrides it, with `E2E_FORCE="" uv run pytest`. `docs/guia/contribuir.md` is for outside contributors. - No unit tests and no extra review rounds. - "Improve the project" means features the student notices, not refactors. diff --git a/tests/conftest.py b/tests/conftest.py index b76b85f..431c6f1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -18,6 +18,10 @@ LAST_RUN = REPO / "artifacts" / ".e2e-last-run" # changed lines since the last run that still count as a one-line fix SMALL_FIX = 3 +# what the E2E never reads: a change only here has nothing for it to check. hermes/*.md stays out (the fake model +# tells the bots apart by their SOUL.md), and so do docs/'s webviews, which it opens in Chromium. +UNREAD_DIRS = (".claude/", ".github/", "scripts/", "experiments/", "docs/guia/", "docs/images/") +UNREAD_SUFFIXES = (".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg", ".mp4", ".webm") def _controller(config) -> bool: @@ -45,8 +49,15 @@ def _changed_lines(old: str, new: str) -> int: return sum(100 if added == "-" else int(added) + int(deleted) for added, deleted, _ in rows) +def _e2e_reads(path: str) -> bool: + if path.startswith(UNREAD_DIRS) or path.lower().endswith(UNREAD_SUFFIXES): + return False + return not (path.endswith(".md") and not path.startswith(("hermes/", "tests/"))) + + def _guard_e2e_run() -> None: - """AGENTS.md's E2E rule, enforced: no baseline run, no rerun without a change, none for a one-line fix.""" + """AGENTS.md's E2E rule, enforced: no baseline run, none for docs only, no rerun without a change, none for a + one-line fix.""" if os.environ.get("E2E_FORCE", "").strip(): return try: @@ -57,6 +68,9 @@ def _guard_e2e_run() -> None: refusal = None if not _changed_lines(base, tree): refusal = "esta copia no cambia nada frente a main. No lo corras al empezar ni para ver la línea base." + elif not any(_e2e_reads(path) for path in _git("diff", "--name-only", base, tree).splitlines()): + refusal = ("esta rama solo cambia docs, guías o imágenes, que el E2E no lee. Abre el PR; lo que cambie en los " + "bots se prueba con vinci-check.") elif LAST_RUN.exists(): try: since = _changed_lines(LAST_RUN.read_text().strip(), tree)