Skip to content

About

AST crawler for the 'one path honors a discriminator, sibling silently drops it' bug shape. Zero deps, self-test green, honest negatives documented.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

crawlspike

A zero-dependency static crawler for "path divergence" bugs: the shape where one code path honors a discriminator (a type=/kind= param, or a paired registry key) and a sibling path silently drops it. AST-only, stdlib-only, no torch/model-construction step — it crawls source, not running code. (Its sibling arch-finder does the dynamic confirm step on nn.Module-shaped targets; crawlspike is the lightweight, any-Python-repo front end.)

Origin

Found twice in this portfolio, same shape, one bug apart:

  • Spikeling: pyspike.Net.neuron()'s live branch ignored type= while the batch SpikelingRuntime.__init__ routed by it — a Resonator added after build_live() silently became a plain LIF neuron.
  • spiking_orchestrator: promoted specialists never populated self._specialist_tasks, which the run-gate checks, while the live-spawn path did — a promoted specialist silently ran with full edit tools on the top-level task.

Same root cause both times: a discriminator (or a paired-registry key) is honored on one path and silently dropped on a structurally similar sibling. Generalized into two AST patterns and pointed at real, unrelated OSS.

Patterns

Pattern A — discriminator router vs. branchless sibling. A "router" method branches on a param/attr (if x == "...": / elif chain / match x) and the branches write to different self.<attr>[...] containers or construct different classes. Flagged: a sibling method (same class) whose signature carries the same discriminator name, that writes at least one of those same containers, but never branches on the discriminator and doesn't delegate to the router.

Pattern B — partially-populated parallel registries. Two dict attributes co-populated with the same key variable in one method (self.reg1[k] = ... and self.reg2[k] = ... together). Flagged: another "construction-shaped" method that writes reg1[k] but never reg2[k] — when reg2 is read elsewhere as a membership/lookup gate (k in self.reg2, .get(k), self.reg2[k]).

Both are heuristics: they narrow where to look. A human (or --confirm in a dynamic-capable sibling tool) makes the actual call. Every hit is a candidate, never a filed bug.

Run

python crawlspike.py --self-test        # synthetic Runtime/Reg fixture, must PASS
python crawlspike.py <path> [<path> ...]

Exit 2 if any candidate found, 1 on self-test failure, 0 otherwise.

Status: real, measured, honest

Self-test: PASS (both planted shapes caught).

First real-target run (2026-09-07) against installed OSS — transformers, peft, accelerate, bitsandbytes, safetensors — surfaced 3 real detector bugs, not 3 real target bugs. A second, wider pass across 22 real installed packages (torch's nn/optim/distributed, sklearn, pydantic, scipy, fastapi, flask, and more — full list in BENCHMARK.md) found 2 more detector bugs, in sklearn and torch's DTensor sharding code. All 5 are documented with root cause and fix in NEGATIVES.md. Post-fix: those same 22 targets scan clean (0 candidates) and the self-test is still green — genuine negative results, reported as such, not stretched into findings.

Against a real, previously-shipped, checked-in ground-truth bug (this user's own Spikeling repo, at the exact commit before the actual fix), crawlspike found it correctly in 1.4s — see BENCHMARK.md for the full head-to-head against ruff, semgrep, and pylint (all three miss it; they solve a different problem). No OSS PR has been filed from this tool yet — the value so far is one confirmed true positive plus 5 confirmed and fixed false positives, both reported honestly.

License

MIT

About

AST crawler for the 'one path honors a discriminator, sibling silently drops it' bug shape. Zero deps, self-test green, honest negatives documented.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages