regression_watchdog

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 7 Imported by: 0

README

Regression Watchdog (pkg/core/tools/regression_watchdog)

The Regression Watchdog guards against unintended changes by comparing current API behavior against a known stable baseline.

Key Tool: check_regression

This tool executes validation checks against a previous "snapshot" of the API.

Features
  • Baseline Comparison: Compares status codes, headers, and body structure against a stored baseline.
  • Drift Detection: Alerts on changes in response times or payload sizes beyond a threshold.
  • Snapshot Management: Automatically updates the baseline when changes are approved.

Usage

Use this as a safety net before a deployment to catch "silent" breakage in existing endpoints.

Example Prompts

Trigger this tool by asking:

  • "Check for regressions against the 'stable_v1' baseline."
  • "Verify that the latest changes didn't break existing functionality."
  • "Run a regression test on the user endpoints."

Documentation

Overview

Package regression_watchdog provides baseline comparison and regression detection for ZAP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIBaseline

type APIBaseline struct {
	Name      string                         `json:"name"`
	CreatedAt time.Time                      `json:"created_at"`
	Snapshots map[string]shared.HTTPResponse `json:"snapshots"`
}

APIBaseline represents a stored snapshot of API behavior.

type BaselineStore

type BaselineStore struct {
	FalconDir string
}

BaselineStore manages the persistence of API snapshots.

func NewBaselineStore

func NewBaselineStore(falconDir string) *BaselineStore

NewBaselineStore creates a new baseline manager.

func (*BaselineStore) Load

func (s *BaselineStore) Load(name string) (*APIBaseline, error)

Load retrieves a baseline from disk.

func (*BaselineStore) Save

func (s *BaselineStore) Save(b APIBaseline) error

Save persists a baseline to disk.

type DiffEngine

type DiffEngine struct {
	// contains filtered or unexported fields
}

DiffEngine compares current API responses against baseline snapshots.

func (*DiffEngine) Check

func (e *DiffEngine) Check(baseline *APIBaseline, filter []string) RegressionResult

Check identifies behavioral changes between live API and the baseline.

type Regression

type Regression struct {
	Endpoint    string `json:"endpoint"`
	ChangeType  string `json:"change_type"` // status_code, body_diff, response_time
	Description string `json:"description"`
}

Regression represents a detected behavioral change.

type RegressionParams

type RegressionParams struct {
	BaseURL      string   `json:"base_url"`                   // Current API URL
	BaselineName string   `json:"baseline_name"`              // Name of the snapshot to compare against
	Endpoints    []string `json:"endpoints,omitempty"`        // Specific endpoints to verify
	SaveBaseline bool     `json:"save_as_baseline,omitempty"` // Whether to update the baseline after check
}

RegressionParams defines parameters for checking regressions.

type RegressionResult

type RegressionResult struct {
	BaselineDate string       `json:"baseline_date"`
	Regressions  []Regression `json:"regressions"`
	StableCount  int          `json:"stable_count"`
	Summary      string       `json:"summary"`
}

RegressionResult represents the outcome of the comparison.

type RegressionWatchdogTool

type RegressionWatchdogTool struct {
	// contains filtered or unexported fields
}

RegressionWatchdogTool compares current API behavior against a stored baseline.

func NewRegressionWatchdogTool

func NewRegressionWatchdogTool(falconDir string, httpTool *shared.HTTPTool) *RegressionWatchdogTool

NewRegressionWatchdogTool creates a new regression watchdog tool.

func (*RegressionWatchdogTool) Description

func (t *RegressionWatchdogTool) Description() string

func (*RegressionWatchdogTool) Execute

func (t *RegressionWatchdogTool) Execute(args string) (string, error)

func (*RegressionWatchdogTool) Name

func (t *RegressionWatchdogTool) Name() string

func (*RegressionWatchdogTool) Parameters

func (t *RegressionWatchdogTool) Parameters() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL