Skip to content
Kavach Labs
How it worksAtlasAtlasPricingPricingDocsDocsBlogBlogReleasesReleases
3
Esc

    ↑ ↓ to move↵ to open

    Get started

    • Overview
    • Installation
    • Quickstart
    • Concepts

    Guides

    • Instrument a service
    • Fix an incident
    • Build a feature
    • Write invariants
    • Run in CI
    • Flow maps
    • Use with AI agents

    SDKs

    • Overview
    • Go
    • Python
    • TypeScript
    • Other languages
    • No SDK? Use the protocols

    Reference

    • CLI
    • Verdicts
    • MCP tools
    • map.json
    • Journal format
    • Troubleshooting

    Benchmark

    • Methodology

    Enterprise

    • Overview
    • Install and upgrade
    • Deploy
    • Storage
    • Operations
    • Security
    • Data handling
    DocsRun in CI

    Get started

    • Overview
    • Installation
    • Quickstart
    • Concepts

    Guides

    • Instrument a service
    • Fix an incident
    • Build a feature
    • Write invariants
    • Run in CI
    • Flow maps
    • Use with AI agents

    SDKs

    • Overview
    • Go
    • Python
    • TypeScript
    • Other languages
    • No SDK? Use the protocols

    Reference

    • CLI
    • Verdicts
    • MCP tools
    • map.json
    • Journal format
    • Troubleshooting

    Benchmark

    • Methodology

    Enterprise

    • Overview
    • Install and upgrade
    • Deploy
    • Storage
    • Operations
    • Security
    • Data handling
    Kavach Labs

    A flight recorder for production software.

    Product

    How it worksPricingFor agentsAgent benchmarkRelease notes

    Developers

    DocsQuickstartSDKsCLI referenceAgent skillsEnterpriseBenchmarksSource

    Project

    BlogLicenseReport a bug
    © 2026 Kavach LabsPre-alpha · Apache 2.0
    Docs/Guides

    Run Kavach in CI

    Replay regression fixtures on every pull request, or verify a candidate fix across incident variants, with the Kavach GitHub Action or plain shell.

    kavach v0.2.0

    Once an incident is fixed, its fixture is the best regression test you have: it is the exact input that broke production. Check fixtures into the repository (for example under testdata/) and replay them on every pull request.

    GitHub Actions#

    The kavachlabs/kavach action installs kavach and kavach-recorder, runs every fixture, and writes a verdict table to the workflow summary.

    Replay regression fixtures#

    Set bin to replay each fixture against one build. The step fails unless every fixture replays ok or fixed.

    jobs:
      kavach:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v4
          - run: go build -o ./service ./cmd/service
          - uses: kavachlabs/kavach@v0.2.0
            with:
              fixtures: testdata/*.kavach
              bin: ./service

    Verify a fix across variants#

    Set old and new to run kavach diff on each fixture. Build the base branch and the pull request separately:

          - uses: actions/checkout@v4
            with: { fetch-depth: 0 }
          - run: |
              git worktree add ../base origin/${{ github.base_ref }}
              (cd ../base && go build -o "$GITHUB_WORKSPACE/service-base" ./cmd/service)
              go build -o ./service-pr ./cmd/service
          - uses: kavachlabs/kavach@v0.2.0
            id: kavach
            with:
              fixtures: testdata/incidents/*.kavach
              old: ./service-base
              new: ./service-pr
          - run: echo "verdict ${{ steps.kavach.outputs.verdict }}"

    Inputs and outputs#

    Input Default Meaning
    fixtures Glob or space-separated list of .kavach files.
    bin Host command to replay against (when old/new are not set).
    old Host command for the code that failed.
    new Host command for the candidate fix.
    variants 10 Minimum reproducing variants diff requires.
    regressions 48 Maximum regression variants diff checks; 0 skips them.
    Output Meaning
    verdict The last verdict reported.

    Any other CI#

    Install with the script, then use exit codes. Every command exits 0 on ok or fixed, 1 on any other verdict, 2 on a usage error and 3 when a fixture or binary cannot be used.

    curl -fsSL https://www.thekavachlabs.com/install.sh | sh -s -- --no-skills
    export PATH="$HOME/.local/bin:$PATH"
    for f in testdata/*.kavach; do
      kavach --no-banner replay "$f" --bin ./service
    done

    Set NO_COLOR=1 for plain logs. --json output is never styled.

    Inside the test suite#

    In Go, run fixtures as ordinary tests with kavachtest:

    import "github.com/kavachlabs/kavach/sdk/go/kavachtest"
     
    func TestFixtures(t *testing.T) {
    	kavachtest.Run(t, "testdata/*.kavach", func() kavach.Handler { return NewLedger() })
    }

    Each fixture becomes a subtest that passes when replay reports ok or fixed. Other languages can call kavach replay from their test runner the same way.

    When a fixture stops replaying#

    A fixture records one build's view of the world. If the handler's reads change on purpose (a new config key, a new query), old fixtures can start reporting nondeterministic@N or diverged@N. That is Kavach telling you the recorded behaviour changed. Decide whether the change is intended; if it is, record a fresh fixture for the incident rather than editing the old one.

    Something wrong or missing on this page? Report it on GitHub, or write to hello@thekavachlabs.com.

    PreviousWrite invariantsNextFlow maps

    On this page

    1. GitHub Actions
    2. Any other CI
    3. Inside the test suite
    4. When a fixture stops replaying
    View as Markdown