jitcatch
jitcatchv0.2.1MIT
jitcatch runs candidate Minitest or RSpec files on two git revisions, drops flakes and other non-signals, and prints the tests that pass on the parent and fail on the change, with the changed methods each one reaches.
Install
gem install jitcatch- Source on GitHub
- Used by: holdfast
A coding agent that reviews a change writes tests for that diff. A test that only describes the new behavior fails on the parent too, so it is not evidence of a regression. jitcatch runs the candidate Minitest or RSpec files on both revisions, drops flakes and other non-signals, and keeps the tests that the parent passes and the change fails. Each kept test shows a claim the old code met and the new code does not, with the changed method it reaches.
Features
Section titled “Features”- Two revisions, one report.
jitcatch run BASE HEAD TESTS_DIRruns each candidate file in a checkout of each side and sorts every test intono_signal,fail_on_base,flaky,discarded, orreported. Onlyreportedrows are left to judge. - Flakes dropped. After a pass on base and a fail on head,
--reruns Nruns the test again on head (2 by default). A test that does not fail the same way again isflakyand is dropped. - The changed method named. Each row carries a method id such as
m01and a tag such astouches:changed_method.jitcatch context BASE HEADprints the old and new source of each changed method. - A line to rerun. Each reported row shows the expected and actual values and a
rerun:command that runs that one test again. - Rails apps. In an app with
config/application.rb, the timeout is 60 seconds, and each checkout boots the app. When base and head would share one test database,runruns one process at a time and prints awarning:that names the line to change inconfig/database.yml. - JSON for a machine.
--jsonprints the same document forcontext,run, andassess, andjitcatch assess RUN.jsonprints a saved run again.
How an agent uses it
Section titled “How an agent uses it”- Pick a commit, and write a few tests in a scratch directory, such as
tmp/jitcatch, that state what the code did before it. - Run
bundle exec jitcatch run <commit>~1 <commit> tmp/jitcatch. - Read each
reportedrow against the commit message: a change the message asks for is intended, and anything else is a likely regression. - Run the
rerun:line to see the failure again, andjitcatch contextto read the old and new source.
Exit status 0 means the command finished, even when it found candidates. Exit status 3 means run tested nothing, for example when no candidate file loaded on either side.
The gem ships a jitcatch skill for the agent.
Getting started
Section titled “Getting started”jitcatch needs Ruby 3.3 or newer and git, and has no runtime dependency.
group :development, :test do gem "jitcatch", require: falseendbundle installbundle exec jitcatch run c3ef899~1 c3ef899 tmp/jitcatchWorks with
Section titled “Works with”- Characterization tests that branchout writes can be jitcatch candidates, as Minitest files or RSpec specs.