From a97e9ffa65e315936b09a5f643d65a11133b6df5 Mon Sep 17 00:00:00 2001 From: ProtocolWarden <32967198+ProtocolWarden@users.noreply.github.com> Date: Wed, 19 Aug 2026 08:08:37 -0400 Subject: [PATCH] test(board): explain the namespace-package trap when the assertion fires MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_the_retired_backend_is_actually_gone failed in a working checkout while passing in CI, and the reason is worth writing down rather than just clearing. git removes tracked files, not directories that still hold an untracked __pycache__. So after #521, src/operations_center/adapters/plane/ survived as an EMPTY directory — and an empty directory is a PEP 420 namespace package. `import operations_center.adapters.plane` still succeeded, returning a module whose __file__ is None. Any `except ImportError:` fallback would have taken the wrong branch without saying so. CI never reproduces this (fresh checkout, nothing left behind). Anyone who pulls the deletion with a populated __pycache__ does. The assertion now says what happened, why an empty directory is not harmless, and prints the exact rmdir that fixes it. No behaviour change — the test already caught the condition; it just could not explain it. Co-Authored-By: Claude Opus 5 --- .console/log.md | 15 +++++++++++++++ tests/unit/adapters/test_board_seam.py | 11 +++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.console/log.md b/.console/log.md index 7862a00a3..dda304dfd 100644 --- a/.console/log.md +++ b/.console/log.md @@ -1,3 +1,18 @@ +## 2026-08-19 — an empty directory is still an importable package + +After #521 merged, `tests/unit/adapters/test_board_seam.py::test_the_retired_backend_is_actually_gone` +failed in the live checkout while passing in CI. Not a flake: git removes +tracked files, not directories that still hold an untracked `__pycache__`, so +`src/operations_center/adapters/plane/` survived as an empty dir. An empty +directory is a PEP 420 namespace package — `import +operations_center.adapters.plane` still succeeded, returning a module with +`__file__` of None. Any `except ImportError` fallback would have taken the +wrong branch silently. + +CI never sees it (fresh checkout), but anyone pulling the deletion with a +populated `__pycache__` will. The assertion now names the trap and prints the +`rmdir` that fixes it. + ## 2026-08-19 — pushed a red test, caught it one command later Shipping the council fix for #521 I added five probe tests and pushed before diff --git a/tests/unit/adapters/test_board_seam.py b/tests/unit/adapters/test_board_seam.py index 7f5de50fd..22af1c7d8 100644 --- a/tests/unit/adapters/test_board_seam.py +++ b/tests/unit/adapters/test_board_seam.py @@ -312,8 +312,15 @@ def test_the_retired_backend_is_actually_gone(): truth about how the fleet talks to a board — one nothing exercises, and so one nothing keeps honest. """ - assert not (SRC / "adapters" / "plane").exists(), ( - "adapters/plane is back; the board backend is Forgejo" + plane_dir = SRC / "adapters" / "plane" + assert not plane_dir.exists(), ( + f"{plane_dir} exists. If it is EMPTY, git left it behind when the " + "deletion landed — it removes tracked files, not directories that still " + "held a __pycache__. That matters more than it looks: an empty directory " + "is a PEP 420 namespace package, so `import " + "operations_center.adapters.plane` still succeeds, with __file__ None, " + "and any `except ImportError` fallback silently takes the wrong branch. " + f"Fix with: rmdir {plane_dir}" ) # Deliberately importers, not every mention: several docstrings narrate the # migration ("callers imported PlaneClient by name..."), and that history is