appflows

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 23 Imported by: 0

Documentation

Overview

Package appflows composes experimental, caller-reported application behavior evidence.

Index

Constants

View Source
const (
	IntentProfile   = "application-flow-intent/0"
	EvidenceProfile = "application-flow-evidence/0"
	ReportProfile   = "application-flow-report/0"
	MaxBytes        = 5 << 20
	MaxSources      = 128
)

Variables

This section is empty.

Functions

func Decode

func Decode(data []byte, out any) error

Decode rejects duplicate keys, excessive depth, unknown fields and secret-shaped content.

func Digest

func Digest(b []byte) string

func ReadFile

func ReadFile(filename string) ([]byte, error)

func Record

func Record(in Input, raw []byte, filename string) error

Record is explicit opt-in learning: a new private artifact, never an implicit index update.

func ValidateEvidence

func ValidateEvidence(in Input, e Evidence) error

func ValidateManifest

func ValidateManifest(m Manifest) error

func ValueDigest

func ValueDigest(v json.RawMessage) string

Types

type Action

type Action struct {
	Kind     string `json:"kind"`
	Selector string `json:"selector,omitempty"`
	Value    string `json:"value,omitempty"`
}

type Anchor

type Anchor struct {
	Path   string `json:"path"`
	Line   int    `json:"line"`
	Digest string `json:"digest"`
}

type Assertion

type Assertion struct {
	Kind       string `json:"kind"`
	Selector   string `json:"selector"`
	WantDigest string `json:"wantDigest"`
	Anchor     Anchor `json:"anchor"`
}

type Binding

type Binding struct {
	Tree           string            `json:"tree"`
	ManifestDigest string            `json:"manifestDigest"`
	Sources        map[string]string `json:"sources"`
	FrontendDigest string            `json:"frontendDigest"`
	BackendDigest  string            `json:"backendDigest"`
	Fixture        string            `json:"fixture"`
}

type Candidate

type Candidate struct {
	ID        string   `json:"id"`
	Basis     string   `json:"basis"`
	Route     string   `json:"route"`
	Actions   []Action `json:"actions"`
	Source    Anchor   `json:"source"`
	Freshness string   `json:"freshness"`
}

Candidate is an inferred multi-step journey, independent of the supplied intent inventory.

type Check

type Check struct {
	ID       string          `json:"id"`
	Kind     string          `json:"kind"`
	Selector string          `json:"selector,omitempty"`
	Path     string          `json:"path,omitempty"`
	Pointer  string          `json:"pointer,omitempty"`
	Want     json.RawMessage `json:"want"`
}

type CheckResult

type CheckResult struct {
	ID      string `json:"id"`
	Outcome string `json:"outcome"`
	Layer   string `json:"layer"`
}

type Control

type Control struct {
	ID        string `json:"id"`
	Kind      string `json:"kind"`
	Selector  string `json:"selector"`
	State     string `json:"state"`
	Exercised bool   `json:"exercised"`
}

type Coverage

type Coverage struct {
	Check      string   `json:"check"`
	State      string   `json:"state"`
	Tests      []string `json:"tests"`
	Assertions []Anchor `json:"assertions"`
}

type Evidence

type Evidence struct {
	Profile           string    `json:"profile"`
	Authority         string    `json:"authority"`
	Binding           Binding   `json:"binding"`
	RunID             string    `json:"runId"`
	Mode              string    `json:"mode"`
	Parser            string    `json:"parser"`
	ProviderDigest    string    `json:"providerDigest"`
	NodeVersion       string    `json:"nodeVersion"`
	PlaywrightVersion string    `json:"playwrightVersion"`
	Browser           string    `json:"browser"`
	Tests             []Test    `json:"tests"`
	InventoryComplete bool      `json:"inventoryComplete"`
	Controls          []Control `json:"controls"`
	Runs              []Run     `json:"runs"`
	Gaps              []string  `json:"gaps"`
	Cleanup           bool      `json:"cleanup"`
	CleanupScope      string    `json:"cleanupScope"`
	BrowserClosed     bool      `json:"browserClosed"`
	ServerExited      bool      `json:"serverExited"`
}

func Observe

func Observe(ctx context.Context, root, manifestPath, assets string, live bool) (Evidence, error)

Observe runs only the explicitly selected optional provider, never a core read path.

type Flow

type Flow struct {
	ID           string        `json:"id"`
	Role         string        `json:"role"`
	RoleIdentity string        `json:"roleIdentity"`
	Basis        string        `json:"basis"`
	Coverage     []Coverage    `json:"coverage"`
	Runtime      string        `json:"runtime"`
	Checks       []CheckResult `json:"checks"`
	Gaps         []string      `json:"gaps"`
	Next         string        `json:"next"`
}

type Input

type Input struct {
	Manifest Manifest `json:"manifest"`
	Binding  Binding  `json:"binding"`
	Sources  []Source `json:"sources"`
	Root     string   `json:"root"`
	Observe  bool     `json:"observe"`
	RunID    string   `json:"runId"`
}

Input is passed over stdin to the optional parser/observer; sources never execute in scan mode.

func Capture

func Capture(ctx context.Context, root, manifestPath string) (Input, error)

Capture rejects uncommitted declared inputs; unrelated working-tree edits confer no evidence.

type Manifest

type Manifest struct {
	Profile       string     `json:"profile"`
	Application   string     `json:"application"`
	Origin        string     `json:"origin"`
	Sources       []string   `json:"sources"`
	Tests         []string   `json:"tests"`
	BackendSource string     `json:"backendSource"`
	Fixture       string     `json:"fixture"`
	IdentityPath  string     `json:"identityPath"`
	ResetPath     string     `json:"resetPath"`
	Server        []string   `json:"server"`
	Scenarios     []Scenario `json:"scenarios"`
}

type Report

type Report struct {
	Profile        string      `json:"profile"`
	Authority      string      `json:"authority"`
	Application    string      `json:"application"`
	Binding        Binding     `json:"binding"`
	Freshness      string      `json:"freshness"`
	RunID          string      `json:"runId"`
	ProviderDigest string      `json:"providerDigest"`
	Flows          []Flow      `json:"flows"`
	Candidates     []Candidate `json:"candidates"`
	Discovered     []Control   `json:"discovered"`
	Frontier       []string    `json:"frontier"`
	Complete       bool        `json:"complete"`
}

func ReportFor

func ReportFor(in Input, e *Evidence) (Report, error)

type Run

type Run struct {
	Scenario        string        `json:"scenario"`
	Outcome         string        `json:"outcome"`
	Checks          []CheckResult `json:"checks"`
	States          []string      `json:"states"`
	IdentityMatched bool          `json:"identityMatched"`
}

type Scenario

type Scenario struct {
	ID      string   `json:"id"`
	Role    string   `json:"role"`
	Path    string   `json:"path"`
	Basis   string   `json:"basis"`
	Actions []Action `json:"actions"`
	Checks  []Check  `json:"checks"`
}

type Source

type Source struct {
	Path string `json:"path"`
	Text string `json:"text"`
}

type Test

type Test struct {
	ID         string      `json:"id"`
	Anchor     Anchor      `json:"anchor"`
	Route      string      `json:"route"`
	Actions    []Action    `json:"actions"`
	Assertions []Assertion `json:"assertions"`
	Complete   bool        `json:"complete"`
}

Jump to

Keyboard shortcuts

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