Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.2.0 instead.

titer

Check whether a change's tests test the change: fail-on-base, diff-scoped mutation, weakened-test scan, and CRAP, as a CLI any agent can call.

titer check gathers evidence on one question about the diff against a base ref: do the tests in this change test the change? It cannot show that the change is correct. A test that fails on base detects a difference from base, and a reviewer still checks that the difference is the intended one. titer prints a JSON report and exits with the gate's code. It never wraps the agent and contains no model. Agents call it, read the JSON, and decide what to do.

Tier What it does
scan Finds weakened tests: deleted tests, removed assertions, added skips, loosened matchers, and changed snapshots.
prove Runs the changed tests against the base code and classifies each one.
mutate Mutates changed source lines and runs the changed tests against each mutant.
crap Scores each changed function by complexity and coverage. Informational.

titer parses Python and TypeScript/TSX (and JavaScript) with tree-sitter, and runs pytest, unittest, and vitest. It is one Rust binary for Linux and macOS.

Install

Install titer as a dev dependency of the repo, so every agent and CI job runs the version the repo pins:

Ecosystem Install Run
npm npm install --save-dev titer npx titer check
Python with uv uv add --dev titer uv run titer check
Rust cargo install titer titer check

Each GitHub release also has binaries for Linux x64 and arm64 and macOS arm64 and x64.

Opt in

npx titer init       # or: uvx titer init

init detects the repo's runners and writes four things for you to review and commit:

  • titer.toml, with one [[runner]] per project (a monorepo gets several)
  • a pinned titer dev dependency in package.json or pyproject.toml
  • the repo skill in .agents/skills/titer/SKILL.md (Codex, Cursor, OpenCode) and .claude/skills/titer/SKILL.md (Claude Code)

The skill tells agents when to run check, how to read the report, how to triage survivors, and never to weaken a test to pass. init --dry-run prints the plan without writing. init --update rewrites the skill and the pin after an upgrade; check warns when they are out of date.

titer never runs in a repo without titer.toml: check exits 2 and tells the caller to run titer init.

Check

titer check [--base REF] [--only scan,prove,mutate,crap] [--json]
            [--budget 120s] [--workers N] [--mutants FILE] [--coverage FILE] [--markdown FILE]

titer snapshots the working tree, including untracked files that are not ignored, and diffs it against the merge-base of HEAD and --base. --base defaults to base in titer.toml, then to the remote default branch. Tests run in temporary worktrees under the user cache dir ($TITER_TMPDIR overrides it), through the repo's own command and the runner's native selection: pytest node ids, unittest dotted ids, and vitest file:line. The checkout's status, index, stash, and worktree list never change, and titer kills its own process groups on exit, timeout, and SIGINT.

  • prove runs the changed tests on head, then on base with head's test files copied in. Each changed test gets a verdict: assertion or exception (the test fails on base, which the gate counts as proof), missing_symbol (it fails on base only because a name exists only in head), passes_on_base, skipped, no_result, or timeout.
  • mutate applies one mutant at a time to changed source lines: comparison, boolean, and arithmetic swaps, bool flips, int +1, removed not/!, return None/undefined, removed calls (never logging calls), removed raise/throw, negated if, and JSX attributes set to undefined. The head-green changed tests run against each mutant in parallel workers; with no changed tests, the suite runs instead. A canary first checks that the worktree loads the mutated code. A mutant whose code also appears in the base lines its hunk replaces gets unchanged_from_base: true, because the change may only have moved or reformatted that code. Survivors get two follow-ups: a sentinel raise before the line's statement (not_executed when nothing runs it), and a rerun of the whole changed test files (caught_by_other).
  • --mutants FILE adds agent-written mutants, one JSON object per line: {"file": "app.py", "line": 3, "end_line": 3, "replacement": " return x", "id": "optional"}.
  • crap scores changed functions with CRAP = comp^2 * (1 - cov)^3 + comp, from --coverage (lcov, Cobertura XML, or coverage.py JSON) or [crap] coverage_command.

Exit codes and the gate

  • 0: the gate passes.
  • 1: the gate fails.
  • 2: the check could not run: a changed test fails on head, the canary survives, a config error, or a git error.

By default the gate fails only on an unproven change: the change touches supported source lines, no changed test is proven, and the selected tests kill none of its mutants. Survivors, passes on base, scan findings, and CRAP fail the gate only when [gate] asks.

Configuration

base = "origin/main"            # optional default for --base

[[runner]]
name = "api"                    # unique; defaults to the kind
kind = "unittest"               # pytest, unittest, or vitest
cwd = "services/api"            # repo-relative; globs and paths below are relative to it
command = ["uv", "run", "--no-sync", "python", "-m", "unittest"]
start_dir = "tests"             # unittest only: the dir dotted ids are relative to
test_globs = ["**/test*.py"]    # files that contain tests (defaults per kind)
support_globs = ["tests/**"]    # other test-only files: copied to base, never mutated
deps = [".venv"]                # dependency dirs linked into worktrees (defaults per kind)
env = { PYTHON_DOTENV_DISABLED = "1" }

