analysis

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 11 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 analysis provides conservative proofs about checked payload contracts. It never guesses arbitrary predicate equivalence or treats unknown as success.

Index

Constants

View Source
const ContractSyntaxVersion = "refine.contract-syntax/v2"
View Source
const OperationCompatibilityVersion = "refine.operation-compatibility/v1"

Variables

This section is empty.

Functions

This section is empty.

Types

type Compatibility

type Compatibility struct {
	Fingerprint string  `json:"fingerprint"`
	Backward    Finding `json:"backward"` // Every old accepted payload is accepted by new.
	Forward     Finding `json:"forward"`  // Every new accepted payload is accepted by old.
}

func Compare

func Compare(oldProgram *language.Program, oldRoot string, newProgram *language.Program, newRoot string, limits validation.Limits) (Compatibility, error)

Compare considers accepted payload sets, not Java API/ABI or native wire compatibility. Interval inclusion proofs concern logical constraints with sufficient resources; equal budgets do not imply equal execution costs. Native format, API context and publication policy require their own analysis.

type ContractSyntaxEvidence

type ContractSyntaxEvidence struct {
	Version              string             `json:"version"`
	BaselineFingerprint  string             `json:"baselineFingerprint"`
	CandidateFingerprint string             `json:"candidateFingerprint"`
	Equal                bool               `json:"equal"`
	Differences          []SyntaxDifference `json:"differences"`
}

func CompareContractSyntax

func CompareContractSyntax(baseline *language.Program, baselineRoot string, candidate *language.Program, candidateRoot string) (ContractSyntaxEvidence, error)

CompareContractSyntax proves only identical canonical checked language syntax, ignoring comments, source positions and layout. It retains roots, publication packages, imports, declaration/field/equation order, signatures, predicates, diagnostic codes/messages and budgets. A difference is not a proof of changed accepted values: arbitrary predicate equivalence remains undecidable. Callers must separately compare native resources, wire metadata, dependency identities and generated APIs before approving documentation-only release classifications.

func CompareOperationContractSyntax

func CompareOperationContractSyntax(baseline, candidate OperationContract) (ContractSyntaxEvidence, error)

CompareOperationContractSyntax proves exact equality of the canonical checked module and the complete operation/root inventory. It is useful only as one input to documentation classification; native resources and APIs are outside this evidence.

type Finding

type Finding struct {
	Outcome     Outcome `json:"outcome"`
	Code        string  `json:"code"`
	Explanation string  `json:"explanation"`
}

func Satisfiable

func Satisfiable(program *language.Program, root string, limits validation.Limits) (Finding, error)

Satisfiable proves contradictions in numeric bounds or validates a concrete candidate. Failure to find a candidate is unknown, never unsatisfiable.

type OperationCompatibility

type OperationCompatibility struct {
	Fingerprint string  `json:"fingerprint"`
	Backward    Finding `json:"backward"`
	Forward     Finding `json:"forward"`
}

func CompareOperations

func CompareOperations(baseline, candidate OperationContract, limits validation.Limits) (OperationCompatibility, error)

CompareOperations compares a server operation surface without fabricating a payload root. Backward compatibility requires the candidate server to accept baseline requests, while every candidate response must remain acceptable to baseline consumers. Forward compatibility reverses both inclusions. Native schema/resource and generated-API compatibility remain separate. Inputs are capped at 4,096 operations/responses and 64 MiB of canonical source plus operation strings before defensive copies are allocated.

type OperationContract

type OperationContract struct {
	Program    *language.Program
	Operations []OperationEntrypoint
}

type OperationEntrypoint

type OperationEntrypoint struct {
	OperationID string
	Method      string
	Path        string
	RequestRoot string
	Responses   []OperationResponseEntrypoint
}

type OperationResponseEntrypoint

type OperationResponseEntrypoint struct {
	Status       string
	ResponseRoot string
	ContextRoot  string
}

OperationResponseEntrypoint identifies one checked response status. ContextRoot is a relational request-response contract, not a marginal response contract.

type Outcome

type Outcome string
const (
	Yes     Outcome = "yes"
	No      Outcome = "no"
	Unknown Outcome = "unknown"
)

type SchemaError

type SchemaError struct {
	Type    string
	Finding Finding
}

func (*SchemaError) Error

func (e *SchemaError) Error() string

type SchemaFinding

type SchemaFinding struct {
	Type    string  `json:"type"`
	Finding Finding `json:"finding"`
}

SchemaFinding keeps unknown separate from a proof of an inhabited type. Findings follow declaration order, never map iteration order.

type SchemaReport

type SchemaReport struct {
	Roots    []string        `json:"roots"`
	Findings []SchemaFinding `json:"findings"`
}

func CheckSchema

func CheckSchema(program *language.Program, limits validation.Limits) (SchemaReport, error)

CheckSchema rejects proven-empty declarations, while returning explicit unknown findings for unsupported proofs and uninstantiated generic types. It is separate from language.Compile: type checking alone is not a proof. The current proof fragment is deliberately the same as Satisfiable.

func CheckSchemaRoots

func CheckSchemaRoots(program *language.Program, roots []string, limits validation.Limits) (SchemaReport, error)

CheckSchemaRoots classifies every declaration but rejects a proven-empty schema only when that declaration is an explicit closed entrypoint. An impossible unused definition or optional child cannot make an inhabitable selected root empty. Root order and duplicates do not affect the report.

type SyntaxDifference

type SyntaxDifference struct {
	Kind string `json:"kind"`
	Name string `json:"name,omitempty"`
}

SyntaxDifference names the changed surface, never the predicate literal, function body, or diagnostic-message contents. Order is deterministic.

Jump to

Keyboard shortcuts

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