jittest 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- jittest-0.2.1/.gitignore +20 -0
- jittest-0.2.1/CHANGELOG.md +78 -0
- jittest-0.2.1/LICENSE +201 -0
- jittest-0.2.1/PKG-INFO +248 -0
- jittest-0.2.1/README.md +217 -0
- jittest-0.2.1/docs/ARCHITECTURE.md +180 -0
- jittest-0.2.1/docs/DIFFERENTIATION.md +101 -0
- jittest-0.2.1/docs/MANUAL-REPRO.md +115 -0
- jittest-0.2.1/docs/PAPERS.md +136 -0
- jittest-0.2.1/docs/PRIOR-ART.md +106 -0
- jittest-0.2.1/docs/QUICKSTART.md +120 -0
- jittest-0.2.1/docs/ROADMAP.md +184 -0
- jittest-0.2.1/docs/STACK.md +96 -0
- jittest-0.2.1/eval/README.md +44 -0
- jittest-0.2.1/eval/false_positives.py +103 -0
- jittest-0.2.1/eval/run_bugsinpy.py +186 -0
- jittest-0.2.1/pyproject.toml +76 -0
- jittest-0.2.1/src/jittest/__init__.py +13 -0
- jittest-0.2.1/src/jittest/_minirunner.py +121 -0
- jittest-0.2.1/src/jittest/assess.py +89 -0
- jittest-0.2.1/src/jittest/cli.py +232 -0
- jittest-0.2.1/src/jittest/config.py +127 -0
- jittest-0.2.1/src/jittest/diff.py +272 -0
- jittest-0.2.1/src/jittest/execute.py +234 -0
- jittest-0.2.1/src/jittest/github.py +129 -0
- jittest-0.2.1/src/jittest/ledger.py +213 -0
- jittest-0.2.1/src/jittest/llm.py +365 -0
- jittest-0.2.1/src/jittest/pipeline.py +341 -0
- jittest-0.2.1/src/jittest/prompts.py +161 -0
- jittest-0.2.1/src/jittest/report.py +130 -0
- jittest-0.2.1/src/jittest/risk.py +103 -0
- jittest-0.2.1/src/jittest/safety.py +89 -0
- jittest-0.2.1/tests/__init__.py +0 -0
- jittest-0.2.1/tests/helpers.py +126 -0
- jittest-0.2.1/tests/test_diff.py +96 -0
- jittest-0.2.1/tests/test_oracle.py +71 -0
- jittest-0.2.1/tests/test_pipeline.py +105 -0
- jittest-0.2.1/tests/test_units.py +429 -0
jittest-0.2.1/.gitignore
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
.venv/
|
|
4
|
+
venv/
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
.mypy_cache/
|
|
11
|
+
.coverage
|
|
12
|
+
coverage.xml
|
|
13
|
+
htmlcov/
|
|
14
|
+
.env
|
|
15
|
+
.jittest/
|
|
16
|
+
jittest-results.json
|
|
17
|
+
eval-results.json
|
|
18
|
+
false-positives.json
|
|
19
|
+
.jittest-comment.md
|
|
20
|
+
.DS_Store
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.1 — 2026-07-26
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **pytest parity**: Added `pythonpath = ["src"]` to `[tool.pytest.ini_options]` so `python -m pytest` can import jittest from src-layout without `PYTHONPATH`. The unittest runner worked because CI set `PYTHONPATH=src` explicitly; pytest had no such configuration.
|
|
7
|
+
- **Outcome enum restored to StrEnum**: Ruff rule UP042 was applied as `Outcome(str, Enum)` → `Outcome(Enum)`, which removed string behaviour the codebase relies on (`Outcome.PASS == "pass"`, JSON serialisation). Corrected to `Outcome(StrEnum)`. Added 4 regression tests that fail on plain Enum and pass on StrEnum.
|
|
8
|
+
- **Canonical Apache-2.0 licence**: Replaced placeholder LICENSE with verbatim text from apache.org. GitHub now detects `spdx_id: Apache-2.0` instead of `NOASSERTION`.
|
|
9
|
+
- **Ruff compliance**: Fixed all 7 ruff errors (UP042, UP037 ×2, F401, UP012, SIM102, SIM117). No per-file-ignores, no noqa comments, no config relaxation.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- **ARCHITECTURE.md and STACK.md rewritten**: Both documents described a v0.1 design that depended on unidiff, litellm, pydantic, typer, rich, PyYAML and coverage. The shipped v0.2 code depends on nothing. Documents now describe what each module in `src/jittest/` actually does, module by module.
|
|
13
|
+
- **install-smoke workflow**: Added `.github/workflows/install-smoke.yml` that verifies `pip install .` produces a working `jittest` command on Python 3.11, 3.12 and 3.13. All three pass.
|
|
14
|
+
- **CI umbrella job**: Added a `ci` job to `.github/workflows/ci.yml` that aggregates lint, test and build results into a single check name matching the branch protection required context.
|
|
15
|
+
- **Actions version bumps**: actions/checkout v4→v7, actions/setup-python v5→v7, actions/upload-artifact v4→v7, softprops/action-gh-release v2→v3.
|
|
16
|
+
|
|
17
|
+
All notable changes to this project are documented here.
|
|
18
|
+
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
19
|
+
Versioning: [SemVer](https://semver.org/spec/v2.0.0.html).
|
|
20
|
+
|
|
21
|
+
## [0.2.0] - 2026-07-25
|
|
22
|
+
|
|
23
|
+
### Changed - the zero-dependency rewrite
|
|
24
|
+
|
|
25
|
+
- **`dependencies = []`.** jittest now installs with no third-party packages at
|
|
26
|
+
all. `unidiff`, `litellm`, `pydantic`, `typer`, `rich` and `PyYAML` are gone.
|
|
27
|
+
A tool that runs inside other people's CI should not bring a dependency tree
|
|
28
|
+
into their locked project, and every package we drop is one fewer resolver
|
|
29
|
+
conflict, one fewer supply-chain surface and one fewer reason to say no.
|
|
30
|
+
- unified diff parsing: own parser in `diff.py`
|
|
31
|
+
- model access: `urllib` in `llm.py` (Anthropic Messages + OpenAI-compatible)
|
|
32
|
+
- config: stdlib `tomllib`
|
|
33
|
+
- CLI: `argparse`
|
|
34
|
+
- litellm is still supported, opt-in, via `pip install jittest[litellm]` and
|
|
35
|
+
`JITTEST_USE_LITELLM=1`
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- **`_minirunner`**: a stdlib test runner used when pytest is not importable,
|
|
40
|
+
with pytest-compatible exit codes (0 pass / 1 fail / 2 collection error /
|
|
41
|
+
5 no tests). jittest can now answer "does this test pass here?" in hardened
|
|
42
|
+
or air-gapped runners.
|
|
43
|
+
- **Worktree reuse.** Base and head are checked out once per run instead of once
|
|
44
|
+
per candidate. This is what makes three executions per candidate affordable,
|
|
45
|
+
and three executions is what buys the flakiness rerun.
|
|
46
|
+
- **Flakiness reruns** (`--reruns`, default 2). A failure on head must reproduce
|
|
47
|
+
before we spend a base checkout, let alone a reviewer's attention.
|
|
48
|
+
- **`jittest doctor`**: reports python version, git, runner, key presence and
|
|
49
|
+
effective config, so a failed install is diagnosable in one command.
|
|
50
|
+
- **Human outcome labels** in the ledger (`fixed_code`, `kept_test`, `intended`,
|
|
51
|
+
`false_positive`, `ignored`) plus `jittest outcome` and anonymised
|
|
52
|
+
`jittest export`. This is the corpus, and it is the only asset here that
|
|
53
|
+
cannot be reimplemented in a fortnight.
|
|
54
|
+
- **Static safety gate** (`safety.py`) applied to every candidate before it is
|
|
55
|
+
executed: no sockets, no subprocesses, no `eval`, no `assert True`, no sleeps.
|
|
56
|
+
- **Response cache** keyed on model, prompts and temperature, so re-running a PR
|
|
57
|
+
costs nothing.
|
|
58
|
+
- **Budget cap** enforced before a request is sent rather than after.
|
|
59
|
+
- **`--dry-run`** runs the entire pipeline with a stub model: no API key, no
|
|
60
|
+
network, no cost. It is how the test suite runs, and how a new user can watch
|
|
61
|
+
jittest work on their own repo before handing over a key.
|
|
62
|
+
- 36 offline tests covering the diff parser, risk ranking, config precedence,
|
|
63
|
+
the safety gate, assessment parsing, the ledger, the oracle against a real
|
|
64
|
+
seeded regression in a real git repo, and the pipeline end to end.
|
|
65
|
+
|
|
66
|
+
### Fixed
|
|
67
|
+
|
|
68
|
+
- Candidate test files are always deleted from the checkout, including after a
|
|
69
|
+
timeout.
|
|
70
|
+
- `PYTHONHASHSEED=0` and `PYTHONDONTWRITEBYTECODE=1` in the child environment,
|
|
71
|
+
removing one avoidable source of non-determinism.
|
|
72
|
+
- Assessor replies with a confidence of `85` are read as `0.85`; unparseable
|
|
73
|
+
replies degrade to `unclear`, which is not reported. The layer fails closed.
|
|
74
|
+
|
|
75
|
+
## [0.1.0] - 2026-07-25
|
|
76
|
+
|
|
77
|
+
- First scaffold: diff parsing, risk targeting, generator prompts, differential
|
|
78
|
+
oracle, assessor, SQLite ledger, GitHub Action, docs and evaluation harness.
|
jittest-0.2.1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1\. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2\. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3\. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4\. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5\. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6\. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7\. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8\. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9\. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 the jittest authors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
jittest-0.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jittest
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Generate tests that FAIL on your pull request and PASS on main. Open reference implementation of just-in-time catching test generation.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Kartik24Hulmukh/jittest
|
|
6
|
+
Project-URL: Documentation, https://github.com/Kartik24Hulmukh/jittest/tree/main/docs
|
|
7
|
+
Project-URL: Source, https://github.com/Kartik24Hulmukh/jittest
|
|
8
|
+
Project-URL: Issues, https://github.com/Kartik24Hulmukh/jittest/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/Kartik24Hulmukh/jittest/blob/main/CHANGELOG.md
|
|
10
|
+
Author: jittest contributors
|
|
11
|
+
License: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: catching-tests,ci,code-review,jittest,llm,pull-request,pytest,regression,testing
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
21
|
+
Classifier: Topic :: Software Development :: Testing
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
25
|
+
Requires-Dist: pytest-timeout>=2.3; extra == 'dev'
|
|
26
|
+
Requires-Dist: pytest>=8.2; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
28
|
+
Provides-Extra: litellm
|
|
29
|
+
Requires-Dist: litellm>=1.55.0; extra == 'litellm'
|
|
30
|
+
Description-Content-Type: text/markdown
|
|
31
|
+
|
|
32
|
+
<h1 align="center">jittest</h1>
|
|
33
|
+
|
|
34
|
+
<p align="center">
|
|
35
|
+
<b>Generate tests that FAIL on your pull request and PASS on main.</b><br>
|
|
36
|
+
The open reference implementation of just-in-time <i>catching</i> test generation.
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<img alt="license" src="https://img.shields.io/badge/license-Apache--2.0-blue">
|
|
41
|
+
<img alt="python" src="https://img.shields.io/badge/python-3.11%2B-blue">
|
|
42
|
+
<img alt="dependencies" src="https://img.shields.io/badge/dependencies-0-brightgreen">
|
|
43
|
+
</p>
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## The distinction the whole tool rests on
|
|
48
|
+
|
|
49
|
+
Almost every AI testing tool generates tests that **pass** on your new code.
|
|
50
|
+
That is a *hardening* test. It documents what the code does today, including any
|
|
51
|
+
bug you just introduced. Generate tests until they go green and you can
|
|
52
|
+
[reinforce the bug you were trying to find](https://arxiv.org/pdf/2412.14137).
|
|
53
|
+
|
|
54
|
+
jittest generates **catching** tests:
|
|
55
|
+
|
|
56
|
+
> A catching test **passes on the base commit** and **fails on the head commit**,
|
|
57
|
+
> proving the change broke something.
|
|
58
|
+
|
|
59
|
+
That is not a prompt instruction we hope the model follows. It is a mechanical
|
|
60
|
+
gate. Every candidate is executed on both commits, and anything that does not
|
|
61
|
+
satisfy the rule is thrown away before you ever see it.
|
|
62
|
+
|
|
63
|
+
Meta published this method in 2026 and reported catching tests being produced at
|
|
64
|
+
roughly **4x the rate of hardening tests**, with assessor agents cutting reviewer
|
|
65
|
+
load by about **70%** ([arXiv 2601.22832](https://arxiv.org/abs/2601.22832)).
|
|
66
|
+
There was no open implementation. This is one.
|
|
67
|
+
|
|
68
|
+
## Install
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pip install jittest
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Zero dependencies.** Not "few" — zero. jittest runs inside your CI, and a CI
|
|
75
|
+
tool has no business injecting a dependency tree into your locked project. Diff
|
|
76
|
+
parsing, HTTP, config and the test-runner fallback are all standard library.
|
|
77
|
+
|
|
78
|
+
## Try it in 60 seconds, with no API key
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
cd your-repo
|
|
82
|
+
jittest doctor # can this environment run jittest?
|
|
83
|
+
jittest run --base main --head HEAD --dry-run
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`--dry-run` runs the real diff parser, the real risk ranker, the real git
|
|
87
|
+
worktrees and the real oracle, with a stub model. No key, no network, no cost.
|
|
88
|
+
Watch what it targets before you decide whether to hand it a key.
|
|
89
|
+
|
|
90
|
+
Then, for real:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
export JITTEST_API_KEY=sk-...
|
|
94
|
+
jittest run --base main --head HEAD --budget 1.00
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## In GitHub Actions
|
|
98
|
+
|
|
99
|
+
```yaml
|
|
100
|
+
name: jittest
|
|
101
|
+
on: pull_request
|
|
102
|
+
|
|
103
|
+
permissions:
|
|
104
|
+
contents: read
|
|
105
|
+
pull-requests: write
|
|
106
|
+
|
|
107
|
+
jobs:
|
|
108
|
+
catching-tests:
|
|
109
|
+
runs-on: ubuntu-latest
|
|
110
|
+
steps:
|
|
111
|
+
- uses: actions/checkout@v4
|
|
112
|
+
with:
|
|
113
|
+
fetch-depth: 0 # the oracle needs both commits
|
|
114
|
+
- uses: Kartik24Hulmukh/jittest@v0
|
|
115
|
+
with:
|
|
116
|
+
base: ${{ github.event.pull_request.base.sha }}
|
|
117
|
+
head: ${{ github.event.pull_request.head.sha }}
|
|
118
|
+
budget: "1.00"
|
|
119
|
+
comment: "true"
|
|
120
|
+
env:
|
|
121
|
+
JITTEST_API_KEY: ${{ secrets.JITTEST_API_KEY }}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**If jittest proves nothing, it posts nothing.** No "looks good to me", no
|
|
125
|
+
summary of your diff, no comment at all. Silence is the default and it is a
|
|
126
|
+
feature: 2026 surveys put 15–30% of AI review comments in the low-value bucket,
|
|
127
|
+
and the cost of that is not tokens, it is the maintainer who turns the bot off.
|
|
128
|
+
|
|
129
|
+
## What a finding looks like
|
|
130
|
+
|
|
131
|
+
> #### 1. `billing/calc.py::apply_discount`
|
|
132
|
+
> **Removing the clamp lets a discount above 100% return a negative price.**
|
|
133
|
+
> > Should a discount over 100% still floor the price at zero?
|
|
134
|
+
>
|
|
135
|
+
> <sub>assessor: likely regression (confidence 0.88, severity high) — risk score
|
|
136
|
+
> 0.71 [consequential_domain, branch_density, modifies_existing]</sub>
|
|
137
|
+
>
|
|
138
|
+
> ```python
|
|
139
|
+
> from billing.calc import apply_discount
|
|
140
|
+
>
|
|
141
|
+
> def test_discount_never_goes_below_zero():
|
|
142
|
+
> assert apply_discount(100.0, 150.0) == 0.0
|
|
143
|
+
> ```
|
|
144
|
+
>
|
|
145
|
+
> <details><summary>Reproduce locally</summary>
|
|
146
|
+
>
|
|
147
|
+
> ```bash
|
|
148
|
+
> git checkout a1b2c3d4e5f6 && pytest billing/calc.py -q # expect FAIL
|
|
149
|
+
> git checkout 0f9e8d7c6b5a && pytest billing/calc.py -q # expect PASS
|
|
150
|
+
> ```
|
|
151
|
+
> </details>
|
|
152
|
+
|
|
153
|
+
Every claim ships with the command that reproduces it. You should never have to
|
|
154
|
+
take our word for anything.
|
|
155
|
+
|
|
156
|
+
## How it works
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
git diff
|
|
160
|
+
→ change targets functions, not files
|
|
161
|
+
→ risk ranking the cost gate: only the top N symbols are worth tokens
|
|
162
|
+
→ N candidate tests the only step a model decides anything
|
|
163
|
+
→ static safety gate no sockets, no subprocesses, no eval, no assert True
|
|
164
|
+
→ DIFFERENTIAL ORACLE fails on head ∧ reproduces ∧ passes on base
|
|
165
|
+
→ assessor proven true — but would a human care?
|
|
166
|
+
→ ledger + report
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The oracle is the product. Everything else is replaceable.
|
|
170
|
+
|
|
171
|
+
| Oracle result | What it means | What jittest does |
|
|
172
|
+
| --- | --- | --- |
|
|
173
|
+
| fails on head, passes on base | the change broke behaviour | **report it** |
|
|
174
|
+
| passes on head | hardening test | discard |
|
|
175
|
+
| fails on both | pre-existing fault | `--latent` only |
|
|
176
|
+
| does not reproduce | flaky | discard |
|
|
177
|
+
| cannot be collected | broken test | discard, retry once |
|
|
178
|
+
|
|
179
|
+
## Commands
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
jittest run --base main --head HEAD [--dry-run] [--comment] [--latent]
|
|
183
|
+
jittest doctor # environment check
|
|
184
|
+
jittest stats # what the local ledger has learned
|
|
185
|
+
jittest outcome <test-hash> fixed_code|kept_test|intended|false_positive|ignored
|
|
186
|
+
jittest export corpus.jsonl # anonymised by default
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
`jittest outcome` is the important one. It records what a human actually did
|
|
190
|
+
after seeing a finding, which is the only honest measure of precision — and,
|
|
191
|
+
accumulated across repositories, the training signal for a risk model that no
|
|
192
|
+
amount of prompt engineering can substitute for.
|
|
193
|
+
|
|
194
|
+
## Configuration
|
|
195
|
+
|
|
196
|
+
Precedence: defaults → `.jittest.toml` or `[tool.jittest]` in `pyproject.toml`
|
|
197
|
+
→ `JITTEST_*` environment variables → CLI flags.
|
|
198
|
+
|
|
199
|
+
```toml
|
|
200
|
+
[tool.jittest]
|
|
201
|
+
model = "anthropic/claude-sonnet-4-5"
|
|
202
|
+
budget_usd = 1.00 # hard cap, enforced before each request
|
|
203
|
+
max_targets = 5
|
|
204
|
+
candidates_per_target = 4
|
|
205
|
+
risk_threshold = 0.35
|
|
206
|
+
reruns = 2 # flakiness reruns on head
|
|
207
|
+
ignore = ["legacy/*"] # added to the built-in defaults
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Any OpenAI-compatible endpoint works via `JITTEST_API_BASE`, including local
|
|
211
|
+
Ollama. For the long tail of providers, `pip install jittest[litellm]` and set
|
|
212
|
+
`JITTEST_USE_LITELLM=1`.
|
|
213
|
+
|
|
214
|
+
## Honest status
|
|
215
|
+
|
|
216
|
+
This is **v0.2.1, alpha**. What is verified and what is not:
|
|
217
|
+
|
|
218
|
+
| | Status |
|
|
219
|
+
| --- | --- |
|
|
220
|
+
| Oracle, pipeline, safety gate, ledger, config, CLI | 36 offline tests, green, no network required |
|
|
221
|
+
| Oracle behaviour on a real seeded regression in a real git repo | tested |
|
|
222
|
+
| Catch rate on a public benchmark (BugsInPy) | **not yet measured** — harness in `eval/` |
|
|
223
|
+
| False-positive rate on real PRs | **not yet measured** |
|
|
224
|
+
| Cost per PR in practice | target under $1.00; **not yet measured at scale** |
|
|
225
|
+
|
|
226
|
+
We will publish those numbers when we have run them, with the methodology and
|
|
227
|
+
the failures included. Until then they are blank rather than optimistic. If you
|
|
228
|
+
see a benchmark claim in this README that is not backed by a script in `eval/`,
|
|
229
|
+
it is a bug — please file it.
|
|
230
|
+
|
|
231
|
+
## Docs
|
|
232
|
+
|
|
233
|
+
- [`docs/QUICKSTART.md`](docs/QUICKSTART.md) — five minutes, no key
|
|
234
|
+
- [`docs/DIFFERENTIATION.md`](docs/DIFFERENTIATION.md) — why another one of these
|
|
235
|
+
- [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) — the pipeline in detail
|
|
236
|
+
- [`docs/PAPERS.md`](docs/PAPERS.md) — the research this implements
|
|
237
|
+
- [`docs/PRIOR-ART.md`](docs/PRIOR-ART.md) — what exists and how this differs
|
|
238
|
+
- [`SECURITY.md`](SECURITY.md) — we execute model-written code; read this
|
|
239
|
+
|
|
240
|
+
## Citing
|
|
241
|
+
|
|
242
|
+
If jittest helps your research, cite the method
|
|
243
|
+
([arXiv 2601.22832](https://arxiv.org/abs/2601.22832)) and this implementation
|
|
244
|
+
(see `CITATION.cff`).
|
|
245
|
+
|
|
246
|
+
## Licence
|
|
247
|
+
|
|
248
|
+
Apache-2.0.
|