approval

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalManager

type ApprovalManager struct {
	Store      *snapshot.SnapshotStore
	PendingDir string
}

ApprovalManager manages the approval workflow for updating snapshots.

func NewApprovalManager

func NewApprovalManager(store *snapshot.SnapshotStore, pendingDir string) *ApprovalManager

NewApprovalManager creates an ApprovalManager backed by the given store with pending diffs stored in pendingDir.

func (*ApprovalManager) ApproveAll

func (a *ApprovalManager) ApproveAll() (int, error)

ApproveAll iterates all pending diffs, updates the snapshot store with each live entry, and removes the pending files. Returns the count of approved diffs.

func (*ApprovalManager) ApproveByPattern

func (a *ApprovalManager) ApproveByPattern(pattern string) (int, error)

ApproveByPattern approves all pending diffs where at least one field diff path contains the given pattern string. Returns the count of approved diffs. This is useful for bulk-approving known field renames like "user_id -> userId".

func (*ApprovalManager) ApproveOne

func (a *ApprovalManager) ApproveOne(requestHash string) error

ApproveOne updates the snapshot for a single request hash and removes its pending file. Returns an error if the hash is not found.

func (*ApprovalManager) HasPendingDiffs

func (a *ApprovalManager) HasPendingDiffs() (bool, error)

HasPendingDiffs returns true if there are any pending diff files.

func (*ApprovalManager) ListPending

func (a *ApprovalManager) ListPending() ([]PendingDiff, error)

ListPending returns all pending PendingDiff entries from the pending directory.

func (*ApprovalManager) SavePending

func (a *ApprovalManager) SavePending(p PendingDiff) error

SavePending writes a PendingDiff to disk as {pendingDir}/{requestHash}.json.

type PendingDiff

type PendingDiff struct {
	RequestHash string                 `json:"request_hash"`
	Host        string                 `json:"host"`
	Live        snapshot.SnapshotEntry `json:"live"`
	Diffs       []diff.FieldDiff       `json:"diffs"`
}

PendingDiff represents a live response that differs from the stored snapshot.

Jump to

Keyboard shortcuts

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