Skip to main content

buggy

Your test suite went red. buggy tells you the line to open, the commit that broke it, and where the failing run first parted from a passing one. No model, no tokens, no network. It runs your suite once under per-test coverage, reads the evidence, and lets two integer laws rule.

RED — 1 failing: tests/integration_tests/user_tests/test_user_login.py::test_user_lockout_after_bad_attemps
root cause, by lanes of evidence agreeing:
  1. mealie/core/security/providers/credentials_provider.py:48   if user.login_attemps > settings.SECURITY_MAX_LOGIN_ATTEMPTS
       cause  7/15  [executed, spectrum 0.71 (ef 1, ep 1), recent, when-commit 92ef083]
  2. mealie/core/security/providers/credentials_provider.py:41   if user.login_attemps > settings.SECURITY_MAX_LOGIN_ATTEMPTS
       cause  7/15  [executed, spectrum 0.08 (ef 1, ep 160), recent, when-commit 92ef083]
when: 92ef0835 "credentials: tidy the lockout comparisons" introduced the failure (bisect, 6 test runs)

That is a real 41,000-line FastAPI project (Mealie), one red test whose traceback said only assert 200 == 423, 294 seconds, and the two lines it names are exactly the two the guilty commit changed.

Install

pip install buggy-cli

(The name buggy on PyPI is an unrelated 2019 placeholder; the package installs the buggy module and the buggy command.)

Your project needs pytest-cov in its own virtualenv (buggy finds a .venv or venv beside the code by itself; anything else, pass --python). Check before the first run:

buggy doctor .

Use

buggy .                      # locate: WHERE, WHEN, WHY, on the failing test — one run of the suite
buggy locate . --no-bisect   # faster: skip the commit search
buggy locate . --open        # jump your editor to the top line
buggy icon .                 # the pixel bug: twitches while red; click it and it crawls to the line
buggy scan ~/projects        # every project folder under a workspace, watched live in the browser
buggy vscode-init .          # a "buggy: locate the bug" task; results land in the Problems pane

In VS Code, Cursor or Windsurf, install vscode/buggy-0.1.0.vsix (Extensions → ⋯ → Install from VSIX) for the status-bar bug, the crawl through your executed lines, and the gutter mark on the ranked line.

What it reads

  • WHERE. Every line the failing test executed, with eight measured bits: run by every failing test, run by no passing test, import-time only, last touched by the commit bisect blamed, first divergence from a passing run, named in a traceback frame, containing a literal from the assertion, changed recently. The cause law turns the bits into a priority 0..15; 0 is a veto.
  • Where missing code belongs. When the fix is a line that does not exist yet, no executed line is wrong. The omission law ranks where the path stopped looking: the last executed line, the frontier it stepped past, the function the assertion targets, lines only passing tests reach.
  • WHEN. Bisect in a throwaway worktree, with the failing test carried into every revision. When no revision is green it says so: at least as old as <commit> (<date>).
  • WHY. The failing test traced through pytest against its nearest passing neighbour, to the first line where the paths part or a local differs.

Both laws are generated integer kernels, src/buggy/laws/*.c, each with an independent oracle and a self-check; the prompts that produced them are in docs/laws/. No number in them is a weight: lanes are counted, one strong lane beats any number of weak ones, and the ranking is the dense lexicographic rank of (strong, weak). The body measures; the law rules.

What it is worth, measured

docs/MEASURED.md has the tables. The short version, read straight:

  • Planted bug in a real project (Mealie, above): the two changed lines at ranks 1 and 2, the commit named. Easy for an engineer too; the point is that it costs nothing and runs unattended.
  • Ten adversarial cases (examples/adversarial.py): exact on 4, top 5 on 5, one genuine weakness — a 2,000-line file of coverage-identical lines, where nothing distinguishes them and the guilty line sits around rank 220. Score 6.5/10.
  • 35 real fixes from rich, held out: guilty file first in 21, guilty line in the top 10 in 12, never a candidate in 7 (omissions the failing test never ran).
  • The five longest-lived real bugs found, 8 to 12 years old, 900 to 5,000-line files, blind: the guilty line at rank 28, 11, 20 and 32 of the executed lines, the pure omission missed. On bugs like these only one bit fires and the spectrum does the ordering: a reading list, not the line.

So: when several lanes agree it is exact; when they do not it hands you a short list. It is a pre-filter you run first because it is free, not a replacement for whoever reads next.

What you will get wrong setting it up

symptom cause do
import errors on a project that is green in your shell the suite ran under the wrong interpreter keep a .venv beside the code, or pass --python
the law could not rule — EF_ALL is unmeasured pytest-cov is not in the project's interpreter install it there; buggy doctor . checks
spectrum lane: no per-test coverage on Python 3.12+ coverage's default core credits a line to the first test only buggy sets COVERAGE_CORE=ctrace; keep coverage ≥ 7.6
two runs on one project, both wrong the suite shares state (a SQLite file, a temp dir) never run two locates on one checkout at once
bisect blames the commit on top stale bytecode when file sizes match across revisions buggy purges it; never trust .pyc across checkouts
at least as old as … far back in history the test is red there because the feature did not exist yet read the bound as a bound

Layout

src/buggy/locate.py     the three lanes, the pool, the two regimes, the bisect step
src/buggy/cause.py      the CAUSE law (port of laws/cause.c)
src/buggy/omission.py   the OMISSION law (port of laws/omission.c)
src/buggy/float_icon.py the pixel bug (Tk, standard library only)
src/buggy/scan.py       the workspace scan page
vscode/                 the editor extension
examples/               the adversarial battery, the real-fix harness, the bug-age survey

AGPL-3.0-or-later.

Metadata

Release files for buggy-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for buggy-cli 0.1.0
File Size Uploaded Provenance
buggy_cli-0.1.0.tar.gz 66.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for buggy-cli 0.1.0
File Interpreter ABI Platform
buggy_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 130.6 kB

Release files / buggy_cli-0.1.0.tar.gz

Download URL buggy_cli-0.1.0.tar.gz
Size 66.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fd5f65cd6780f83a709096839e50fdbfe6611e9e301c72d6ef1048e51ff471e6
BLAKE2b-256 checksum
How to use checksums
1e60b7c684baeeb9ce427eae6f5b74dba7b4ce57dc20178d10b396163617dd25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Release files / buggy_cli-0.1.0-py3-none-any.whl

Download URL buggy_cli-0.1.0-py3-none-any.whl
Size 63.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b67b29eab171cc7d6f4662635531d9e77d84fa215e17baeee195ac2a7a31b515
BLAKE2b-256 checksum
How to use checksums
47d632d4b9a6d3c2e153fbe050fda482e3953aed9fe28e4d20938a0fb9347535
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

Security for buggy-cli 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for buggy_cli-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page