Reproduction
$ python -c "import mcp_server.core.synaptic_plasticity_hebbian"
ImportError: cannot import name 'apply_hebbian_update' from partially
initialized module 'mcp_server.core.synaptic_plasticity_hebbian'
(most likely due to a circular import)
mcp_server/core/synaptic_plasticity_hebbian.py does
from mcp_server.core.synaptic_plasticity import _MAX_WEIGHT, _MIN_WEIGHT
while synaptic_plasticity.py imports apply_hebbian_update back from it
(# noqa: E402 site). Importing the parent module first resolves the cycle,
which is why the suite stays green — but any consumer (REPL, script, future
module) that imports the _hebbian module directly fails.
Surfaced during the #197 family-3 (PLR2004/E501) sweep, which touched the
file but deliberately did not restructure imports (behavior-preserving
mandate). Deferred per coding-standards §14.3: outside that change's blast
radius — no test, build, or lint step the sweep triggers fails on it.
Acceptance criteria
python -c "import mcp_server.core.synaptic_plasticity_hebbian" succeeds
in a fresh interpreter (regression test asserting exactly that, run in a
subprocess so no prior import masks the cycle).
- The weight-bound constants live in exactly one module with no
back-import cycle (e.g. hoisted to a leaf module both files import).
- Existing suite passes unchanged.
Reproduction
mcp_server/core/synaptic_plasticity_hebbian.pydoesfrom mcp_server.core.synaptic_plasticity import _MAX_WEIGHT, _MIN_WEIGHTwhile
synaptic_plasticity.pyimportsapply_hebbian_updateback from it(
# noqa: E402site). Importing the parent module first resolves the cycle,which is why the suite stays green — but any consumer (REPL, script, future
module) that imports the
_hebbianmodule directly fails.Surfaced during the #197 family-3 (PLR2004/E501) sweep, which touched the
file but deliberately did not restructure imports (behavior-preserving
mandate). Deferred per coding-standards §14.3: outside that change's blast
radius — no test, build, or lint step the sweep triggers fails on it.
Acceptance criteria
python -c "import mcp_server.core.synaptic_plasticity_hebbian"succeedsin a fresh interpreter (regression test asserting exactly that, run in a
subprocess so no prior import masks the cycle).
back-import cycle (e.g. hoisted to a leaf module both files import).