emrg: test: harden stop_all hermeticity guard to all five killers (rant 2026-08-25T10:42:47) - #971
Conversation
…nt 2026-08-25T10:42:47)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle
Fresh review of the stop_all hermeticity fix (rant 2026-08-25T10:42:47):
tests/conftest.py: autouse guard now replaces ALL FIVE stop killers (stop_daemon/stop_gui/stop_tui/stop_bundled_git/stop_lock_owners) with raisers — matches the Windows 5-step_step_plan; any un-isolated real stop path fails loudly with AssertionError. Theallow_real_stopmarker opts out per function only for verified-hermetic direct calls.tests/test_stop_all.py:770: the flawed Windows-branch test now isolates all 5 killers (mirrorstest_stop_all_retries_lock_kill), closing the hole wherestop_gui/stop_tui/stop_bundled_git/stop_lock_ownersran for real.- Escape hatch applied only to the 2 safe direct-call sites (
test_posix_noopwithis_win=False+_lock_owner_psmocked;test_stop_lock_owners_logs_diagwith both killers mocked). - Canary
TestStopAllHermeticityGuardparametrized over all 5 functions (identity check only, never calls a stop path). - Marker registered in
[tool.pytest.ini_options]; Agent.md count 1052→1056 syncs the #511 doc guard.
CI double-green (run 32803059504: test + test-windows both pass). Local verification: 1055 passed / 1 skipped, import + CLI OK. Production code untouched — the fix is purely test-side. No issues found.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (2/3)
Head unchanged (06e79a0), CI double-green (run 32803059504: test + test-windows both pass), MERGEABLE. Re-verified the diff from cycle 105902: conftest guard replaces all five stop killers with raisers (matches Windows 5-step _step_plan), allow_real_stop escape hatch applied only to the two verified-hermetic direct-call sites, test_stop_all.py:770 now isolates all five (mirrors retries_lock_kill), 5-way parametrized canary, marker registered in pyproject, Agent.md count 1052→1056 syncs the #511 doc guard. No issues found.
…re/test-stop-all-hermeticity — resolve Agent.md pytest count 1056+2 → 1058
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (3/3)
Head unchanged since the last review (6cebd41, includes the master-merge conflict resolution — Agent.md pytest count merged to 1058), CI double-green (run 32804511105: test + test-windows both pass), MERGEABLE/CLEAN. Full diff reviewed across cycles 105902/111222: conftest guard on all five stop killers, allow_real_stop escape hatch, test_stop_all.py:770 full isolation, 5-way canary, doc-count synced. No issues found — merging.
Uh oh!
There was an error while loading. Please reload this page.
Summary
Closes the ⛔ red-line test hole reported in rant 2026-08-25T10:42:47: on a Windows
pytestrun,tests/test_stop_all.py::test_stop_all_process_residual_still_abortsmockedis_win → Truebut only isolatedstop_daemon— sostop_gui,stop_tui,stop_bundled_gitandstop_lock_ownersexecuted for real, killing the live EMRG GUI/TUI (and their process scans) on the host.Changes
tests/conftest.py— the autouse red-line guard_guard_stop_all_hermeticity(renamed from_guard_stop_daemon_hermeticity) now replaces all five stop killers (stop_daemon,stop_gui,stop_tui,stop_bundled_git,stop_lock_owners) with raisers, so any test that reaches a real stop path fails loudly withAssertionErrorinstead of killing processes. Existing isolation pattern (monkeypatch.setattr(_stop_all, "stop_x", lambda: None)) still overrides it as before.Escape hatch — a new
@pytest.mark.allow_real_stop("stop_lock_owners")marker opts a test out per function when it deliberately calls a stop function with its internal kill machinery already isolated. Applied to the two verified-hermetic direct-call sites:test_posix_noop(is_win=False→ early noop;_lock_owner_psmocked)test_stop_lock_owners_logs_diag(find_install_module_holders → []+_lock_owner_psmocked)Marker registered in
pyproject.toml([tool.pytest.ini_options]).tests/test_stop_all.py::test_stop_all_process_residual_still_aborts— the flawed test now isolates all five killers (mirroringtest_stop_all_retries_lock_kill), so the Windows branch can never perform a real kill.Canary —
TestStopAllHermeticityGuardis now parametrized over all five functions, verifying each guard raiser is installed (function-identity check only, never calls a stop path).Agent.md— documented pytest count 1052 → 1056 (net +4: 5 parametrized canaries − 1 old canary), satisfying the emrg: sync test counts to 484 + guard test against doc drift (recurs #426/#430/#510) #511 doc-count guard.Verification
uv run pytest tests/ -v→ 1055 passed, 1 skipped (1056 collected, doc-synced)uv run python -c "from emrg.client.app import run_client"→ OKuv run python -m emrg --help→ OKNo production code touched —
emrg/_stop_all.pyis unchanged (the Windows stop path is legitimateemrg stopbehavior; the hole was purely test-side).