characterize

package
v0.0.0-...-f985856 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package characterize produces bounded, deterministic compatibility evidence from generated PDFs. It is intentionally independent from the layout path: a fixture must first render, then this package inspects the committed output.

Index

Constants

View Source
const ReportSchemaVersion uint16 = 1

Variables

View Source
var (
	ErrInvalid = errors.New("characterize: invalid input")
	ErrLimit   = errors.New("characterize: limit exceeded")
)

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Name string
	PDF  []byte
}

type Fingerprint

type Fingerprint struct {
	GOOS      string `json:"goos"`
	GOARCH    string `json:"goarch"`
	GoVersion string `json:"go_version"`
	CPUs      int    `json:"cpus"`
}

func RuntimeFingerprint

func RuntimeFingerprint() Fingerprint

type FixtureEvidence

type FixtureEvidence struct {
	Name       string       `json:"name"`
	PDFVersion string       `json:"pdf_version"`
	SHA256     string       `json:"sha256"`
	Bytes      uint64       `json:"bytes"`
	Pages      uint32       `json:"pages"`
	Text       string       `json:"text"`
	PageText   []string     `json:"page_text"`
	Structure  PDFStructure `json:"structure"`
}

type Limits

type Limits struct {
	MaxFixtures   uint32
	MaxPDFBytes   uint64
	MaxTotalBytes uint64
	MaxTextBytes  uint64
	MaxNameBytes  uint32
	MaxJSONBytes  uint64
}

func DefaultLimits

func DefaultLimits() Limits

type PDFStructure

type PDFStructure struct {
	LinkAnnotations   uint32 `json:"link_annotations"`
	URIActions        uint32 `json:"uri_actions"`
	Destinations      uint32 `json:"destinations"`
	Widgets           uint32 `json:"widgets"`
	EmbeddedFiles     uint32 `json:"embedded_files"`
	Attachments       uint32 `json:"attachments"`
	StructureTrees    uint32 `json:"structure_trees"`
	MarkedContent     uint32 `json:"marked_content"`
	OutputIntents     uint32 `json:"output_intents"`
	StructureElements uint32 `json:"structure_elements"`
	ParentTrees       uint32 `json:"parent_trees"`
	AssociatedFiles   uint32 `json:"associated_files"`
	HasAcroForm       bool   `json:"has_acro_form"`
	HasTagMarkInfo    bool   `json:"has_tag_mark_info"`
	HasMetadata       bool   `json:"has_metadata"`
	HasLanguage       bool   `json:"has_language"`
	DisplaysTitle     bool   `json:"displays_title"`
	HasEmbeddedICC    bool   `json:"has_embedded_icc"`
	PDFUA2            bool   `json:"pdfua_2"`
	PDFA4             bool   `json:"pdfa_4"`
	PDFAConformance   string `json:"pdfa_conformance,omitempty"`
	ArlingtonRequired bool   `json:"arlington_required"`
}

PDFStructure records stable structural assertions used by compatibility baselines. Counts are taken from syntax tokens in the complete generated PDF; text order is independently extracted from page content streams.

type Report

type Report struct {
	SchemaVersion uint16            `json:"schema_version"`
	Command       string            `json:"command"`
	Fingerprint   Fingerprint       `json:"fingerprint"`
	Fixtures      []FixtureEvidence `json:"fixtures"`
}

func Build

func Build(ctx context.Context, artifacts []Artifact, command string, fingerprint Fingerprint, limits Limits) (Report, error)

func (Report) CanonicalJSON

func (report Report) CanonicalJSON(maxBytes uint64) ([]byte, error)

Jump to

Keyboard shortcuts

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