Build with Beam · docs that lie, caught by running them

DocDrift

Your docs say one thing. Your code does another.

DocDrift gives Beam an entire Python library (docs + code, up to ~400k tokens) in one call. Beam checks every suspicious doc example against the whole codebase, then writes a script that runs it. Across 12 popular libraries (bugs in 11 of 12 libraries; pydantic-settings had none) it found 34 real docs bugs; 30 crash exactly as the docs are written.

Beam read 12 whole Python libraries and ran their docs: 34 real bugs, 30 reproduce.

34real docs bugs · 11 of 12 libraries
30crash when you run the docs
2fixes filed upstream (starlette #3746, nox #1216)
Labels: checked against the source by an AI reviewer, not a human. Recall is measured against the 45 drifts any method found, so it flatters the methods.

Voice: Kokoro-82M (Apache-2.0), generated locally

Transcript

DocDrift gives Beam a whole Python library in one call, to find docs that lie.

Starlette's docs say: call receive JSON with mode binary. Run it as written, and it crashes with a TypeError.

One Beam call, the whole library: 394,577 prompt tokens. 3 candidates; 2 kept as real drift, 1 rejected.

A fix is filed upstream: pull request 3746, open, not merged.

Every card shows what the docs say, what the code says, and what running it gives: 34 real docs bugs in 11 of 12 libraries.

Does the 1M-token context help? Accuracy is about the same. But grounding is better: the right cross-file line 25 of 30 times, versus 19 at matched cost. Off-file evidence: 11 of 13, versus 6. p = 0.070: suggestive, not proven.

On the benchmark: 34 of 45 known drifts found; 30 crash exactly as the docs are written. 32 of the 34 bugs ship a script.

Then a fresh run on tomlkit, a library DocDrift had never seen.

2 findings: 1 verified version drift, and 1 arguable missing-imports NameError, in 96 seconds.

Run it on your repo with docdrift run, using a free Ollama key.

How this uses Beam

Watch the recorded starlette run

Recording — not a live call

Recorded starlette pack

Candidates

    Beam verdicts

      Repro traceback

      Why 1M context

      What is docs drift?

      Docs say one thing, the code does another. Worked example from starlette: docs call receive_json(data, mode="binary"); the implementation is receive_json(self, mode: str = "text"). Following the docs can raise TypeError.

      What Beam did

        AST check (free) → Beam whole-repo triage → Beam-written repro → strict gate

        Glossary