Repository navigation
test(backend): derive test-isolation stub membership instead of hand-listing it - #11946
Merged
Git-on-my-level merged 1 commit intoAug 20, 2026
Merged
Conversation
…listing it 33 backend test files stub `utils.conversations.*` with hand-maintained lists of module names, for a package holding 25 submodules; each file names only the few it happens to need. #11888 added `utils/conversations/meeting_receipt.py` and imported it from `routers/conversations.py`, and two of those suites failed in CI at *collection* with ModuleNotFoundError - which reads as a product bug rather than a stale fixture, and which the module's author hits in CI rather than the fixture's owner hitting it locally. FC-hand-listed-test-isolation-membership already describes this exactly, and prescribes the cure: derive membership from the source signal, union it with the explicit list so omission is not an opt-out, and prove the derivation with an adopter deliberately absent from that list. Its canonical_prevention_artifact named only the Swift runner; the backend carried the same class with no guard. Add `package_submodule_stubs`, which enumerates a package's real submodules from disk - never importing them, so no package side effect runs - and unions `extra`. It resolves the directory relative to the backend root rather than through `importlib.util.find_spec`, because inside a `stub_modules` block the package is already a stub whose `__spec__` is None, so spec lookup would report the fake. Three properties matter and are covered by tests. Private `_`-prefixed modules are included: a router can `from pkg._private import X`, which is the same omission bug. Enumeration recurses, because a stubbed sub-package carries an empty `__path__` and would otherwise block `from pkg.child.leaf import X` from resolving. And `utils.conversations` has no `__init__.py`, so a package is detected by containing modules rather than by that file. Adopt it in the two suites that actually broke. Verified by adding a module to the package and importing it dotted from the router: 10 errors before, 10 passed after. The import form matters - `from pkg import new` resolves through the stubbed parent's __getattr__ and does not reproduce the failure. The remaining ~31 hand-listed suites are untouched and remain follow-up work. Failure-Class: FC-hand-listed-test-isolation-membership Co-Authored-By: Claude Opus 5 <[email protected]>
Git-on-my-level
deleted the
agent/m4-air/derived-test-isolation-membership
branch
August 20, 2026 20:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The drift
33 backend test files stub
utils.conversations.*using hand-maintained lists of module names. That package holds 25 submodules; each file names only the few it happens to need.#11888 added
utils/conversations/meeting_receipt.pyand imported it fromrouters/conversations.py. Two of those suites failed in CI at collection:That reads as a product bug rather than a stale fixture, and the module's author hits it in CI rather than the fixture's owner hitting it locally.
FC-hand-listed-test-isolation-membershipalready describes this exactly, and prescribes the cure: derive membership from the source signal, union it with the explicit list so omission is not an opt-out, and prove the derivation with an adopter deliberately absent from that list. Itscanonical_prevention_artifactnamed only the Swift runner — the backend carried the same class with no guard. This adds one, and updates the class record to name it.The guard
package_submodule_stubs(package, *, extra=(), include_package=True)enumerates a package's real submodules from disk — never importing them, so no package side effect runs — and unionsextra.It resolves the directory relative to the backend root rather than through
importlib.util.find_spec, because inside astub_modulesblock the package is already a stub whose__spec__isNone, so spec lookup would report the fake.Three properties matter, and each has a test:
from pkg._private import X; skipping_-prefixed names would reproduce the same omission bug.__path__, which would otherwise blockfrom pkg.child.leaf import Xfrom resolving against the real tree.__init__.py.utils/conversations/is a namespace package with no__init__.py; requiring that file would miss the very package in the incident.Verification
Added a module to
utils/conversations/, imported it from the router with a dotted import, and ran the two suites:ModuleNotFoundErrorRepeated for a
_-prefixed module and a nested sub-package leaf: both covered.The import form matters and is worth knowing for anyone testing this:
from pkg import newresolves through the stubbed parent's__getattr__and does not reproduce the failure. Only a dottedfrom pkg.new import Xdoes.43 tests pass across the three touched suites.
Scope
Two suites adopt the helper — the two that actually broke. The remaining ~31 hand-listed suites are untouched; migrating them is a mechanical sweep with real regression risk and belongs in its own change. No production code is modified.
Failure-Class: FC-hand-listed-test-isolation-membership