test(conftest): strip HERMES_WEBUI_SKIP_ONBOARDING env globally; rfcs: note discussion-first for contributor RFCs

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).
This commit is contained in:
nesquena-hermes 2026-05-11 03:02:01 +00:00
parent 8c803c0a07
commit 0c26ab3425
2 changed files with 19 additions and 0 deletions

View file

@ -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

View file

@ -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.