Skip to content

Two size-cap violations in the synaptic-plasticity family (seen during PR #254 verification) #301

Description

@cdeust

Context

Discovered while verifying PR #254 (fix(core): break the synaptic-plasticity
import cycle, #233) had landed cleanly on main (commit 6c6ef61). Both
files are touched by that PR's own diff, so this is a boy-scout-gate finding
(coding-standards.md §14) against material the PR modified — filed rather
than folded in per §14.3, because fixing either properly (Extract Function /
Extract Module) is its own root-cause change, independent of a rebase-and-
verify task, and no PR is currently open to attach it to (§15.1: never mix
an enabling refactor with an unrelated change).

Violation 1 — _stochastic_single, 56 lines

mcp_server/core/synaptic_plasticity_stochastic.py::_stochastic_single is
56 lines — over CLAUDE.md's repo-local 40-line/method convention AND over
coding-standards.md's hard §4.2 50-line cap. Pre-existing (confirmed present
at 56 lines in adcc00f, PR #254's merge-parent, before that PR's own diff
— which only retargeted two import statements, "zero executable lines
changed" per the PR's own description).

Repro:

$ git show adcc00f:mcp_server/core/synaptic_plasticity_stochastic.py | python3 -c "
import ast,sys
src = sys.stdin.read()
for node in ast.walk(ast.parse(src)):
    if isinstance(node, (ast.FunctionDef, ast.AsyncFunctionDef)):
        ln = (node.end_lineno or node.lineno) - node.lineno + 1
        if ln > 40:
            print(node.name, ln)
"
_stochastic_single 56

Violation 2 — test_stochastic_transmission.py, 490 lines

tests_py/core/test_stochastic_transmission.py was already over this repo's
300-line file convention before PR #254 (331 lines at adcc00f) and PR #254
itself added 161 more lines (mutation-killing exact-value tests), landing at
490 — under the hard 500-line cap but well over the repo's own stated 300.
This growth is inside PR #254's own diff, not merely a file it walked past.

Repro:

$ git show adcc00f:tests_py/core/test_stochastic_transmission.py | wc -l
331
$ git show 6c6ef61:tests_py/core/test_stochastic_transmission.py | wc -l
490

Acceptance criteria

  • _stochastic_single split (Extract Function, Fowler 2018 Ch. 6) so every
    function in synaptic_plasticity_stochastic.py is <= 40 lines, with the
    existing test suite passing byte-for-byte unchanged as the behavior-
    preservation proof (no test added/modified for the split itself).
  • test_stochastic_transmission.py split along a concern boundary (e.g. one
    file per Test* class family, mirroring the synaptic_plasticity_*
    module split) so each resulting file is <= 300 lines, with all existing
    tests passing unchanged post-split.
  • Both changes ship as their own PR(s), separate from any behavior change,
    so the split's correctness argument is "unchanged test outcomes" alone.

Not blocking PR #254 itself (already merged, all its own CI green per job) —
tracked here per coding-standards.md §14.3 so it does not become a silent,
un-issued "pre-existing" dismissal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions