Skip to content

Try to trick Bite: fix 16 tricks that fooled it - #112

Merged
connabyss merged 2 commits into
mainfrom
claude/project-thread-xufeii
Nov 1, 2026
Merged

connabyss merged 2 commits into
mainfrom
claude/project-thread-xufeii

Conversation

@connabyss

@connabyss connabyss commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Requested by CH · project thread

What was wrong, what you changed, how you checked:

We threw 28 tricks at bite --free. Each one was a tiny repo whose newest commit was the trick. 18 of them fooled it. This PR fixes 16. The scoreboard, including the 2 that still get through, is in TRICKS.md.

The biggest one: a tested change could vouch for an untested one in the same commit. Say a commit fixes total() with no test and also tweaks label(), which is tested. Bite said "noticed by test_label". The same thing happened when a fix added a helper and the new test only called that helper. Now, when the whole change is noticed, Bite also takes each piece out alone (one piece per function, up to 6 per commit). It names any piece no test notices: ⚠️ PART NOT NOTICED. A piece that a later commit's test notices on today's code isn't named. The JSON result stays no_test_noticed.

The other fixes:

  • A fix whose test file a later commit deleted was shown as "noticed". When test files were deleted after a noticed commit, Bite now runs today's tests with the change taken out. If they all pass, it says ⚠️ ITS TEST IS GONE (only when it can tell).
  • A file moved in the same commit as the fix keeps its new name when the change comes out. Before, the tests just crashed on the missing name, and Bite read that as "noticed".
  • Fix words now beat tidy-up and speed-up words, so chore: fix crash and "faster and correct its rounding" get checked.
  • A message that names another OS or Python version skips the commit only when the code itself checks for one. Before, "reported by a Windows user" was enough to hide a fix.
  • A # or // inside a multi-line string (a #fff colour, or a URL in a JS template) is code now, not a comment. Python is compared by its syntax tree.
  • Docstrings and type hints count as code when the file reads them (__doc__, get_type_hints). A piece that only changes them still isn't named on its own.
  • A run where every test was skipped now counts as "no tests ran". This covers pytest, unittest, jest, vitest, node --test, mocha, Maven and dotnet.
  • Revert "Fix ..." isn't read as a fix claim.
  • Flaky tests: a test that fails once with the change out and then passes on a second run no longer counts as noticing it. A test that fails half the time used to fool Bite about 1 run in 2; now it's about 1 in 4.

How I checked:

  • tests/test_tricks.py has 21 tests, and each new behaviour has one that fails without it. 2 old self-test checks were updated: their "another OS" and "another Python" commits now include a real OS or version check in the code.
  • python -m pytest: 162 passed.
  • Bite on this PR, locally, the same way the Action runs it: both commits noticed, nothing flagged ("Bite-proof"). Earlier pushes of this PR were flagged by Bite's own check. It found 4 untested spots in the new code, and each one now has a test. The history was then squashed into these 2 commits (CH OK'd it).
  • Old Bite vs new Bite on Bite's own last 10 code commits, with the full test suite: no new flags.

Things to know: this makes Bite slower on commits a test noticed. Each one now costs 1 extra run for the flaky check, plus 1 run per piece, up to 6. A follow-up PR will cap the piece runs for a whole Bite run and add --quick. bite live doesn't use either check yet. The famous-repo scoreboard numbers were made with the old checks, so a rerun could shift them.

  • It links the issue it fixes: n/a (no issue; the "try to trick Bite" idea)
  • For a bug fix: a test that fails without the change and passes with it
  • python -m pytest passes, and CI is green (local pass; CI running)

Assisted-by: Claude Code

@connabyss connabyss self-assigned this Nov 1, 2026
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Bite ✅ Bite-proof. Nice work.

Bite took each change out, one at a time, and a test noticed every time. If one breaks later, that test will warn you.

Badge for your README: [![Bite-proof ✅](https://img.shields.io/badge/Bite--proof-%E2%9C%85-black)](https://github.com/connabyss/bite)

  • ✅ The tests test_a_fix_whose_test_was_deleted_later_is_not_called_guarded and 2 more noticed it was gone. If this change breaks later, they will warn you.
    Commit 5bb7bba1: “Don't call a fix guarded when its test is gone, or a piece a later test covers”
  • ✅ The tests test_selftest and 12 more noticed it was gone. If this change breaks later, they will warn you.
    Commit 6bd9f218: “Try to trick Bite: fix 15 tricks that fooled it”
How Bite checks

Bite asks one question about each change: if it disappeared, would any test notice? It takes the change out, runs your tests, and puts it back. What is Bite?

We threw 28 tricks at bite --free; 18 fooled it. Fixed here, each with a test
in tests/test_tricks.py that fails on the old code:

- A tested change no longer vouches for an untested one in the same commit:
  when the whole change is noticed, each piece (one per function, up to 6)
  is taken out alone, and a piece no test notices is named (PART NOT NOTICED).
  Covers bundled changes and tests that only call a new helper. A piece that
  only changes a docstring or hint isn't named on its own.
- A moved file keeps its new name when the change comes out, so a fix that
  rides along with a move is checked instead of "tests crash without it".
- Fix words beat tidy-up and speed-up words ("chore: fix crash").
- Naming another OS or Python version only skips code that checks for one.
- A # or // inside a multi-line string is code, not a comment; docstrings
  and type hints count when the file reads them (__doc__, get_type_hints).
- A run where every test was skipped counts as no tests ran.
- 'Revert "Fix ..."' isn't read as a fix claim.
- A test that fails once without the change, then passes, doesn't count as
  noticing it (flaky: now fools Bite 1 run in 4 instead of 1 in 2).

TRICKS.md is the scoreboard, including the ones that still fool it.

Assisted-by: Claude Code
…st covers

- A fix whose test file a later commit deleted was shown as "noticed". When
  test files were deleted after a noticed commit, Bite now takes the change
  out of today's code and runs today's tests; if they all pass it says
  ITS TEST IS GONE (only when it can tell).
- A piece no test noticed at its commit is checked on today's code too, by
  itself, like a whole gap is: a later commit's test can cover it.
- Two unnoticed pieces in one file come out together.

Assisted-by: Claude Code
@connabyss
connabyss force-pushed the claude/project-thread-xufeii branch from 8535cef to 5bb7bba Compare November 1, 2026 06:46
@connabyss connabyss changed the title Try to trick Bite: fix 15 tricks that fooled it Try to trick Bite: fix 16 tricks that fooled it Nov 1, 2026
@connabyss
connabyss merged commit 21b71a2 into main Nov 1, 2026
9 checks passed
@connabyss
connabyss deleted the claude/project-thread-xufeii branch November 1, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants