fix(stealth-diagnostic): stop sync wrapper from shadowing the subpackage#10
Merged
Merged
Conversation
The sync convenience wrapper was exported as `stealth_diagnostic`, the same name as the `mithwire.stealth_diagnostic` subpackage. Binding it on the `mithwire` namespace overwrote the subpackage attribute, so `import mithwire.stealth_diagnostic.<x> as alias` (which compiles to IMPORT_FROM and walks that attribute) raised "cannot import name '<x>' from 'stealth_diagnostic' (unknown location)". The `from mithwire.stealth_diagnostic.<x> import ...` form happened to work, which masked the bug. Rename the sync wrapper to `diagnose_stealth`. The async `run_stealth_diagnostic` and the `mithwire.stealth_diagnostic.*` import paths are unchanged, so existing consumers (incl. mithwire-mcp) are unaffected. Add regression tests asserting `mithwire.stealth_diagnostic` is the module and that the dotted submodule import resolves. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Summary
stealth_diagnostic— the same name as themithwire.stealth_diagnosticsubpackage. Binding it on themithwirenamespace overwrote the subpackage attribute, soimport mithwire.stealth_diagnostic.<x> as alias(compiles toIMPORT_FROM, which walks that attribute) raisedcannot import name '<x>' from 'stealth_diagnostic' (unknown location). Thefrom mithwire.stealth_diagnostic.<x> import ...form still worked, which masked the bug.diagnose_stealth. The asyncrun_stealth_diagnosticand themithwire.stealth_diagnostic.*import paths are unchanged, so existing consumers (includingmithwire-mcp, which importsmithwire.stealth_diagnostic.probes) are unaffected.mithwire.stealth_diagnosticmust be the module, andimport mithwire.stealth_diagnostic.probes as pmust resolve.Test plan
25 passed(uv run pytest, the CI lane)Made with Cursor