Skip to content

test(board): explain the namespace-package trap when the assertion fires - #523

Merged
ProtocolWarden merged 1 commit into
mainfrom
test/namespace-package-trap
Aug 19, 2026
Merged

test(board): explain the namespace-package trap when the assertion fires#523
ProtocolWarden merged 1 commit into
mainfrom
test/namespace-package-trap

Conversation

@ProtocolWarden

Copy link
Copy Markdown
Owner

test_the_retired_backend_is_actually_gone failed in a working checkout while passing in CI. Not a flake — and the reason is worth writing down rather than just clearing.

What happened

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.

An empty directory is a PEP 420 namespace package:

>>> import operations_center.adapters.plane as m
>>> m.__file__
None

The import succeeds. Any except ImportError: fallback would have taken the wrong branch without saying so — which is precisely the class of silent-wrong-answer this seam's tests exist to prevent.

Why CI can't see it

Fresh checkout, nothing left behind. Anyone who pulls the deletion with a populated __pycache__ reproduces it immediately. That asymmetry is why the message matters more than the assertion.

The change

The assertion now says what happened, why an empty directory isn't harmless, and prints the exact rmdir that fixes it. Verified both ways — it fires with that message when the directory exists, and the file is 14 passed on a clean tree.

No behaviour change: the test already caught the condition, it just couldn't explain it.

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@ProtocolWarden
ProtocolWarden merged commit 4c25963 into main Aug 19, 2026
25 checks passed
@ProtocolWarden
ProtocolWarden deleted the test/namespace-package-trap branch August 19, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant