patchstack

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package patchstack exposes the local patch-series audit API.

Index

Constants

View Source
const (
	SchemaVersion                = contracts.SchemaVersion
	MaxManifestBytes             = contracts.MaxManifestBytes
	MaxArchiveBytes              = contracts.MaxArchiveBytes
	MaxPatches                   = contracts.MaxPatches
	MaxPatchBytes                = contracts.MaxPatchBytes
	MaxArchiveEntries            = contracts.MaxArchiveEntries
	MaxExtractedBytes            = contracts.MaxExtractedBytes
	MaxPatchLogBytes             = contracts.MaxPatchLogBytes
	PatchTimeoutSeconds          = contracts.PatchTimeoutSeconds
	NewFileMode                  = contracts.NewFileMode
	DirectoryMode                = contracts.DirectoryMode
	DigestDefinition             = contracts.DigestDefinition
	EvidenceLimitations          = contracts.EvidenceLimitations
	OutcomeReproduced            = contracts.OutcomeReproduced
	OutcomeFailed                = contracts.OutcomeFailed
	StageComplete                = contracts.StageComplete
	StageManifest                = contracts.StageManifest
	StageSource                  = contracts.StageSource
	StageInventory               = contracts.StageInventory
	StageTool                    = contracts.StageTool
	StageExecution               = contracts.StageExecution
	StageDigest                  = contracts.StageDigest
	StagePublication             = contracts.StagePublication
	StageOutput                  = contracts.StageOutput
	ReasonNone                   = contracts.ReasonNone
	ReasonInvalidManifest        = contracts.ReasonInvalidManifest
	ReasonHashMismatch           = contracts.ReasonHashMismatch
	ReasonInventoryMismatch      = contracts.ReasonInventoryMismatch
	ReasonPatchFailed            = contracts.ReasonPatchFailed
	ReasonUnsafeInput            = contracts.ReasonUnsafeInput
	ReasonLimitExceeded          = contracts.ReasonLimitExceeded
	ReasonIO                     = contracts.ReasonIO
	ReasonToolUnavailable        = contracts.ReasonToolUnavailable
	ReasonUnsupportedTool        = contracts.ReasonUnsupportedTool
	ReasonTimeout                = contracts.ReasonTimeout
	ReasonCancelled              = contracts.ReasonCancelled
	ReasonOutputExists           = contracts.ReasonOutputExists
	ReasonUnsupportedPublication = contracts.ReasonUnsupportedPublication
	ReasonOutputWrite            = contracts.ReasonOutputWrite
	PatchNotRun                  = contracts.PatchNotRun
	PatchApplied                 = contracts.PatchApplied
	PatchFailed                  = contracts.PatchFailed
)

Variables

This section is empty.

Functions

func WriteJSON

func WriteJSON(w io.Writer, report Report) error

WriteJSON writes a validated version 1 report as indented JSON followed by a newline. It preserves declared patch order, performs no audit operations and writes nothing if the report is invalid. Writer errors remain discoverable with errors.Is through a RunError with stage output and reason output_write_failure.

func WriteMarkdown

func WriteMarkdown(w io.Writer, report Report) error

WriteMarkdown writes a validated version 1 report as deterministic Markdown. Supplied text is escaped as literal text, including provenance URLs; it cannot introduce links, HTML or report structure. Final tree evidence appears only for a complete reproduced report. Invalid reports write nothing. Writer errors remain discoverable with errors.Is through an output/output_write_failure RunError.

Types

type Failure

type Failure = contracts.Failure

type FileRecord

type FileRecord = contracts.FileRecord

type Manifest

type Manifest = contracts.Manifest

func LoadManifest

func LoadManifest(reader io.Reader) (Manifest, error)

LoadManifest reads at most 1 MiB of one strict version 1 YAML document. It rejects duplicate/unknown fields, aliases/anchors, coercions and extra documents. It performs no filesystem, process, publication or network operations. Input paths are checked lexically here; Audit also checks filesystem confinement.

type Options

type Options = contracts.Options

type Outcome

type Outcome = contracts.Outcome

type Patch

type Patch = contracts.Patch

type PatchResult

type PatchResult = contracts.PatchResult

type PatchStatus

type PatchStatus = contracts.PatchStatus

type Reason

type Reason = contracts.Reason

type Report

type Report = contracts.Report

func Audit

func Audit(ctx context.Context, manifest Manifest, options Options) (report Report, retErr error)

Audit verifies local inputs, strictly applies the complete ordered series and atomically publishes OutputDir/source, report.json and report.md. OutputDir must be absent, outside InputRoot, with an existing parent on Linux supporting atomic no-replace rename. No original input is modified and no network is used. PatchExecutable defaults to "patch"; real GNU patch is required even for an empty series. All fixed v1 limits apply to direct library callers as well.

A valid manifest always produces a portable report. Integrity, inventory and application failures return a failed report and nil error; operational failures additionally return *RunError. Invalid manifests return no report. Before publication, any failure removes the private temporary sibling. A successful report is returned only after the complete output has been published; callers must retain that output if their subsequent report/stdout write fails.

type RunError

type RunError = contracts.RunError

type Source

type Source = contracts.Source

type Stage

type Stage = contracts.Stage

Jump to

Keyboard shortcuts

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