siftwise is an open-source, self-hosted tool that runs only the tests your change can affect, and tells you whether a failing test is your fault, already broken on main, or just flaky.
New here? Post 1 explains the idea and sets up the server and the GitHub Action. Post 2 adds GitLab CI and five coding agents over MCP. Post 3 adds risk order, time budgets, Jest and Java.
Today v0.4.0 is out, and it's the last big one: siftwise is now feature-complete. From here it's maintained for bug and security fixes, and contributions are welcome.
uv tool install --upgrade siftwise # 0.4.0; or: pip install -U siftwise There's also a new website that shows it all on one page: https://pramodbasavarajmenasi.github.io/siftwise-site/
What's new in v0.4
- 🔑 Per-repo API tokens with
readandwritescopes. - 📊 A web dashboard, and every CI selection is now recorded: what siftwise picked, why, and what it saved.
- 🧪 Mutation-tested recall: bugs planted on the lines real PRs changed, in five real repos.
- ☕ Kotlin, and Gradle builds with a plugin-only
includeBuild. - 🤖 A new MCP tool,
untested_changes: the files a change touched that no test reaches. - 💻 The GitHub Action is tested on ubuntu, macOS and Windows, and the server image now also runs on arm64.
- 📏 Per-variant estimates and time budgets for CI matrices.
- 🧹 Data retention:
siftwise server prune. - 🐛 Fixes, two of which made siftwise silently get something wrong.
- 🙌 Five outside contributors.
- 🚫 Two features that didn't work, and why I didn't ship them.
Like the earlier posts, this one is the whole guide, with the real numbers, including the ones that didn't go my way.
Planned vs shipped
At the end of post 3 I promised four things for v0.4. Here's what happened:
| Promised in v0.3 | Shipped in v0.4 |
|---|---|
| Safe scoping for build files inside test fixtures | ✅ fixtures = [...] in .siftwise.toml (#73) |
-mod=readonly for older Go versions | ✅ (#67, fixed by a contributor), plus Go workspace vendoring (#78, also a contributor) |
| More recall numbers: Jest, more Gradle, live dogfooding | ✅ Jest and Kotlin/Gradle, by mutation testing (Part 3). ⚠️ Dogfooding still has no failing run, so still no live recall |
| More good first issues | ✅ 5 contributors merged PRs |
I had also planned a v0.5. I folded it into v0.4, so the project ends finished instead of halfway through a roadmap.
Upgrading from 0.3
v0.4 has seven database migrations (0013 to 0019). Back up your database first. The server runs them on start, so with Docker it's the usual:
cd siftwise && git pull # the compose file now names the 0.4.0 image docker compose up -d --wait # pulls 0.4.0, migrates, restarts uv tool upgrade siftwise # the CLI; or: pip install -U siftwise Then:
- Move your Action pins to
@v0.4.0, and the GitLab template tov0.4.0with its newintegrityhash. - Run the repo rollup once per repo (your CI's rollup or record step does it on the next run). That fills the new per-variant stats.
- Optional: store verdicts for CI runs uploaded before 0.4, so the new CI numbers count their failures:
siftwise outcomes backfill --repo acme/shop --dry-run # look first siftwise outcomes backfill --repo acme/shop Old and new clients mix. A 0.3 client against a 0.4 server works unchanged (its runs just have no recorded selection), and a 0.4 client against a 0.3 server falls back and says the server is older. I tested both directions from the real published 0.3.0.
Part 1: per-repo tokens
Until now there was one shared admin token for everything. v0.4 adds tokens per repo, each read or write.
Step 1.1: create the tokens
On the server host:
siftwise token create --repo acme/shop --scope write --name ci # prints the token once siftwise token create --repo acme/shop --scope read --name agents siftwise token list --active # never prints tokens siftwise token revoke 2 | Scope | Can |
|---|---|
read | select, triage, explain, report, history. Enough for coding agents, laptops and the dashboard |
write | all of that, plus uploading runs, rollups and recording selections. What CI needs |
Step 1.2: use them
Put the write token in your CI secret (SIFTWISE_TOKEN), and give agents the read one.
- Only each token's SHA-256 is stored, never the token.
- With a
readtoken, CI still selects tests, but warns once that the selection wasn't recorded. -
SIFTWISE_API_TOKENkeeps working as the admin token, so nothing breaks if you skip this. - On Windows, use
--all-reposinstead of--repo '*': Click expands the*into file names there.
Part 2: the dashboard, and every CI selection recorded
Until v0.3, siftwise recorded what it selected only in shadow mode. A normal CI run left no trace of what siftwise did.
v0.4 records every CI selection: the tests it picked, in what order, why it ran the full suite when it did, the estimated and measured test time, and, for each failure, whether the selection ran it and at what rank. All of it shows up in a read-only web dashboard.
Step 2.1: turn it on and sign in
It's off by default:
SIFTWISE_DASHBOARD=1 siftwise server start # then open http://localhost:8000/ui/ The login page asks for a token. Create a read token for it on the server host (as in Step 1.1):
siftwise token create --repo acme/shop --scope read --name dashboard # prints the token once Paste it on the login page. A read token sees only its repo and can't change anything; use --all-repos for one that sees every repo. The admin token (SIFTWISE_API_TOKEN) also works, but it's better kept for the server itself.
Step 2.2: put it behind HTTPS
The login cookie is Secure, so the dashboard needs HTTPS, except on localhost. Behind a TLS reverse proxy, tell the server the proxy's address:
SIFTWISE_DASHBOARD=1 siftwise server start --host 0.0.0.0 --forwarded-allow-ips 10.0.0.2 What it shows
- Overview: the CI numbers for main and pull requests, plus shadow-mode recall week by week.
- CI: the same numbers per UTC day or week, with the slowest tests.
- Runs and a page per run: "what siftwise did", the highest-risk tests and why, and each failure's verdict.
- Flaky tests, with
known_flakyentries to paste.
It's server-rendered, with no JavaScript and a strict Content-Security-Policy. And every page says how much it covers, like "selections recorded for 80 of 112 CI runs", so partial data never looks complete.
The same numbers come from GET /repos/{repo}/ci and siftwise report, which now also has --csv.
The number I almost got wrong
The dashboard shows test time saved. My first version compared each run against the sum of every test's average duration. On an rdflib replay it reported 13.4 hours saved while 99.3% of tests were selected. That's impossible.
The cause: rdflib runs its tests in a matrix of 18 legs, and the legs run different tests. Summing every test's average charged each leg for tests it never runs.
The fix: compare each leg with the same leg's own recent full-suite runs. To check it, I applied the formula to full-suite runs, where nothing was skipped and the true saving is zero. The median came out at +0.6%, with the middle half between −22% and +11% (213 of 301 legs). So no bias left, but about ±20% noise per leg, and the dashboard flags any figure based on fewer than 5 runs.
Part 3: mutation-tested recall
The hardest question for a test-selection tool: does it skip a test that would have caught your bug? Replays of real CI history (posts 1 to 3) answer it only for bugs that happened to show up. So for v0.4 I planted bugs (mutants) on the lines real merged PRs changed, ran the full suite to see which mutants it catches, and checked whether siftwise's selection caught the same ones.
The numbers
| Repo | Killed mutants the selection caught | 95% interval | In narrow selections |
|---|---|---|---|
| rdflib (Python) | 26 of 26 | 87.1–100% | none were narrow |
| Cirq (Python) | 63 of 63 | 94.3–100% | 13 of 13 |
| mobx (Jest) | 40 of 40 | 91.2–100% | 6 of 6 |
| ktlint (Kotlin) | 28 of 28 | 87.9–100% | 13 of 13 |
| moshi (Kotlin + Java, partial run) | 15 of 15 | 79.6–100% | 3 of 3 |
How to read it honestly:
- "Narrow" means the selection ran fewer tests than the full suite. A selection that runs everything catches everything, so the narrow ones are the real evidence.
- These are small samples. That's why the table shows 95% intervals: zero misses in 28 doesn't prove zero misses forever.
- It took hours: rdflib 1.83 h, mobx 1.35 h, ktlint 2.54 h, and Cirq 6.98 h (in a Linux container, because it hung on Windows).
Full method and every number: docs/eval-results.md.
Part 4: Kotlin, and the build files real repos use
Java selection now understands Kotlin sources and tests, with links in both directions in mixed Java/Kotlin projects. It's a small parser, with no compiler or JVM: packages, imports, declared types and top-level functions.
Step 4.1: the workflow
Same as Java in post 3: point record at the Gradle or Maven reports, and pin @v0.4.0:
- if: always() uses: PramodBasavarajMenasi/siftwise/actions/record@v0.4.0 with: server-url: ${{ secrets.SIFTWISE_URL }} token: ${{ secrets.SIFTWISE_TOKEN }} junit: "**/target/surefire-reports/TEST-*.xml **/build/test-results/test/*.xml" The numbers, and a surprise
I took 5 public Kotlin repos and checked what siftwise would select for each one's 5 most recent PRs. The result: 0 narrow selections out of 25. Not because of Kotlin, but because of how the builds were set up: Kotlin Multiplatform, includeBuild("build-logic"), an Android project, a non-literal path.
The most common blocker was includeBuild for convention plugins, which most modern Gradle builds use. siftwise gave up on any build with an included build. v0.4 now accepts an included build that only supplies plugins, and treats a change inside it as a build-file change (full suite, like buildSrc).
After that, ktlint went from 0 of 5 to 3 of 5 narrow selections, each running about 4% of its test classes, and the mutation run in Part 3 caught 28 of 28.
Still the full suite, each with a stated reason: Groovy, Scala, Kotlin Multiplatform, kapt/KSP modules and Android builds.
Part 5: untested_changes, a new tool for coding agents
siftwise already gives coding agents select_tests, triage_failure and explain over MCP. v0.4 adds untested_changes: before an agent finishes, it can ask which of the files it changed have no linked test, and get the nearest existing test file to extend.
Step 5.1: set it up
Nothing new to install: it comes with the MCP server. For Claude Code:
claude mcp add siftwise --env SIFTWISE_SERVER=https://siftwise.example.com \ --env SIFTWISE_API_TOKEN=your-read-token -- siftwise mcp Other agents: Coding agents (MCP).
- "Linked" means exactly what selection uses (import graphs and history), not line coverage, and the tool says so.
- It reuses the selector's own code, and a test proves
select_testsdidn't change: 380 of 380 selections identical.
Part 6: platforms and matrices
The Action on macOS and Windows
A new workflow runs the real actions on ubuntu-latest, macos-latest and windows-latest against a real server. Windows found two real problems:
- 🔴 CRLF outputs: on Windows, the CLI wrote its step outputs with CRLF line endings, which could leave a
\ron the test command. Now it's LF everywhere. - The disappearing server: in my test workflow, the Windows runner stops every process a step started when that step ends. The server finished starting, then silently died. It took four rounds to see it; the fix was to start it outside the step's process tree.
arm64
The server image is now published for linux/arm64 as well as linux/amd64. It was tested under QEMU emulation, not on real arm64 hardware.
Per-variant estimates for matrices
/select now estimates and packs a time budget using that leg's own tests and durations. On rdflib's 55 full-suite legs, estimated ÷ measured time went from a median of 2.23 to 1.15, and legs within 20% went from 6 of 55 to 32 of 55.
Set the same variant on the select step as on record. The full matrix example, for GitHub and GitLab: Matrix.
Part 7: test fixtures and flaky tests
Step 7.1: mark your test data
The dogfooding finding from post 3: siftwise's own tests include small sample projects, and their build files forced the full suite. Now you can mark test data in .siftwise.toml:
fixtures = ["tests/fixtures/**"] # test data: its build files don't force the full suite A change there runs the tests that reference the file. On siftwise's own CI, a fixture-only change would run 32 of 40 test files instead of all of them.
Step 7.2: find flaky tests, and let entries expire
siftwise flaky --repo acme/shop lists tests that failed and passed on the same commit, with known_flaky entries to paste. Entries can now expire, so a "temporary" flaky mark doesn't stay forever:
known_flaky = ["tests/test_net.py", { test = "tests/test_db.py::test_pool", until = "2026-12-31" }] Part 8: keeping the database small
Nothing used to be deleted. v0.4 adds siftwise server prune. It can't be undone, so back up first.
siftwise server prune --older-than 180d --dry-run # count first siftwise server prune --older-than 180d # then delete Or on a schedule: set SIFTWISE_RETENTION_DAYS=180 on the server.
- It deletes old CI runs and everything that belongs to them, in resumable batches.
- It always keeps what selection, triage and the stats need, so the cutoff can't be shorter than 120 days with the defaults.
- On a copy with 6.4M test results, it deleted about 1.5M of them in under 10 seconds.
Part 9: two features that didn't work
I planned two features to narrow Python selections in big repos. Both ended as honest negative results.
Re-export hubs (#100). In Cirq, cirq/__init__.py re-exports almost everything, so a change deep inside reaches most tests. I built name resolution through re-exports. It kept every mutant caught (63 of 63), but Cirq's median share of tests selected only went from 99.5% to 99.0%: most Cirq tests use cirq.Circuit, which really does import the simulators. It ships off by default, as an experimental setting ([python] reexports = "resolve").
String-named plugins (#101). rdflib picks its parsers and serializers at run time, from the file's content type, its suffix, or a default. So siftwise can't know which plugin a test uses without running it. Only 1 of 12 sampled changes could have narrowed, so I documented it as a limit instead of building it.
Going further would need per-test coverage, not a finer static graph.
Part 10: fixes
🔴 marks the ones that made siftwise silently get something wrong:
- 🔴 Shadow selections stopped being stored after 10 on a long-lived database connection, so shadow recall was undercounted.
- 🔴 CRLF in the Action's outputs on Windows (Part 6).
- A Gradle module with an extra source folder outside
sourceSetsis now marked unanalysed, so its tests run in full instead of being selected without that folder. -
go listruns with-mod=readonlyunless the module is vendored, and Go workspace vendoring is preserved (both from contributors). - The CI page no longer fails when a CI runner's clock is ahead of the server's.
- Revoking a token ends its dashboard sessions at once.
- ARCHITECTURE.md's diagrams render on GitHub again.
What building v0.4 taught me
- Test a number on data where you know the answer. The 13.4-hour bug and the disappearing Windows server were both invisible until I checked against something known.
- Real repos break assumptions faster than features do. Kotlin support worked on day one; it was
includeBuildthat stopped it from helping anyone. - Negative results are results. Writing down why #100 and #101 don't work is more useful to the next person than a feature that narrows nothing.
- Finishing is a feature. Folding v0.5 into v0.4 and calling it complete made the last month far more focused.
Community
Thank you to the five people who sent PRs for v0.4:
- @shounakjoshi88-a11y:
go listwith-mod=readonly(#68) - @jaesungkr: Go workspace vendoring (#83)
- @Abhaii11: the dashboard's date range (#94)
- @aliarham13:
siftwise report --csv(#97) - @cisheengai: the CI matrix example (#93)
siftwise's MCP server is also listed in the HOL Guard MCP server catalog and on Glama.
Troubleshooting
| You see | Fix |
|---|---|
| CI warns "the selection wasn't recorded" | the CI token is read: give CI a write token (Step 1.2) |
| A run page says "no selection recorded" | that run came from a client older than 0.4: move your pins to @v0.4.0 |
| The dashboard login fails | use HTTPS (or localhost); behind a proxy, set --forwarded-allow-ips (Step 2.2) |
| Time saved says "too few runs" | it needs at least 5 counted runs, and each leg needs 3 full-suite runs of its variant in the last 30 days |
| A Kotlin repo always runs the full suite | check the reason in the output: Multiplatform, kapt/KSP or a non-plugin includeBuild |
untested_changes says the server is too old | upgrade the server to 0.4.0 |
prune refuses the cutoff | it's under the minimum (120 days with the defaults) |
| The server restarts with "Can't locate revision" | you went back to an older image after migrating: never downgrade |
Known limits
- Recall comes only from shadow runs. In a selective run, tests that weren't selected didn't run, so a miss there is invisible.
- "Linked" is not line coverage. siftwise links tests by imports and history.
- Hub modules keep selections wide. Savings follow package boundaries: on rdflib an estimated 0.6% of test time was skipped, and that's the correct answer for its structure.
- Some builds always run the full suite: Groovy, Scala, Kotlin Multiplatform, kapt/KSP, Android.
- GitLab's select step runs once per pipeline, so there's no per-leg selection there.
- Dogfooding: still no failing run, so no live recall.
- Everything else: Known limits.
What's next
Nothing big, on purpose. siftwise is feature-complete and maintained for bug and security fixes. If you'd like to contribute, the good first issues are the place to start, and I review every PR.
Links
- 🌐 Website: https://pramodbasavarajmenasi.github.io/siftwise-site/
- 💻 GitHub: https://github.com/PramodBasavarajMenasi/siftwise
- 📦 PyPI: https://pypi.org/project/siftwise/
- 📝 Release notes: https://github.com/PramodBasavarajMenasi/siftwise/releases/tag/v0.4.0
- 📊 All eval numbers and method: https://github.com/PramodBasavarajMenasi/siftwise/blob/main/docs/eval-results.md
- 📖 Post 1 (server and GitHub Action): https://dev.to/pm_22/i-built-siftwise-run-only-the-tests-your-change-needs-open-source-self-hosted-51jf
- 📖 Post 2 (GitLab CI and coding agents): https://dev.to/pm_22/siftwise-v02-run-it-on-gitlab-ci-and-with-5-coding-agents-full-setup-guide-o2f
- 📖 Post 3 (risk order, budgets, Jest and Java): https://dev.to/pm_22/siftwise-v03-riskiest-tests-first-time-budgets-jest-and-java-selection-and-live-dogfooding-2b0c
Try it, break it, tell me
Run siftwise in shadow mode on your repo for a week: the full suite still runs, and you get a measured answer to "what would it have caught, and what would it have saved?" Misses make the best bug reports. And if it's useful, a ⭐ helps a small project get seen. 👇