[[runner]]
name = "web"
kind = "vitest"
cwd = "clients/web"
command = ["npx", "--no-install", "vitest", "run"]

[gate]
fail_on_survivors = false
fail_on_passes_on_base = false
fail_on_scan = false
fail_on_crap = false

[mutate]
budget = "120s"                 # time budget for a whole check
exclude_operators = []          # for example ["remove_call"]
exclude_globs = []              # repo-relative source files never mutated
exclude_calls = []              # callees never removed, beyond logging calls

[crap]
coverage_command = ["uv", "run", "--no-sync", "coverage", "json", "-o", "coverage.json"]
coverage_file = "coverage.json" # written by coverage_command, relative to the repo root
threshold = 30

Python commands should not sync the environment (uv run --no-sync), because worktrees share the checkout's .venv.

GitHub Action

permissions:
  contents: read
  pull-requests: write # only for comment: true

# One run per pull request at a time, so two runs never post at once.
concurrency:
  group: titer-${{ github.event.pull_request.number }}
  cancel-in-progress: true

steps:
  - uses: actions/checkout@v4
    with:
      fetch-depth: 0
      # The pull request head, so annotations land on the right diff lines.
      ref: ${{ github.event.pull_request.head.sha }}
  # Install the repo's dependencies here.
  - uses: greerviau/titer@v0.1
    with:
      comment: true

The Action runs the repo's pinned titer (npx --no-install titer or uv run --no-sync titer) against the pull request's base branch and fails on exit 1 or 2. It reports in three places:

  • The job summary leads with the gate result (passed, failed, or could not run) and the evidence it rests on. It then lists survivors, lines no test runs, and weakened tests, with links to the pull request's head commit. A survivor whose code is unchanged from base says so. The full test and mutant tables are collapsed. The test table shows each changed test's failure on base, so a reviewer can check that the failure is the behavior the change targets.
  • With annotations: true (the default), survivors and weakened tests are warnings on their lines in the diff, and lines no test runs are notices.
  • With comment: true, the same summary is posted as a pull request comment whose heading names the commit checked. Each new head commit gets a new comment, and earlier titer comments collapse as outdated, so the newest result sits next to the newest push. A rerun on the same commit updates that commit's comment. This needs pull-requests: write. On pull requests from forks of a public repo, GitHub gives the token read access only, so the Action warns and skips the comment.

Annotations need the pull request head checked out, as above. The default pull_request checkout is a merge commit whose line numbers can differ, so the Action skips annotations there.

Other inputs: base, args, working-directory, command, and github-token. Outputs: exit-code, report (the JSON report's path), and summary (the Markdown's path).

Report

titer check --json prints a report that follows schema/report.schema.json: gate, tests, mutants, findings, crap, warnings, not_analyzed, and timing.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Metadata

Release files for titer 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for titer 0.1.0
File Size Uploaded Provenance Actions
titer-0.1.0.tar.gz 143.3 kB Without provenance Details for titer-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for titer 0.1.0
File Actions
titer-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for titer-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
titer-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details for titer-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
titer-0.1.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for titer-0.1.0-py3-none-macosx_11_0_arm64.whl
titer-0.1.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details for titer-0.1.0-py3-none-macosx_10_12_x86_64.whl

Total release size: 8.6 MB

Release files / titer-0.1.0.tar.gz

Download URL titer-0.1.0.tar.gz
Size 143.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8a9ca61eb074dbb12da7410eb5466746904c682fa12bcea710d1e94dbf8d7da7
BLAKE2b-256 checksum
How to use checksums
e2f04a14fb43429238d5649d2bf184d970e52ae0248c692c5ff57423974ef049
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / titer-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL titer-0.1.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 2.2 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
15b26c8334a4ff651bf08a8145ed518bc7245c863ef51f6a4db32963a073f749
BLAKE2b-256 checksum
How to use checksums
73d08f3afaeaa9dc79045fd2e65c9c3201fff38147be325b436ad920bf1b35bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / titer-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL titer-0.1.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 2.1 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
ba94f387efd626cb5f20364912ec7c65835d666f68031516f7404d64f4df9163
BLAKE2b-256 checksum
How to use checksums
dcdc4b7d115ac3d077bfa1d008245ef5e1d004e575fa91280eaf26bce0f8e5ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / titer-0.1.0-py3-none-macosx_11_0_arm64.whl

Download URL titer-0.1.0-py3-none-macosx_11_0_arm64.whl
Size 2.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bfc0f83a4d4e6d82890464686b618a51ce2be1e6aa2bb0cb7661442d634a54fd
BLAKE2b-256 checksum
How to use checksums
6fba0588d1de77bb785a21f85c06f860f50a7c4d7d10687a94424c60c0c2f0f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / titer-0.1.0-py3-none-macosx_10_12_x86_64.whl

Download URL titer-0.1.0-py3-none-macosx_10_12_x86_64.whl
Size 2.1 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
de2030ce3ea16d0b51a557b7981851ddd04633d4cad0ea72a32323dbce17b3f6
BLAKE2b-256 checksum
How to use checksums
d1fc174f579e3ad4f290b78c815fc5fcfeca2d96fb67f63bea308bdbd089367d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for titer 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page