accuracy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package accuracy provides the synthetic, non-production credential corpus used for detector accuracy and differential tests.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fixture

type Fixture struct {
	RuleID   string
	Positive bool
	Ordinal  int
	Format   Format
	Value    string
}

Fixture is one positive or negative example. Value is deliberately kept opaque to test diagnostics: callers should identify fixtures using RuleID, Positive, Ordinal and Format, never by printing Value.

func All

func All() []Fixture

All returns a fresh copy of the corpus.

Example
package main

import (
	"fmt"

	"github.com/baum-ai/goredact/internal/accuracy"
)

func main() {
	corpus := accuracy.All()
	positive, negative := 0, 0
	for _, fixture := range corpus {
		if fixture.Positive {
			positive++
		} else {
			negative++
		}
	}
	fmt.Printf("fixtures=%d positive=%d negative=%d\n", len(corpus), positive, negative)
}
Output:
fixtures=511 positive=201 negative=310

type Format

type Format string

Format describes the kind of text surrounding a corpus fixture.

const (
	FormatAgentJSON    Format = "agent-session-json"
	FormatAgentJSONL   Format = "agent-session-jsonl"
	FormatShell        Format = "shell-output"
	FormatGitDiff      Format = "git-diff"
	FormatEnv          Format = "environment-dump"
	FormatHTTPRequest  Format = "http-request"
	FormatHTTPResponse Format = "http-response"
	FormatMinified     Format = "minified"
	FormatEscaped      Format = "escaped-content"
	FormatAdversarial  Format = "keyword-adversarial-log"
)

Jump to

Keyboard shortcuts

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