From 0c26ab3425bedc7f99af2225604610281ab77d80 Mon Sep 17 00:00:00 2001 From: nesquena-hermes Date: Mon, 11 May 2026 03:02:01 +0000 Subject: [PATCH] test(conftest): strip HERMES_WEBUI_SKIP_ONBOARDING env globally; rfcs: note discussion-first for contributor RFCs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two follow-ups from Opus pre-release review of stage-336: 1. tests/conftest.py — autouse session fixture that removes HERMES_WEBUI_SKIP_ONBOARDING from os.environ for the whole pytest run, and restores it after. Hosting providers and isolated harnesses set this var to short-circuit the onboarding wizard, but it leaked into pytest and caused tests that exercise apply_onboarding_setup() to fail with cryptic FileNotFoundError. Tests that specifically validate the short-circuit behavior can opt back in with monkeypatch.setenv. Surgical per-test delenv calls remain as defense-in-depth but are now redundant. 2. docs/rfcs/README.md — one-line note that first-time contributor RFCs should be discussed in an issue before opening a PR. Gates drive-by design-doc PRs without us having to decline them on contribution. Verified: 96 onboarding-related tests pass with HERMES_WEBUI_SKIP_ONBOARDING=1 exported in the test runner env (would have failed before this fixture). --- docs/rfcs/README.md | 1 + tests/conftest.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/docs/rfcs/README.md b/docs/rfcs/README.md index d86c5ed9..9f40371a 100644 --- a/docs/rfcs/README.md +++ b/docs/rfcs/README.md @@ -28,6 +28,7 @@ cutting infrastructure. - A reviewer asks for one during code review. When in doubt, just ship the code — small features don't need RFCs. +First-time contributor RFCs should be discussed in an issue before opening a PR. ## Current RFCs diff --git a/tests/conftest.py b/tests/conftest.py index f8b6eca5..3b9c444d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -152,6 +152,24 @@ def pytest_configure(config): config.addinivalue_line("markers", "requires_agent: skip when hermes-agent dir is not found") config.addinivalue_line("markers", "requires_agent_modules: skip when hermes-agent Python modules are not importable") + +# ── Environment isolation for tests ──────────────────────────────────────── +# HERMES_WEBUI_SKIP_ONBOARDING is set by hosting providers (e.g. Agent37) and +# by some isolated test harnesses to short-circuit the onboarding wizard. +# When it leaks into the pytest environment, tests that exercise the wizard +# code paths (apply_onboarding_setup, etc.) fail because the function returns +# early without writing config files. +# +# This autouse fixture removes the variable for the test session. Tests that +# specifically need to validate the SKIP_ONBOARDING short-circuit can opt back +# in with `monkeypatch.setenv("HERMES_WEBUI_SKIP_ONBOARDING", "1")`. +@pytest.fixture(autouse=True, scope="session") +def _strip_skip_onboarding_env(): + prior = os.environ.pop("HERMES_WEBUI_SKIP_ONBOARDING", None) + yield + if prior is not None: + os.environ["HERMES_WEBUI_SKIP_ONBOARDING"] = prior + def pytest_collection_modifyitems(config, items): """Auto-skip agent-dependent tests when hermes-agent is not available.